[1/3] gstreamer: Add GST_PARAM_CONDITIONALLY_AVAILABLE flag to properties
diff mbox series

Message ID 20250422142903.14742-2-jaslo@ziska.de
State New
Headers show
Series
  • gstreamer: Add support for read- and write-only controls
Related show

Commit Message

Jaslo Ziska April 22, 2025, 2:25 p.m. UTC
Add the GST_PARAM_CONDITIONALLY_AVAILABLE flag to the camera properties
to mark the property as conditionally available, i.e. it might only be
present depending on the camera / pipeline.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
---
 src/gstreamer/gstlibcamera-controls.cpp.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Nicolas Dufresne April 22, 2025, 3:48 p.m. UTC | #1
Hi,

Le mardi 22 avril 2025 à 16:25 +0200, Jaslo Ziska a écrit :
> Add the GST_PARAM_CONDITIONALLY_AVAILABLE flag to the camera properties
> to mark the property as conditionally available, i.e. it might only be
> present depending on the camera / pipeline.

This is a slight miss-match. GST_PARAM_CONDITIONALLY_AVAILABLE was only
indented to endup in generated documentation, since when the property
is not available its actually not installed at all. The ideal was to
tell developers to never systematically set these properties.

Since we don't have GStreamer elements per-camera, and that properties
cannot be included / removed per instance, doing the GOBject
introspection to figure-out if the property is installed will always
succeed.

In that sense, this change does not have a lot of value to me.

Nicolas

> 
> Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
> ---
>  src/gstreamer/gstlibcamera-controls.cpp.in | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in
> index 89c530da..28604a3c 100644
> --- a/src/gstreamer/gstlibcamera-controls.cpp.in
> +++ b/src/gstreamer/gstlibcamera-controls.cpp.in
> @@ -124,7 +124,9 @@ g_param_spec_{{ ctrl.gtype }}(
>  {%- elif ctrl.gtype in ['float', 'int', 'int64', 'uchar'] %}
>  	{{ ctrl.min }}, {{ ctrl.max }}, {{ ctrl.default }},
>  {%- endif %}
> -	(GParamFlags) (GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE |
> +	(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
> +		       GST_PARAM_CONTROLLABLE |
> +		       G_PARAM_READWRITE |
>  		       G_PARAM_STATIC_STRINGS)
>  )
>  {%- endset %}
> @@ -138,7 +140,8 @@ g_param_spec_{{ ctrl.gtype }}(
>  			"{{ ctrl.name }}",
>  			{{ ctrl.description|format_description|indent_str('\t\t\t') }},
>  			{{ spec|indent_str('\t\t\t') }},
> -			(GParamFlags) (GST_PARAM_CONTROLLABLE |
> +			(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
> +				       GST_PARAM_CONTROLLABLE |
>  				       G_PARAM_READWRITE |
>  				       G_PARAM_STATIC_STRINGS)
>  		)

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in
index 89c530da..28604a3c 100644
--- a/src/gstreamer/gstlibcamera-controls.cpp.in
+++ b/src/gstreamer/gstlibcamera-controls.cpp.in
@@ -124,7 +124,9 @@  g_param_spec_{{ ctrl.gtype }}(
 {%- elif ctrl.gtype in ['float', 'int', 'int64', 'uchar'] %}
 	{{ ctrl.min }}, {{ ctrl.max }}, {{ ctrl.default }},
 {%- endif %}
-	(GParamFlags) (GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE |
+	(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
+		       GST_PARAM_CONTROLLABLE |
+		       G_PARAM_READWRITE |
 		       G_PARAM_STATIC_STRINGS)
 )
 {%- endset %}
@@ -138,7 +140,8 @@  g_param_spec_{{ ctrl.gtype }}(
 			"{{ ctrl.name }}",
 			{{ ctrl.description|format_description|indent_str('\t\t\t') }},
 			{{ spec|indent_str('\t\t\t') }},
-			(GParamFlags) (GST_PARAM_CONTROLLABLE |
+			(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
+				       GST_PARAM_CONTROLLABLE |
 				       G_PARAM_READWRITE |
 				       G_PARAM_STATIC_STRINGS)
 		)