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

Message ID 20251113100414.535550-2-antoine.bouyer@nxp.com
State Superseded
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_;
>   };
>
Antoine Bouyer Nov. 14, 2025, 1:10 p.m. UTC | #2
Hi Barnabás,

On 11/13/25 11:11 AM, Barnabás Pőcze wrote:
> Caution: This is an external email. Please take care when clicking links 
> or opening attachments. When in doubt, report the message using the 
> 'Report this email' button
> 
> 
> 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.

Yes indeed :( saw the same on this job:
https://gitlab.freedesktop.org/camera/libcamera/-/jobs/87812646#L685

I managed to reproduce locally. So I hope V2 should be fine.

Best regards
Antoine

> 
> 
> Regards,
> Barnabás Pőcze
> 
> 
>> +
>> +private:
>>       std::list<Entity> entities_;
>>   };
>>
>
Jacopo Mondi Nov. 14, 2025, 3:12 p.m. UTC | #3
Hi

On Thu, Nov 13, 2025 at 11:04:13AM +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 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;
>  	};

Documentation apart, I would move the struct type definition to the
top of the public: section

>
> +	const std::list<Entity> &entities() { return entities_; }

	const std::list<Entity> &entities() const { return entities_; }

Maybe the function should be marked as const-callable as well ?

Thanks
  j

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

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_;
 };