[libcamera-devel] Apply review suggestions
diff mbox series

Message ID 20230602133805.198862-1-web@cedricnugteren.nl
State Changes Requested
Headers show
Series
  • [libcamera-devel] Apply review suggestions
Related show

Commit Message

Cedric Nugteren June 2, 2023, 1:38 p.m. UTC
This addresses the comments from Nicolas. I did not change the default behaviour,
I'll wait with that until you have settled on what to do.

Signed-off-by: Cedric Nugteren <web@cedricnugteren.nl>
---
 src/gstreamer/gstlibcameraprovider.cpp | 15 +++++++--------
 src/gstreamer/gstlibcamerasrc.cpp      | 14 +++++++-------
 2 files changed, 14 insertions(+), 15 deletions(-)

Comments

Nicolas Dufresne June 2, 2023, 3:46 p.m. UTC | #1
Hi,

Le vendredi 02 juin 2023 à 15:38 +0200, Cedric Nugteren via libcamera-devel a
écrit :
> This addresses the comments from Nicolas. I did not change the default behaviour,
> I'll wait with that until you have settled on what to do.
> 
I'm pretty sure you had somewhat correct commit message before.

> 
> Signed-off-by: Cedric Nugteren <web@cedricnugteren.nl>
> ---

For your interest, this section is good place to add free form comment as it
won't be part of the commit message. For update, use git format-patch -v N for
the versioning.

regards,
Nicolas

>  src/gstreamer/gstlibcameraprovider.cpp | 15 +++++++--------
>  src/gstreamer/gstlibcamerasrc.cpp      | 14 +++++++-------
>  2 files changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp
> index 86fa2542..579cb8c0 100644
> --- a/src/gstreamer/gstlibcameraprovider.cpp
> +++ b/src/gstreamer/gstlibcameraprovider.cpp
> @@ -41,7 +41,7 @@ G_DECLARE_FINAL_TYPE(GstLibcameraDevice, gst_libcamera_device,
>  struct _GstLibcameraDevice {
>  	GstDevice parent;
>  	gchar *name;
> -	gboolean enable_auto_focus = false;
> +	bool enable_auto_focus = false;
>  };
>  
>  G_DEFINE_TYPE(GstLibcameraDevice, gst_libcamera_device, GST_TYPE_DEVICE)
> @@ -71,7 +71,6 @@ gst_libcamera_device_reconfigure_element(GstDevice *device,
>  		return FALSE;
>  
>  	g_object_set(element, "camera-name", GST_LIBCAMERA_DEVICE(device)->name, nullptr);
> -	g_object_set(element, "enable-auto-focus", GST_LIBCAMERA_DEVICE(device)->enable_auto_focus, nullptr);
>  
>  	return TRUE;
>  }
> @@ -128,12 +127,12 @@ gst_libcamera_device_class_init(GstLibcameraDeviceClass *klass)
>  						(GParamFlags)(G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE |
>  							      G_PARAM_CONSTRUCT_ONLY));
>  	g_object_class_install_property(object_class, PROP_DEVICE_NAME, pspec);
> -	GParamSpec *spec2 = g_param_spec_boolean("enable-auto-focus",
> -	                        "Enable auto-focus",
> -	                        "Enable auto-focus if set to true, "
> -	                        "disable it if set to false",
> -	                         FALSE, G_PARAM_WRITABLE);
> -	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec2);
> +	pspec = g_param_spec_boolean("enable-auto-focus",
> +	                             "Enable auto-focus",
> +	                             "Enable auto-focus if set to true, "
> +	                             "disable it if set to false",
> +	                              FALSE, G_PARAM_WRITABLE);
> +	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, pspec);
>  }
>  
>  static GstDevice *
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index 672ea38a..b2d8456b 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -146,7 +146,7 @@ struct _GstLibcameraSrc {
>  	GstTask *task;
>  
>  	gchar *camera_name;
> -	gboolean enable_auto_focus = false;
> +	bool enable_auto_focus = false;
>  
>  	GstLibcameraSrcState *state;
>  	GstLibcameraAllocator *allocator;
> @@ -864,11 +864,11 @@ gst_libcamera_src_class_init(GstLibcameraSrcClass *klass)
>  							     | G_PARAM_READWRITE
>  							     | G_PARAM_STATIC_STRINGS));
>  	g_object_class_install_property(object_class, PROP_CAMERA_NAME, spec);
> -	GParamSpec *spec2 = g_param_spec_boolean("enable-auto-focus",
> -	                        "Enable auto-focus",
> -	                        "Enable auto-focus if set to true, "
> -	                        "disable it if set to false",
> -	                         FALSE, G_PARAM_WRITABLE);
> -	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec2);
> +	spec = g_param_spec_boolean("enable-auto-focus",
> +	                            "Enable auto-focus",
> +	                            "Enable auto-focus if set to true, "
> +	                            "disable it if set to false",
> +	                             FALSE, G_PARAM_WRITABLE);
> +	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec);
>  
>  }

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp
index 86fa2542..579cb8c0 100644
--- a/src/gstreamer/gstlibcameraprovider.cpp
+++ b/src/gstreamer/gstlibcameraprovider.cpp
@@ -41,7 +41,7 @@  G_DECLARE_FINAL_TYPE(GstLibcameraDevice, gst_libcamera_device,
 struct _GstLibcameraDevice {
 	GstDevice parent;
 	gchar *name;
-	gboolean enable_auto_focus = false;
+	bool enable_auto_focus = false;
 };
 
 G_DEFINE_TYPE(GstLibcameraDevice, gst_libcamera_device, GST_TYPE_DEVICE)
@@ -71,7 +71,6 @@  gst_libcamera_device_reconfigure_element(GstDevice *device,
 		return FALSE;
 
 	g_object_set(element, "camera-name", GST_LIBCAMERA_DEVICE(device)->name, nullptr);
-	g_object_set(element, "enable-auto-focus", GST_LIBCAMERA_DEVICE(device)->enable_auto_focus, nullptr);
 
 	return TRUE;
 }
@@ -128,12 +127,12 @@  gst_libcamera_device_class_init(GstLibcameraDeviceClass *klass)
 						(GParamFlags)(G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE |
 							      G_PARAM_CONSTRUCT_ONLY));
 	g_object_class_install_property(object_class, PROP_DEVICE_NAME, pspec);
