[RFC,v3,12/22,DNI] apps: cam: Print `MetadataListPlan` of camera
diff mbox series

Message ID 20251030165816.1095180-13-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
When `--list-controls` is specified, print the set of supported metadata.

---
changes in v3:
  * print number of elements separately instead of NxM
---
 src/apps/cam/camera_session.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Kieran Bingham Nov. 2, 2025, 3:12 p.m. UTC | #1
Quoting Barnabás Pőcze (2025-10-30 16:58:06)
> When `--list-controls` is specified, print the set of supported metadata.
> 

I don't think this should be DNI. I think this should be added if this
series is merged. Maybe it could be separated to --list-metadata ? but I
think both control info and metadata info are closely related.


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


> ---
> changes in v3:
>   * print number of elements separately instead of NxM
> ---
>  src/apps/cam/camera_session.cpp | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
> index 1596a25a3a..0aef3128f2 100644
> --- a/src/apps/cam/camera_session.cpp
> +++ b/src/apps/cam/camera_session.cpp
> @@ -14,6 +14,7 @@
>  #include <sstream>
>  
>  #include <libcamera/control_ids.h>
> +#include <libcamera/metadata_list_plan.h>
>  #include <libcamera/property_ids.h>
>  
>  #include "../common/event_loop.h"
> @@ -228,6 +229,20 @@ void CameraSession::listControls() const
>                         std::cout << std::endl;
>                 }
>         }
> +
> +       for (const auto &[id, info] : camera_->metadata()) {
> +               const auto *cid = controls::controls.at(id);
> +
> +               std::cout << "Metadata: [  out] " << cid->vendor() << "::" << cid->name()
> +                         << " type:" << info.type
> +                         << " size:" << info.size
> +                         << " alignment:" << info.alignment;
> +
> +               if (info.isArray)
> +                       std::cout << " count:" << info.numElements;
> +
> +               std::cout << std::endl;
> +       }
>  }
>  
>  void CameraSession::listProperties() const
> -- 
> 2.51.1
>
Barnabás Pőcze Nov. 3, 2025, 9:42 a.m. UTC | #2
Hi

2025. 11. 02. 16:12 keltezéssel, Kieran Bingham írta:
> Quoting Barnabás Pőcze (2025-10-30 16:58:06)
>> When `--list-controls` is specified, print the set of supported metadata.
>>
> 
> I don't think this should be DNI. I think this should be added if this
> series is merged. Maybe it could be separated to --list-metadata ? but I
> think both control info and metadata info are closely related.

This was already brought up concerning the previous version. If there is
agreement on how to proceed, I can implement it. I am not sure which
one is better: adding `--list-metadata` or using `--list-controls`.


> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> 
>> ---
>> changes in v3:
>>    * print number of elements separately instead of NxM
>> ---
>>   src/apps/cam/camera_session.cpp | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
>> index 1596a25a3a..0aef3128f2 100644
>> --- a/src/apps/cam/camera_session.cpp
>> +++ b/src/apps/cam/camera_session.cpp
>> @@ -14,6 +14,7 @@
>>   #include <sstream>
>>   
>>   #include <libcamera/control_ids.h>
>> +#include <libcamera/metadata_list_plan.h>
>>   #include <libcamera/property_ids.h>
>>   
>>   #include "../common/event_loop.h"
>> @@ -228,6 +229,20 @@ void CameraSession::listControls() const
>>                          std::cout << std::endl;
>>                  }
>>          }
>> +
>> +       for (const auto &[id, info] : camera_->metadata()) {
>> +               const auto *cid = controls::controls.at(id);
>> +
>> +               std::cout << "Metadata: [  out] " << cid->vendor() << "::" << cid->name()
>> +                         << " type:" << info.type
>> +                         << " size:" << info.size
>> +                         << " alignment:" << info.alignment;
>> +
>> +               if (info.isArray)
>> +                       std::cout << " count:" << info.numElements;
>> +
>> +               std::cout << std::endl;
>> +       }
>>   }
>>   
>>   void CameraSession::listProperties() const
>> -- 
>> 2.51.1
>>

Patch
diff mbox series

diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index 1596a25a3a..0aef3128f2 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -14,6 +14,7 @@ 
 #include <sstream>
 
 #include <libcamera/control_ids.h>
+#include <libcamera/metadata_list_plan.h>
 #include <libcamera/property_ids.h>
 
 #include "../common/event_loop.h"
@@ -228,6 +229,20 @@  void CameraSession::listControls() const
 			std::cout << std::endl;
 		}
 	}
+
+	for (const auto &[id, info] : camera_->metadata()) {
+		const auto *cid = controls::controls.at(id);
+
+		std::cout << "Metadata: [  out] " << cid->vendor() << "::" << cid->name()
+			  << " type:" << info.type
+			  << " size:" << info.size
+			  << " alignment:" << info.alignment;
+
+		if (info.isArray)
+			std::cout << " count:" << info.numElements;
+
+		std::cout << std::endl;
+	}
 }
 
 void CameraSession::listProperties() const