| Message ID | 20251114154341.654850-2-antoine.bouyer@nxp.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hello On Fri, Nov 14, 2025 at 04:43:40PM +0100, Antoine Bouyer wrote: > From: Andrei Gansari <andrei.gansari@nxp.com> > > Exposes internal MediaEntity::Entity list to help extracting more > information regarding linked entities. > > For example, when the pad index of the last device in the list need to be > retrieved from the media pipeline user. > > Exposes as const to with a dedicated access to prevent any corruption from > user. Then it is still protected so as when the list was private. > > Since MediaPipeline::Entity needs also to be moved to public, then need to > add some documentation in cpp source. Existing documentation from header > file is applied when available. > > Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com> > Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com> > --- > include/libcamera/internal/media_pipeline.h | 29 ++++---------- > src/libcamera/media_pipeline.cpp | 44 +++++++++++++++++++++ > 2 files changed, 51 insertions(+), 22 deletions(-) > > diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h > index a7a4b8c559cd..f62e3e8c58b0 100644 > --- a/include/libcamera/internal/media_pipeline.h > +++ b/include/libcamera/internal/media_pipeline.h > @@ -23,36 +23,21 @@ struct V4L2SubdeviceFormat; > class MediaPipeline > { > public: > - int init(MediaEntity *source, std::string_view sink); > - int initLinks(); > - int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); > - > -private: > struct Entity { > - /* The media entity, always valid. */ > MediaEntity *entity; > - /* > - * Whether or not the entity is a subdev that supports the > - * routing API. > - */ > bool supportsRouting; > - /* > - * The local sink pad connected to the upstream entity, null for > - * the camera sensor at the beginning of the pipeline. > - */ > const MediaPad *sink; > - /* > - * The local source pad connected to the downstream entity, null > - * for the video node at the end of the pipeline. > - */ > const MediaPad *source; > - /* > - * The link on the source pad, to the downstream entity, null > - * for the video node at the end of the pipeline. > - */ > MediaLink *sourceLink; > }; > > + int init(MediaEntity *source, std::string_view sink); > + int initLinks(); > + int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); > + > + const std::list<Entity> &entities() const { return entities_; } > + > +private: > std::list<Entity> entities_; > }; > > diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp > index c4e9f69b8f6a..1bb55a507fce 100644 > --- a/src/libcamera/media_pipeline.cpp > +++ b/src/libcamera/media_pipeline.cpp > @@ -43,6 +43,50 @@ LOG_DEFINE_CATEGORY(MediaPipeline) > * two entities in a media graph. > */ > > +/** > + * \struct MediaPipeline::Entity > + * \brief A node composing the media pipeline > + * > + * The MediaPipeline::Entity struct stores how a MediaEntity composing a s/struct/structure > + * media pipeline is connected to other media entities. Source and sink pads > + * are stored, so as whether the entity itself does support internal routing. It stores pointers to the source pad, the sink pad and the media link traversed by the media pipeline, as well as a flag that reports if the entity supports internal routing. > + */ > + > +/** > + * \var MediaPipeline::Entity::entity > + * Pointer to the libcamera::MediaEntity, always valid > + */ > + > +/** > + * \var MediaPipeline::Entity::supportsRouting > + * Whether or not the entity is a subdev that supports the routing API > + */ > + > +/** > + * \var MediaPipeline::Entity::sink > + * The local libcamera::MediaPad sink pad connected to the upstream entity, > + * null for the camera sensor at the beginning of the pipeline. Some phrases ends with a '.' some don't. Also, should these be \brief ? (in case they are, no '.' at the end) > + */ > + > +/** > + * \var MediaPipeline::Entity::source > + * The local libcamera::MediaPad source pad connected to the upstream entity, > + * null for the last node at the end of the pipeline. > + */ > + > +/** > + * \var MediaPipeline::Entity::sourceLink > + * The link on the libcamera::MediaLink source pad, to the downstream entity, > + * null for the last node at the end of the pipeline. > + */ > + > +/** > + * \fn MediaPipeline::entities() > + * \brief Retrieve list of entities composing the media pipeline > + * \return The list of MediaPipeline::Entity entities composing the media > + * pipeline. No '.' at the end Minors apart Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Thanks j > + */ > + > /** > * \brief Retrieve all source pads connected to a sink pad through active routes > * > -- > 2.34.1 >
diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h index a7a4b8c559cd..f62e3e8c58b0 100644 --- a/include/libcamera/internal/media_pipeline.h +++ b/include/libcamera/internal/media_pipeline.h @@ -23,36 +23,21 @@ struct V4L2SubdeviceFormat; class MediaPipeline { public: - int init(MediaEntity *source, std::string_view sink); - int initLinks(); - int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); - -private: struct Entity { - /* The media entity, always valid. */ MediaEntity *entity; - /* - * Whether or not the entity is a subdev that supports the - * routing API. - */ bool supportsRouting; - /* - * The local sink pad connected to the upstream entity, null for - * the camera sensor at the beginning of the pipeline. - */ const MediaPad *sink; - /* - * The local source pad connected to the downstream entity, null - * for the video node at the end of the pipeline. - */ const MediaPad *source; - /* - * The link on the source pad, to the downstream entity, null - * for the video node at the end of the pipeline. - */ MediaLink *sourceLink; }; + int init(MediaEntity *source, std::string_view sink); + int initLinks(); + int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); + + const std::list<Entity> &entities() const { return entities_; } + +private: std::list<Entity> entities_; }; diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp index c4e9f69b8f6a..1bb55a507fce 100644 --- a/src/libcamera/media_pipeline.cpp +++ b/src/libcamera/media_pipeline.cpp @@ -43,6 +43,50 @@ LOG_DEFINE_CATEGORY(MediaPipeline) * two entities in a media graph. */ +/** + * \struct MediaPipeline::Entity + * \brief A node composing the media pipeline + * + * The MediaPipeline::Entity struct stores how a MediaEntity composing a + * media pipeline is connected to other media entities. Source and sink pads + * are stored, so as whether the entity itself does support internal routing. + */ + +/** + * \var MediaPipeline::Entity::entity + * Pointer to the libcamera::MediaEntity, always valid + */ + +/** + * \var MediaPipeline::Entity::supportsRouting + * Whether or not the entity is a subdev that supports the routing API + */ + +/** + * \var MediaPipeline::Entity::sink + * The local libcamera::MediaPad sink pad connected to the upstream entity, + * null for the camera sensor at the beginning of the pipeline. + */ + +/** + * \var MediaPipeline::Entity::source + * The local libcamera::MediaPad source pad connected to the upstream entity, + * null for the last node at the end of the pipeline. + */ + +/** + * \var MediaPipeline::Entity::sourceLink + * The link on the libcamera::MediaLink source pad, to the downstream entity, + * null for the last node at the end of the pipeline. + */ + +/** + * \fn MediaPipeline::entities() + * \brief Retrieve list of entities composing the media pipeline + * \return The list of MediaPipeline::Entity entities composing the media + * pipeline. + */ + /** * \brief Retrieve all source pads connected to a sink pad through active routes *