Message ID | 20190123150351.8307-2-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Niklas, Thank you for the patch. On Wed, Jan 23, 2019 at 04:03:50PM +0100, Niklas Söderlund wrote: > The media entity flags can be useful for pipeline handlers to find the > default device in a media graph which is marked with the > MEDIA_ENT_FL_DEFAULT flag. This will be especially useful for the UVC > pipeline handler where the entity names differ per device. > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> We might want a helper to find the default entity, but this patch looks good to me regardless. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/libcamera/include/media_object.h | 2 ++ > src/libcamera/media_object.cpp | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h > index 64095bec8606bd32..2a3ffc06c876d792 100644 > --- a/src/libcamera/include/media_object.h > +++ b/src/libcamera/include/media_object.h > @@ -85,6 +85,7 @@ class MediaEntity : public MediaObject > public: > const std::string &name() const { return name_; } > unsigned int function() const { return function_; } > + unsigned int flags() const { return flags_; } > const std::string &deviceNode() const { return deviceNode_; } > unsigned int deviceMajor() const { return major_; } > unsigned int deviceMinor() const { return minor_; } > @@ -106,6 +107,7 @@ private: > > std::string name_; > unsigned int function_; > + unsigned int flags_; > std::string deviceNode_; > unsigned int major_; > unsigned int minor_; > diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp > index baf9aeaa8fffe1a6..f6abcd8676a3866d 100644 > --- a/src/libcamera/media_object.cpp > +++ b/src/libcamera/media_object.cpp > @@ -265,6 +265,16 @@ void MediaPad::addLink(MediaLink *link) > * \return The entity's function > */ > > +/** > + * \fn MediaEntity::flags() > + * \brief Retrieve the entity's flags > + * > + * Media entity flags are expressed using the MEDIA_ENT_FL_* macros > + * defined by the Media Controller API. > + * > + * \return The entity's flags > + */ > + > /** > * \fn MediaEntity::deviceNode() > * \brief Retrieve the entity's device node path, if any > @@ -358,7 +368,8 @@ MediaEntity::MediaEntity(MediaDevice *dev, > const struct media_v2_entity *entity, > unsigned int major, unsigned int minor) > : MediaObject(dev, entity->id), name_(entity->name), > - function_(entity->function), major_(major), minor_(minor) > + function_(entity->function), flags_(entity->flags), > + major_(major), minor_(minor) > { > } >
Hi, On 2019-01-25 13:04:18 +0200, Laurent Pinchart wrote: > Hi Niklas, > > Thank you for the patch. > > On Wed, Jan 23, 2019 at 04:03:50PM +0100, Niklas Söderlund wrote: > > The media entity flags can be useful for pipeline handlers to find the > > default device in a media graph which is marked with the > > MEDIA_ENT_FL_DEFAULT flag. This will be especially useful for the UVC > > pipeline handler where the entity names differ per device. > > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > We might want a helper to find the default entity, but this patch looks > good to me regardless. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Thanks I pushed this to master. > > > --- > > src/libcamera/include/media_object.h | 2 ++ > > src/libcamera/media_object.cpp | 13 ++++++++++++- > > 2 files changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h > > index 64095bec8606bd32..2a3ffc06c876d792 100644 > > --- a/src/libcamera/include/media_object.h > > +++ b/src/libcamera/include/media_object.h > > @@ -85,6 +85,7 @@ class MediaEntity : public MediaObject > > public: > > const std::string &name() const { return name_; } > > unsigned int function() const { return function_; } > > + unsigned int flags() const { return flags_; } > > const std::string &deviceNode() const { return deviceNode_; } > > unsigned int deviceMajor() const { return major_; } > > unsigned int deviceMinor() const { return minor_; } > > @@ -106,6 +107,7 @@ private: > > > > std::string name_; > > unsigned int function_; > > + unsigned int flags_; > > std::string deviceNode_; > > unsigned int major_; > > unsigned int minor_; > > diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp > > index baf9aeaa8fffe1a6..f6abcd8676a3866d 100644 > > --- a/src/libcamera/media_object.cpp > > +++ b/src/libcamera/media_object.cpp > > @@ -265,6 +265,16 @@ void MediaPad::addLink(MediaLink *link) > > * \return The entity's function > > */ > > > > +/** > > + * \fn MediaEntity::flags() > > + * \brief Retrieve the entity's flags > > + * > > + * Media entity flags are expressed using the MEDIA_ENT_FL_* macros > > + * defined by the Media Controller API. > > + * > > + * \return The entity's flags > > + */ > > + > > /** > > * \fn MediaEntity::deviceNode() > > * \brief Retrieve the entity's device node path, if any > > @@ -358,7 +368,8 @@ MediaEntity::MediaEntity(MediaDevice *dev, > > const struct media_v2_entity *entity, > > unsigned int major, unsigned int minor) > > : MediaObject(dev, entity->id), name_(entity->name), > > - function_(entity->function), major_(major), minor_(minor) > > + function_(entity->function), flags_(entity->flags), > > + major_(major), minor_(minor) > > { > > } > > > > -- > Regards, > > Laurent Pinchart
diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h index 64095bec8606bd32..2a3ffc06c876d792 100644 --- a/src/libcamera/include/media_object.h +++ b/src/libcamera/include/media_object.h @@ -85,6 +85,7 @@ class MediaEntity : public MediaObject public: const std::string &name() const { return name_; } unsigned int function() const { return function_; } + unsigned int flags() const { return flags_; } const std::string &deviceNode() const { return deviceNode_; } unsigned int deviceMajor() const { return major_; } unsigned int deviceMinor() const { return minor_; } @@ -106,6 +107,7 @@ private: std::string name_; unsigned int function_; + unsigned int flags_; std::string deviceNode_; unsigned int major_; unsigned int minor_; diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp index baf9aeaa8fffe1a6..f6abcd8676a3866d 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -265,6 +265,16 @@ void MediaPad::addLink(MediaLink *link) * \return The entity's function */ +/** + * \fn MediaEntity::flags() + * \brief Retrieve the entity's flags + * + * Media entity flags are expressed using the MEDIA_ENT_FL_* macros + * defined by the Media Controller API. + * + * \return The entity's flags + */ + /** * \fn MediaEntity::deviceNode() * \brief Retrieve the entity's device node path, if any @@ -358,7 +368,8 @@ MediaEntity::MediaEntity(MediaDevice *dev, const struct media_v2_entity *entity, unsigned int major, unsigned int minor) : MediaObject(dev, entity->id), name_(entity->name), - function_(entity->function), major_(major), minor_(minor) + function_(entity->function), flags_(entity->flags), + major_(major), minor_(minor) { }
The media entity flags can be useful for pipeline handlers to find the default device in a media graph which is marked with the MEDIA_ENT_FL_DEFAULT flag. This will be especially useful for the UVC pipeline handler where the entity names differ per device. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- src/libcamera/include/media_object.h | 2 ++ src/libcamera/media_object.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)