libcamera: media_pipeline: Add accessor for MediaPipeline list of entities

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>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Andrei Gansari
2025-11-27 16:45:17 +01:00
committed by Kieran Bingham
parent 3c17d1fbb2
commit 056613cb12
2 changed files with 56 additions and 25 deletions

View File

@@ -23,36 +23,21 @@ struct V4L2SubdeviceFormat;
class MediaPipeline
{
public:
struct Entity {
MediaEntity *entity;
bool supportsRouting;
const MediaPad *sink;
const MediaPad *source;
MediaLink *sourceLink;
};
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;
};
const std::list<Entity> &entities() const { return entities_; }
private:
std::list<Entity> entities_;
};

View File

@@ -43,6 +43,52 @@ LOG_DEFINE_CATEGORY(MediaPipeline)
* two entities in a media graph.
*/
/**
* \struct MediaPipeline::Entity
* \brief A node composing the media pipeline
*
* The MediaPipeline::Entity structure stores how a MediaEntity composing a
* media pipeline is connected to other media entities. 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
* \brief Pointer to the libcamera::MediaEntity, always valid
*/
/**
* \var MediaPipeline::Entity::supportsRouting
* \brief Whether or not the entity is a subdev that supports the routing API
*/
/**
* \var MediaPipeline::Entity::sink
* \brief 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
* \brief 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
* \brief 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
*