libcamera/utils/codegen
Jaslo Ziska 27cece6653 gstreamer: Generate controls from control_ids_*.yaml files
This commit implements gstreamer controls for the libcamera element by
generating the controls from the control_ids_*.yaml files using a new
gen-gst-controls.py script. The appropriate meson files are also changed
to automatically run the script when building.

The gen-gst-controls.py script works similar to the gen-controls.py
script by parsing the control_ids_*.yaml files and generating C++ code
for each exposed control.
For the controls to be used as gstreamer properties the type for each
control needs to be translated to the appropriate glib type and a
GEnumValue is generated for each enum control. Then a
g_object_install_property(), _get_property() and _set_property()
function is generated for each control.
The vendor controls get prefixed with "$vendor-" in the final gstreamer
property name.

The C++ code generated by the gen-gst-controls.py script is written into
the template gstlibcamerasrc-controls.cpp.in file. The matching
gstlibcamerasrc-controls.h header defines the GstCameraControls class
which handles the installation of the gstreamer properties as well as
keeping track of the control values and setting and getting the
controls. The content of these functions is generated in the Python
script.

Finally the libcamerasrc element itself is edited to make use of the new
GstCameraControls class. The way this works is by defining a PROP_LAST
enum variant which is passed to the installProperties() function so the
properties are defined with the appropriate offset. When getting or
setting a property PROP_LAST is subtracted from the requested property
to translate the control back into a libcamera::controls:: enum
variant.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 16:28:09 +00:00
..
ipc libcamera: ipa: Drop unneded includes from ipa_interface.h 2024-09-03 15:25:55 +03:00
controls.py gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00
gen-controls.py utils: codegen: gen-controls.py: Move helper classes to separate file 2024-08-16 00:28:32 +03:00
gen-formats.py meson: Move all code generation scripts to utils/codegen/ 2024-08-15 23:59:08 +03:00
gen-gst-controls.py gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00
gen-header.sh utils: codegen: gen-header.sh: Generate libcamera.h based on meson.build 2024-08-16 00:00:28 +03:00
gen-ipa-pub-key.py meson: Move all code generation scripts to utils/codegen/ 2024-08-15 23:59:08 +03:00
gen-tp-header.py libcamera: tracepoints: Fix copyright year for reproducible builds 2024-10-18 23:39:11 +03:00
meson.build gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00