-	GParamSpec *spec2 = g_param_spec_boolean("enable-auto-focus",
-	                        "Enable auto-focus",
-	                        "Enable auto-focus if set to true, "
-	                        "disable it if set to false",
-	                         FALSE, G_PARAM_WRITABLE);
-	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec2);
+	pspec = g_param_spec_boolean("enable-auto-focus",
+	                             "Enable auto-focus",
+	                             "Enable auto-focus if set to true, "
+	                             "disable it if set to false",
+	                              FALSE, G_PARAM_WRITABLE);
+	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, pspec);
 }
 
 static GstDevice *
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 672ea38a..b2d8456b 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -146,7 +146,7 @@  struct _GstLibcameraSrc {
 	GstTask *task;
 
 	gchar *camera_name;
-	gboolean enable_auto_focus = false;
+	bool enable_auto_focus = false;
 
 	GstLibcameraSrcState *state;
 	GstLibcameraAllocator *allocator;
@@ -864,11 +864,11 @@  gst_libcamera_src_class_init(GstLibcameraSrcClass *klass)
 							     | G_PARAM_READWRITE
 							     | G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property(object_class, PROP_CAMERA_NAME, spec);
-	GParamSpec *spec2 = g_param_spec_boolean("enable-auto-focus",
-	                        "Enable auto-focus",
-	                        "Enable auto-focus if set to true, "
-	                        "disable it if set to false",
-	                         FALSE, G_PARAM_WRITABLE);
-	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec2);
+	spec = g_param_spec_boolean("enable-auto-focus",
+	                            "Enable auto-focus",
+	                            "Enable auto-focus if set to true, "
+	                            "disable it if set to false",
+	                             FALSE, G_PARAM_WRITABLE);
+	g_object_class_install_property(object_class, PROP_ENABLE_AUTO_FOCUS, spec);
 
 }