libcamera: device_enumerator: Use MediaDevice
Replace usage of the DeviceInfo class with MediaDevice in the DeviceEnumerator and remove the DeviceInfo class. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
d4af90d729
commit
d83269aae0
@@ -15,29 +15,7 @@
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class DeviceInfo
|
||||
{
|
||||
public:
|
||||
DeviceInfo(const std::string &devnode, const struct media_device_info &info,
|
||||
const std::map<std::string, std::string> &entities);
|
||||
|
||||
int acquire();
|
||||
void release();
|
||||
bool busy() const;
|
||||
|
||||
const std::string &devnode() const;
|
||||
const struct media_device_info &info() const;
|
||||
std::vector<std::string> entities() const;
|
||||
|
||||
int lookup(const std::string &name, std::string &devnode) const;
|
||||
|
||||
private:
|
||||
bool acquired_;
|
||||
|
||||
std::string devnode_;
|
||||
struct media_device_info info_;
|
||||
std::map<std::string, std::string> entities_;
|
||||
};
|
||||
class MediaDevice;
|
||||
|
||||
class DeviceMatch
|
||||
{
|
||||
@@ -46,7 +24,7 @@ public:
|
||||
|
||||
void add(const std::string &entity);
|
||||
|
||||
bool match(const DeviceInfo *info) const;
|
||||
bool match(const MediaDevice *device) const;
|
||||
|
||||
private:
|
||||
std::string driver_;
|
||||
@@ -63,16 +41,13 @@ public:
|
||||
virtual int init() = 0;
|
||||
virtual int enumerate() = 0;
|
||||
|
||||
DeviceInfo *search(DeviceMatch &dm) const;
|
||||
MediaDevice *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);
|
||||
std::vector<MediaDevice *> devices_;
|
||||
|
||||
virtual std::string lookupDevnode(int major, int minor) = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user