libcamera: Add pointer to MediaDevice to MediaObject
Add a MediaDevice member field to the MediaObject class hierarcy. Each media object now has a reference to the media device it belongs to, and which it has been created by. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -21,14 +21,17 @@ class MediaPad;
|
||||
class MediaObject
|
||||
{
|
||||
public:
|
||||
MediaDevice *device() { return dev_; }
|
||||
unsigned int id() const { return id_; }
|
||||
|
||||
protected:
|
||||
friend class MediaDevice;
|
||||
|
||||
MediaObject(unsigned int id) : id_(id) { }
|
||||
MediaObject(MediaDevice *dev, unsigned int id) :
|
||||
dev_(dev), id_(id) { }
|
||||
virtual ~MediaObject() { }
|
||||
|
||||
MediaDevice *dev_;
|
||||
unsigned int id_;
|
||||
};
|
||||
|
||||
@@ -93,7 +96,7 @@ public:
|
||||
private:
|
||||
friend class MediaDevice;
|
||||
|
||||
MediaEntity(const struct media_v2_entity *entity,
|
||||
MediaEntity(MediaDevice *dev, const struct media_v2_entity *entity,
|
||||
unsigned int major = 0, unsigned int minor = 0);
|
||||
MediaEntity(const MediaEntity &) = delete;
|
||||
~MediaEntity();
|
||||
|
||||
Reference in New Issue
Block a user