[RFC,v3,10/22] libcamera: camera: Store `MetadataListPlan` in `Camera::Private`
diff mbox series

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

Commit Message

Barnabás Pőcze Oct. 30, 2025, 4:58 p.m. UTC
Just like `ControlInfoMap controlInfo_` is a public member of the private
camera data for pipeline handlers to populate, add a `MetadataListPlan` as
well for the pipeline handlers to fill. This will be used to initialize
the `MetadataList` of each request created by the camera.

Also add `Camera::metadata()`, which makes it accessible for applications.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
---
changes in v2:
  * make it available in `Camera::metadata()`
---
 include/libcamera/camera.h          |  2 ++
 include/libcamera/internal/camera.h |  2 ++
 src/libcamera/camera.cpp            | 21 +++++++++++++++++++++
 3 files changed, 25 insertions(+)

Comments

Kieran Bingham Nov. 2, 2025, 3:17 p.m. UTC | #1
Quoting Barnabás Pőcze (2025-10-30 16:58:04)
> Just like `ControlInfoMap controlInfo_` is a public member of the private
> camera data for pipeline handlers to populate, add a `MetadataListPlan` as
> well for the pipeline handlers to fill. This will be used to initialize
> the `MetadataList` of each request created by the camera.
> 
> Also add `Camera::metadata()`, which makes it accessible for applications.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
> changes in v2:
>   * make it available in `Camera::metadata()`
> ---
>  include/libcamera/camera.h          |  2 ++
>  include/libcamera/internal/camera.h |  2 ++
>  src/libcamera/camera.cpp            | 21 +++++++++++++++++++++
>  3 files changed, 25 insertions(+)
> 
> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
> index b24a297400..53089282a4 100644
> --- a/include/libcamera/camera.h
> +++ b/include/libcamera/camera.h
> @@ -31,6 +31,7 @@ class FrameBuffer;
>  class FrameBufferAllocator;
>  class PipelineHandler;
>  class Request;
> +class MetadataListPlan;
>  
>  class SensorConfiguration
>  {
> @@ -131,6 +132,7 @@ public:
>  
>         const ControlInfoMap &controls() const;
>         const ControlList &properties() const;
> +       const MetadataListPlan &metadata() const;
>  
>         const std::set<Stream *> &streams() const;
>  
> diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h
> index 8a2e9ed589..016c1ae512 100644
> --- a/include/libcamera/internal/camera.h
> +++ b/include/libcamera/internal/camera.h
> @@ -18,6 +18,7 @@
>  #include <libcamera/base/class.h>
>  
>  #include <libcamera/camera.h>
> +#include <libcamera/metadata_list_plan.h>
>  
>  namespace libcamera {
>  
> @@ -40,6 +41,7 @@ public:
>         std::queue<Request *> waitingRequests_;
>         ControlInfoMap controlInfo_;
>         ControlList properties_;
> +       MetadataListPlan metadataPlan_;
>  
>         uint32_t requestSequence_;
>  
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index 2e1e146a25..7bfa50b52c 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -658,6 +658,14 @@ Camera::Private::~Private()
>   * when creating the camera, and shall not be modified afterwards.
>   */
>  
> +/**
> + * \var Camera::Private::metadataPlan_
> + * \brief The set of metadata supported by the camera
> + *
> + * The metadata information shall be initialised by the pipeline handler when
> + * creating the camera.
> + */
> +
>  /**
>   * \var Camera::Private::requestSequence_
>   * \brief The queuing sequence number of the request
> @@ -1074,6 +1082,19 @@ const ControlInfoMap &Camera::controls() const
>         return _d()->controlInfo_;
>  }
>  
> +/**
> + * \brief Retrieve the set of metadata supported by the camera
> + *
> + * The list of metadata controls that may be reported by the camera
> + * for a \ref Request::metadata() "request".
> + *
> + * \return A MetadataListPlan listing the metadata controls supported by the camera
> + */
> +const MetadataListPlan &Camera::metadata() const
> +{
> +       return _d()->metadataPlan_;
> +}

I think exposing this is a good thing, and means generic applications
can identify what they will receive in advance. Might help with
construction of UI etc before the stream starts.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> +
>  /**
>   * \brief Retrieve the list of properties of the camera
>   *
> -- 
> 2.51.1
>

Patch
diff mbox series

diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
index b24a297400..53089282a4 100644
--- a/include/libcamera/camera.h
+++ b/include/libcamera/camera.h
@@ -31,6 +31,7 @@  class FrameBuffer;
 class FrameBufferAllocator;
 class PipelineHandler;
 class Request;
+class MetadataListPlan;
 
 class SensorConfiguration
 {
@@ -131,6 +132,7 @@  public:
 
 	const ControlInfoMap &controls() const;
 	const ControlList &properties() const;
+	const MetadataListPlan &metadata() const;
 
 	const std::set<Stream *> &streams() const;
 
diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h
index 8a2e9ed589..016c1ae512 100644
--- a/include/libcamera/internal/camera.h
+++ b/include/libcamera/internal/camera.h
@@ -18,6 +18,7 @@ 
 #include <libcamera/base/class.h>
 
 #include <libcamera/camera.h>
+#include <libcamera/metadata_list_plan.h>
 
 namespace libcamera {
 
@@ -40,6 +41,7 @@  public:
 	std::queue<Request *> waitingRequests_;
 	ControlInfoMap controlInfo_;
 	ControlList properties_;
+	MetadataListPlan metadataPlan_;
 
 	uint32_t requestSequence_;
 
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 2e1e146a25..7bfa50b52c 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -658,6 +658,14 @@  Camera::Private::~Private()
  * when creating the camera, and shall not be modified afterwards.
  */
 
+/**
+ * \var Camera::Private::metadataPlan_
+ * \brief The set of metadata supported by the camera
+ *
+ * The metadata information shall be initialised by the pipeline handler when
+ * creating the camera.
+ */
+
 /**
  * \var Camera::Private::requestSequence_
  * \brief The queuing sequence number of the request
@@ -1074,6 +1082,19 @@  const ControlInfoMap &Camera::controls() const
 	return _d()->controlInfo_;
 }
 
+/**
+ * \brief Retrieve the set of metadata supported by the camera
+ *
+ * The list of metadata controls that may be reported by the camera
+ * for a \ref Request::metadata() "request".
+ *
+ * \return A MetadataListPlan listing the metadata controls supported by the camera
+ */
+const MetadataListPlan &Camera::metadata() const
+{
+	return _d()->metadataPlan_;
+}
+
 /**
  * \brief Retrieve the list of properties of the camera
  *