[v1,1/2] libamera: media_pipeline: Move entities list to public
diff mbox series

Message ID 20251113100414.535550-2-antoine.bouyer@nxp.com
State New
Headers show
Series
  • imx8-isi: Use MediaPipeline
Related show

Commit Message

Antoine Bouyer Nov. 13, 2025, 10:04 a.m. UTC
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 prevent any corruption from user. Then it is still
protected so as when the list was private.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
---
 include/libcamera/internal/media_pipeline.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Barnabás Pőcze Nov. 13, 2025, 10:11 a.m. UTC | #1
Hi

2025. 11. 13. 11:04 keltezéssel, Antoine Bouyer írta:
> 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 prevent any corruption from user. Then it is still
> protected so as when the list was private.
> 
> Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
> Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
> ---
>   include/libcamera/internal/media_pipeline.h | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h
> index a7a4b8c559cd..5f37d4bd57a7 100644
> --- a/include/libcamera/internal/media_pipeline.h
> +++ b/include/libcamera/internal/media_pipeline.h
> @@ -27,7 +27,6 @@ public:
>   	int initLinks();
>   	int configure(CameraSensor *sensor, V4L2SubdeviceFormat *);
>   
> -private:
>   	struct Entity {
>   		/* The media entity, always valid. */
>   		MediaEntity *entity;
> @@ -53,6 +52,9 @@ private:
>   		MediaLink *sourceLink;
>   	};
>   
> +	const std::list<Entity> &entities() { return entities_; }

I'm pretty sure you will now have to document both the `Entity` type with its
members and the `entities()` function in media_pipeline.cpp.


Regards,
Barnabás Pőcze


> +
> +private:
>   	std::list<Entity> entities_;
>   };
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h
index a7a4b8c559cd..5f37d4bd57a7 100644
--- a/include/libcamera/internal/media_pipeline.h
+++ b/include/libcamera/internal/media_pipeline.h
@@ -27,7 +27,6 @@  public:
 	int initLinks();
 	int configure(CameraSensor *sensor, V4L2SubdeviceFormat *);
 
-private:
 	struct Entity {
 		/* The media entity, always valid. */
 		MediaEntity *entity;
@@ -53,6 +52,9 @@  private:
 		MediaLink *sourceLink;
 	};
 
+	const std::list<Entity> &entities() { return entities_; }
+
+private:
 	std::list<Entity> entities_;
 };