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

Message ID 20250721104622.1550908-13-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
When `--list-controls` is specified, print the set of supported metadata.
---
 src/apps/cam/camera_session.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Paul Elder Sept. 18, 2025, 8:50 a.m. UTC | #1
Hi Barnabás,

Thanks for the patch.

Quoting Barnabás Pőcze (2025-07-21 19:46:12)
> When `--list-controls` is specified, print the set of supported metadata.
> ---
>  src/apps/cam/camera_session.cpp | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
> index f63fcb228..91ac3f1bf 100644
> --- a/src/apps/cam/camera_session.cpp
> +++ b/src/apps/cam/camera_session.cpp
> @@ -228,6 +228,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:";

I'd prefer s/:"/: "/

> +
> +               if (info.isArray)
> +                       std::cout << info.numElements << "x";

I like the conciseness, but I worry for the ambiguity of if the number before
the x is the group number or if it's the number after (from the user's
perspective). I see it as a modifier and would want the multiplier after, for
example. Maybe a label as opposed to a multiplier (multiplicand?) would be
unambiguous.


Thanks,

Paul

> +
> +               std::cout << info.size << " alignment:" << info.alignment;
> +               std::cout << std::endl;
> +       }
>  }
>  
>  void CameraSession::listProperties() const
> -- 
> 2.50.1
>
Paul Elder Sept. 18, 2025, 8:54 a.m. UTC | #2
Quoting Paul Elder (2025-09-18 17:50:27)
> Hi Barnabás,
> 
> Thanks for the patch.
> 
> Quoting Barnabás Pőcze (2025-07-21 19:46:12)
> > When `--list-controls` is specified, print the set of supported metadata.
> > ---
> >  src/apps/cam/camera_session.cpp | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
> > index f63fcb228..91ac3f1bf 100644
> > --- a/src/apps/cam/camera_session.cpp
> > +++ b/src/apps/cam/camera_session.cpp
> > @@ -228,6 +228,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:";
> 
> I'd prefer s/:"/: "/
> 
> > +
> > +               if (info.isArray)
> > +                       std::cout << info.numElements << "x";
> 
> I like the conciseness, but I worry for the ambiguity of if the number before
> the x is the group number or if it's the number after (from the user's
> perspective). I see it as a modifier and would want the multiplier after, for
> example. Maybe a label as opposed to a multiplier (multiplicand?) would be
> unambiguous.

I just noticed the DNI, but I think this is a genuinely useful output.


Paul

> 
> > +
> > +               std::cout << info.size << " alignment:" << info.alignment;
> > +               std::cout << std::endl;
> > +       }
> >  }
> >  
> >  void CameraSession::listProperties() const
> > -- 
> > 2.50.1
> >

Patch
diff mbox series

diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index f63fcb228..91ac3f1bf 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -228,6 +228,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:";
+
+		if (info.isArray)
+			std::cout << info.numElements << "x";
+
+		std::cout << info.size << " alignment:" << info.alignment;
+		std::cout << std::endl;
+	}
 }
 
 void CameraSession::listProperties() const