libcamera: device_enumerator: add DeviceEnumerator class
Provide a DeviceEnumerator base class which enumerates all media devices in the system and information about them, resolving Media Controller data structures to paths and a method to search in all the enumerated information. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -53,6 +53,28 @@ private:
|
||||
std::vector<std::string> entities_;
|
||||
};
|
||||
|
||||
class DeviceEnumerator
|
||||
{
|
||||
public:
|
||||
virtual ~DeviceEnumerator();
|
||||
|
||||
virtual int init() = 0;
|
||||
virtual int enumerate() = 0;
|
||||
|
||||
DeviceInfo *search(DeviceMatch &dm) const;
|
||||
|
||||
protected:
|
||||
int addDevice(const std::string &devnode);
|
||||
|
||||
private:
|
||||
std::vector<DeviceInfo *> devices_;
|
||||
|
||||
int readInfo(int fd, struct media_device_info &info);
|
||||
int readTopology(int fd, std::map<std::string, std::string> &entities);
|
||||
|
||||
virtual std::string lookupDevnode(int major, int minor) = 0;
|
||||
};
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_H__ */
|
||||
|
||||
Reference in New Issue
Block a user