[RFC,v2,11/22] libcamera: request: Store `MetadataList`
diff mbox series

Message ID 20250721104622.1550908-12-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: Add `MetadataList`
Related show

Commit Message

Barnabás Pőcze July 21, 2025, 10:46 a.m. UTC
Add a `MetadataList` to the `Request` object to store the metadata items
returned by the camera. The metadata list is initialized using the camera's
`MetadataListPlan` object, which is supposed to be filled by the pipeline
handlers.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 include/libcamera/request.h | 5 +++++
 src/libcamera/request.cpp   | 2 ++
 2 files changed, 7 insertions(+)

Comments

Jacopo Mondi July 28, 2025, 9:31 a.m. UTC | #1
Hi Barnabás

On Mon, Jul 21, 2025 at 12:46:11PM +0200, Barnabás Pőcze wrote:
> Add a `MetadataList` to the `Request` object to store the metadata items
> returned by the camera. The metadata list is initialized using the camera's
> `MetadataListPlan` object, which is supposed to be filled by the pipeline
> handlers.

Could you mention that for the time being, the accessor member is
called metadata2() ?

I wonder if we should instead use metadataList() as long as we don't drop
metadata()

>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
>  include/libcamera/request.h | 5 +++++
>  src/libcamera/request.cpp   | 2 ++
>  2 files changed, 7 insertions(+)
>
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index e214a9d13..196557865 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -18,6 +18,7 @@
>
>  #include <libcamera/controls.h>
>  #include <libcamera/fence.h>
> +#include <libcamera/metadata_list.h>
>
>  namespace libcamera {
>
> @@ -51,6 +52,9 @@ public:
>
>  	ControlList &controls() { return *controls_; }
>  	ControlList &metadata() { return *metadata_; }
> +#ifndef __DOXYGEN__
> +	[[nodiscard]] MetadataList &metadata2() { return metadata2_; }
> +#endif
>  	const BufferMap &buffers() const { return bufferMap_; }
>  	int addBuffer(const Stream *stream, FrameBuffer *buffer,
>  		      std::unique_ptr<Fence> fence = nullptr);
> @@ -69,6 +73,7 @@ private:
>
>  	ControlList *controls_;
>  	ControlList *metadata_;
> +	MetadataList metadata2_;
>  	BufferMap bufferMap_;
>
>  	const uint64_t cookie_;
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 7f1e11e8f..17ca67d08 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -354,6 +354,7 @@ void Request::Private::timeout()
>   */
>  Request::Request(Camera *camera, uint64_t cookie)
>  	: Extensible(std::make_unique<Private>(camera)),
> +	  metadata2_(camera->_d()->metadataPlan_),
>  	  cookie_(cookie), status_(RequestPending)
>  {
>  	controls_ = new ControlList(controls::controls,
> @@ -407,6 +408,7 @@ void Request::reuse(ReuseFlag flags)
>
>  	controls_->clear();
>  	metadata_->clear();
> +	metadata2_.clear();
>  }
>
>  /**
> --
> 2.50.1
>
Barnabás Pőcze July 30, 2025, 2:49 p.m. UTC | #2
Hi

2025. 07. 28. 11:31 keltezéssel, Jacopo Mondi írta:
> Hi Barnabás
> 
> On Mon, Jul 21, 2025 at 12:46:11PM +0200, Barnabás Pőcze wrote:
>> Add a `MetadataList` to the `Request` object to store the metadata items
>> returned by the camera. The metadata list is initialized using the camera's
>> `MetadataListPlan` object, which is supposed to be filled by the pipeline
>> handlers.
> 
> Could you mention that for the time being, the accessor member is
> called metadata2() ?

done


> 
> I wonder if we should instead use metadataList() as long as we don't drop
> metadata()

Since it will eventually be removed at the end I don't think it matters too much.
Please confirm if I should make the change.


Regards,
Barnabás Pőcze

> 
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>> ---
>>   include/libcamera/request.h | 5 +++++
>>   src/libcamera/request.cpp   | 2 ++
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
>> index e214a9d13..196557865 100644
>> --- a/include/libcamera/request.h
>> +++ b/include/libcamera/request.h
>> @@ -18,6 +18,7 @@
>>
>>   #include <libcamera/controls.h>
>>   #include <libcamera/fence.h>
>> +#include <libcamera/metadata_list.h>
>>
>>   namespace libcamera {
>>
>> @@ -51,6 +52,9 @@ public:
>>
>>   	ControlList &controls() { return *controls_; }
>>   	ControlList &metadata() { return *metadata_; }
>> +#ifndef __DOXYGEN__
>> +	[[nodiscard]] MetadataList &metadata2() { return metadata2_; }
>> +#endif
>>   	const BufferMap &buffers() const { return bufferMap_; }
>>   	int addBuffer(const Stream *stream, FrameBuffer *buffer,
>>   		      std::unique_ptr<Fence> fence = nullptr);
>> @@ -69,6 +73,7 @@ private:
>>
>>   	ControlList *controls_;
>>   	ControlList *metadata_;
>> +	MetadataList metadata2_;
>>   	BufferMap bufferMap_;
>>
>>   	const uint64_t cookie_;
>> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
>> index 7f1e11e8f..17ca67d08 100644
>> --- a/src/libcamera/request.cpp
>> +++ b/src/libcamera/request.cpp
>> @@ -354,6 +354,7 @@ void Request::Private::timeout()
>>    */
>>   Request::Request(Camera *camera, uint64_t cookie)
>>   	: Extensible(std::make_unique<Private>(camera)),
>> +	  metadata2_(camera->_d()->metadataPlan_),
>>   	  cookie_(cookie), status_(RequestPending)
>>   {
>>   	controls_ = new ControlList(controls::controls,
>> @@ -407,6 +408,7 @@ void Request::reuse(ReuseFlag flags)
>>
>>   	controls_->clear();
>>   	metadata_->clear();
>> +	metadata2_.clear();
>>   }
>>
>>   /**
>> --
>> 2.50.1
>>
Jacopo Mondi Aug. 2, 2025, 9:57 a.m. UTC | #3
On Wed, Jul 30, 2025 at 04:49:05PM +0200, Barnabás Pőcze wrote:
> Hi
>
> 2025. 07. 28. 11:31 keltezéssel, Jacopo Mondi írta:
> > Hi Barnabás
> >
> > On Mon, Jul 21, 2025 at 12:46:11PM +0200, Barnabás Pőcze wrote:
> > > Add a `MetadataList` to the `Request` object to store the metadata items
> > > returned by the camera. The metadata list is initialized using the camera's
> > > `MetadataListPlan` object, which is supposed to be filled by the pipeline
> > > handlers.
> >
> > Could you mention that for the time being, the accessor member is
> > called metadata2() ?
>
> done
>
>
> >
> > I wonder if we should instead use metadataList() as long as we don't drop
> > metadata()
>
> Since it will eventually be removed at the end I don't think it matters too much.
> Please confirm if I should make the change.
>

No worries, I was thinking out loud here

>
> Regards,
> Barnabás Pőcze
>
> >
> > >
> > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > > ---
> > >   include/libcamera/request.h | 5 +++++
> > >   src/libcamera/request.cpp   | 2 ++
> > >   2 files changed, 7 insertions(+)
> > >
> > > diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> > > index e214a9d13..196557865 100644
> > > --- a/include/libcamera/request.h
> > > +++ b/include/libcamera/request.h
> > > @@ -18,6 +18,7 @@
> > >
> > >   #include <libcamera/controls.h>
> > >   #include <libcamera/fence.h>
> > > +#include <libcamera/metadata_list.h>
> > >
> > >   namespace libcamera {
> > >
> > > @@ -51,6 +52,9 @@ public:
> > >
> > >   	ControlList &controls() { return *controls_; }
> > >   	ControlList &metadata() { return *metadata_; }
> > > +#ifndef __DOXYGEN__
> > > +	[[nodiscard]] MetadataList &metadata2() { return metadata2_; }
> > > +#endif
> > >   	const BufferMap &buffers() const { return bufferMap_; }
> > >   	int addBuffer(const Stream *stream, FrameBuffer *buffer,
> > >   		      std::unique_ptr<Fence> fence = nullptr);
> > > @@ -69,6 +73,7 @@ private:
> > >
> > >   	ControlList *controls_;
> > >   	ControlList *metadata_;
> > > +	MetadataList metadata2_;
> > >   	BufferMap bufferMap_;
> > >
> > >   	const uint64_t cookie_;
> > > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> > > index 7f1e11e8f..17ca67d08 100644
> > > --- a/src/libcamera/request.cpp
> > > +++ b/src/libcamera/request.cpp
> > > @@ -354,6 +354,7 @@ void Request::Private::timeout()
> > >    */
> > >   Request::Request(Camera *camera, uint64_t cookie)
> > >   	: Extensible(std::make_unique<Private>(camera)),
> > > +	  metadata2_(camera->_d()->metadataPlan_),
> > >   	  cookie_(cookie), status_(RequestPending)
> > >   {
> > >   	controls_ = new ControlList(controls::controls,
> > > @@ -407,6 +408,7 @@ void Request::reuse(ReuseFlag flags)
> > >
> > >   	controls_->clear();
> > >   	metadata_->clear();
> > > +	metadata2_.clear();
> > >   }
> > >
> > >   /**
> > > --
> > > 2.50.1
> > >
>

Patch
diff mbox series

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index e214a9d13..196557865 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -18,6 +18,7 @@ 
 
 #include <libcamera/controls.h>
 #include <libcamera/fence.h>
+#include <libcamera/metadata_list.h>
 
 namespace libcamera {
 
@@ -51,6 +52,9 @@  public:
 
 	ControlList &controls() { return *controls_; }
 	ControlList &metadata() { return *metadata_; }
+#ifndef __DOXYGEN__
+	[[nodiscard]] MetadataList &metadata2() { return metadata2_; }
+#endif
 	const BufferMap &buffers() const { return bufferMap_; }
 	int addBuffer(const Stream *stream, FrameBuffer *buffer,
 		      std::unique_ptr<Fence> fence = nullptr);
@@ -69,6 +73,7 @@  private:
 
 	ControlList *controls_;
 	ControlList *metadata_;
+	MetadataList metadata2_;
 	BufferMap bufferMap_;
 
 	const uint64_t cookie_;
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 7f1e11e8f..17ca67d08 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -354,6 +354,7 @@  void Request::Private::timeout()
  */
 Request::Request(Camera *camera, uint64_t cookie)
 	: Extensible(std::make_unique<Private>(camera)),
+	  metadata2_(camera->_d()->metadataPlan_),
 	  cookie_(cookie), status_(RequestPending)
 {
 	controls_ = new ControlList(controls::controls,
@@ -407,6 +408,7 @@  void Request::reuse(ReuseFlag flags)
 
 	controls_->clear();
 	metadata_->clear();
+	metadata2_.clear();
 }
 
 /**