[PATCH 0/3] gstreamer: Generate controls from control_ids_*.yaml files

Jaslo Ziska jaslo at ziska.de
Tue Aug 6 16:54:13 CEST 2024


Jaslo Ziska <jaslo at ziska.de> writes:
> Hi everyone,
>
> in this patchset I implemented libcamerasrc properties which are 
> generated from
> the control_ids_*.yaml files.
>
> The first commit removes the auto-focus-mode property which was 
> already
> implemented (it is added again in the next commit).
> The second commit adds a Python script to generate C++ code 
> capable of
> interacting with the controls and adds the controls to 
> libcamerasrc.
> The third commit is just a small fix for the missing closing 
> "greater than"
> symbol in the author string I noticed.
>
> The gstlibcamera-controls.h file is taken from Nicolas' branch 
> with the change
> that I removed the enum with the control names from the class. 
> Instead the enum
> variants from libcamera::controls:: are now used directly.
> The structure of the gstlibcamera-controls.cpp.in file is also 
> taken from
> Nicolas. The only change is that its content now gets generated 
> by
> gen-gst-controls.py
I just noticed that it is not yet implemented to get the control 
values returned by libcamera::Request::metadata() (at the moment 
you can only read back the controls which were already set). I 
will add that in the next revision.

>
> The boilerplate of gen-gst-controls.py is mostly copied from 
> gen-controls.py.
> This is also where I have some questions:
>
> The definition of the ControlEnum and Control Python classes 
> (and some helper
> functions) is now duplicate code. Should this be handled 
> differently somehow to
> avoid the code duplication?
>
> I haven't added a copyright to gen-gst-controls.py yet as I am 
> not sure because
> I copied much of it from gen-controls.py.
>
> Another small issue is that I haven't implemented the Rectangle 
> type yet and
> thus the controls using it won't show up. The reason for this is 
> that there
> is the AfWindows control which is an array of Rectangles. As the 
> gstreamer
> properties can only be glib types I wasn't sure what to do here: 
> For a
> single Rectangle you could use an array and make the entries (x, 
> y, w, h)
> but what about an array of Rectangles? Should it use an array 
> with 4 * N
> entries, so (x, y, w, h) for each value?
>
> At the moment the gstreamer properties all have zero (or the 
> first enum value)
> as a default and the minimum and maximum numeric values as 
> minimum and maximum
> values for numbers. Also all controls are defined as readable 
> and writeable.
> Because of this (maybe as a discussion) I have a small wish list 
> of things I'd
> like to see added in the control_ids_*.yaml files which would 
> greatly improve
> the gstreamer properties:
> For enum and bool controls: the default value if available.
> For numeric controls: the minimum, maximum and default value.
> And for all controls: whether it is read-only, write-only or 
> read-write.
>
> Best regards,
>
> Jaslo
>
> Jaslo Ziska (3):
>   gstreamer: Remove auto-focus-mode property
>   gstreamer: Generate controls from control_ids_*.yaml files
>   gstreamer: Fix missing "greater than" symbol in author string
>
>  src/gstreamer/gstlibcamera-controls.cpp.in |  46 +++
>  src/gstreamer/gstlibcamera-controls.h      |  36 ++
>  src/gstreamer/gstlibcamerasrc.cpp          |  47 +--
>  src/gstreamer/meson.build                  |  14 +
>  utils/gen-gst-controls.py                  | 398 
>  +++++++++++++++++++++
>  utils/meson.build                          |   1 +
>  6 files changed, 510 insertions(+), 32 deletions(-)
>  create mode 100644 src/gstreamer/gstlibcamera-controls.cpp.in
>  create mode 100644 src/gstreamer/gstlibcamera-controls.h
>  create mode 100755 utils/gen-gst-controls.py


More information about the libcamera-devel mailing list