[2/3] gstreamer: Add support for read- and write-only controls
diff mbox series

Message ID 20250422142903.14742-3-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
Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
---
 src/gstreamer/gstlibcamera-controls.cpp.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Nicolas Dufresne April 22, 2025, 3:50 p.m. UTC | #1
Le mardi 22 avril 2025 à 16:25 +0200, Jaslo Ziska a écrit :
> Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
> ---
>  src/gstreamer/gstlibcamera-controls.cpp.in | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in
> index 28604a3c..b38038ca 100644
> --- a/src/gstreamer/gstlibcamera-controls.cpp.in
> +++ b/src/gstreamer/gstlibcamera-controls.cpp.in
> @@ -126,7 +126,13 @@ g_param_spec_{{ ctrl.gtype }}(
>  {%- endif %}
>  	(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
>  		       GST_PARAM_CONTROLLABLE |
> +{%- if ctrl.direction == 'ControlId::Direction::In' %}
> +		       G_PARAM_WRITABLE |
> +{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
> +		       G_PARAM_READABLE |
> +{%- else %}
>  		       G_PARAM_READWRITE |
> +{%- endif %}
>  		       G_PARAM_STATIC_STRINGS)
>  )
>  {%- endset %}
> @@ -142,7 +148,13 @@ g_param_spec_{{ ctrl.gtype }}(
>  			{{ spec|indent_str('\t\t\t') }},
>  			(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
>  				       GST_PARAM_CONTROLLABLE |
> +{%- if ctrl.direction == 'ControlId::Direction::In' %}
> +				       G_PARAM_WRITABLE |
> +{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
> +				       G_PARAM_READABLE |
> +{%- else %}
>  				       G_PARAM_READWRITE |
> +{%- endif %}
>  				       G_PARAM_STATIC_STRINGS)
>  		)
>  {%- else %}

Looks good to me, just wondering though why is that duplicated ?

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Jaslo Ziska April 23, 2025, 8:35 a.m. UTC | #2
Hi Nicolas,

thanks for the review.

Nicolas Dufresne <nicolas@ndufresne.ca> writes:
> Le mardi 22 avril 2025 à 16:25 +0200, Jaslo Ziska a écrit :
>> Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
>> ---
>>  src/gstreamer/gstlibcamera-controls.cpp.in | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in 
>> b/src/gstreamer/gstlibcamera-controls.cpp.in
>> index 28604a3c..b38038ca 100644
>> --- a/src/gstreamer/gstlibcamera-controls.cpp.in
>> +++ b/src/gstreamer/gstlibcamera-controls.cpp.in
>> @@ -126,7 +126,13 @@ g_param_spec_{{ ctrl.gtype }}(
>>  {%- endif %}
>>  	(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
>>  		       GST_PARAM_CONTROLLABLE |
>> +{%- if ctrl.direction == 'ControlId::Direction::In' %}
>> +		       G_PARAM_WRITABLE |
>> +{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
>> +		       G_PARAM_READABLE |
>> +{%- else %}
>>  		       G_PARAM_READWRITE |
>> +{%- endif %}
>>  		       G_PARAM_STATIC_STRINGS)
>>  )
>>  {%- endset %}
>> @@ -142,7 +148,13 @@ g_param_spec_{{ ctrl.gtype }}(
>>  			{{ spec|indent_str('\t\t\t') }},
>>  			(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
>>  				       GST_PARAM_CONTROLLABLE |
>> +{%- if ctrl.direction == 'ControlId::Direction::In' %}
>> +				       G_PARAM_WRITABLE |
>> +{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
>> +				       G_PARAM_READABLE |
>> +{%- else %}
>>  				       G_PARAM_READWRITE |
>> +{%- endif %}
>>  				       G_PARAM_STATIC_STRINGS)
>>  		)
>>  {%- else %}
>
> Looks good to me, just wondering though why is that duplicated ?

That's because of array controls. The first time (in the {% set 
spec %}) is for normal enum, int, etc. controls and the second 
time these specs might be included in the array spec. So it's set 
for both because each might end up as the "top level" spec 
depending on whether the control is an array control or not.

>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in
index 28604a3c..b38038ca 100644
--- a/src/gstreamer/gstlibcamera-controls.cpp.in
+++ b/src/gstreamer/gstlibcamera-controls.cpp.in
@@ -126,7 +126,13 @@  g_param_spec_{{ ctrl.gtype }}(
 {%- endif %}
 	(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
 		       GST_PARAM_CONTROLLABLE |
+{%- if ctrl.direction == 'ControlId::Direction::In' %}
+		       G_PARAM_WRITABLE |
+{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
+		       G_PARAM_READABLE |
+{%- else %}
 		       G_PARAM_READWRITE |
+{%- endif %}
 		       G_PARAM_STATIC_STRINGS)
 )
 {%- endset %}
@@ -142,7 +148,13 @@  g_param_spec_{{ ctrl.gtype }}(
 			{{ spec|indent_str('\t\t\t') }},
 			(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
 				       GST_PARAM_CONTROLLABLE |
+{%- if ctrl.direction == 'ControlId::Direction::In' %}
+				       G_PARAM_WRITABLE |
+{%- elif ctrl.direction == 'ControlId::Direction::Out' %}
+				       G_PARAM_READABLE |
+{%- else %}
 				       G_PARAM_READWRITE |
+{%- endif %}
 				       G_PARAM_STATIC_STRINGS)
 		)
 {%- else %}