[v2,4/7] gstreamer: Rename variable in gst_libcamera_create_video_pool()
diff mbox series

Message ID 20250604130741.9228-5-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • gstreamer: Miscellaneous cleanups + two fixes
Related show

Commit Message

Laurent Pinchart June 4, 2025, 1:07 p.m. UTC
Now that the code is isolated in a function, the video_pool variable in
gst_libcamera_create_video_pool() can be renamed to pool without
clashing with another local variable. Do so to reduce line length.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/gstreamer/gstlibcamerasrc.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Nicolas Dufresne June 4, 2025, 5:12 p.m. UTC | #1
Le mercredi 04 juin 2025 à 16:07 +0300, Laurent Pinchart a écrit :
> Now that the code is isolated in a function, the video_pool variable in
> gst_libcamera_create_video_pool() can be renamed to pool without
> clashing with another local variable. Do so to reduce line length.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index b907a5759740..9c0ee491ab63 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -543,7 +543,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
>  {
>  	GstQuery *query = NULL;
>  	const gboolean need_pool = true;
> -	GstBufferPool *video_pool = NULL;
> +	GstBufferPool *pool = NULL;
>  
>  	/*
>  	 * Get the peer allocation hints to check if it supports the meta API.
> @@ -564,22 +564,22 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
>  	 * create a new pool.
>  	 */
>  	if (gst_query_get_n_allocation_pools(query) > 0)
> -		gst_query_parse_nth_allocation_pool(query, 0, &video_pool, NULL, NULL, NULL);
> +		gst_query_parse_nth_allocation_pool(query, 0, &pool, NULL, NULL, NULL);
>  
> -	if (!video_pool) {
> +	if (!pool) {
>  		GstStructure *config;
>  		guint min_buffers = 3;
>  
> -		video_pool = gst_video_buffer_pool_new();
> -		config = gst_buffer_pool_get_config(video_pool);
> +		pool = gst_video_buffer_pool_new();
> +		config = gst_buffer_pool_get_config(pool);
>  		gst_buffer_pool_config_set_params(config, caps, info->size, min_buffers, 0);
>  
>  		GST_DEBUG_OBJECT(self, "Own pool config is %" GST_PTR_FORMAT, config);
>  
> -		gst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(video_pool), config);
> +		gst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(pool), config);
>  	}
>  
> -	if (!gst_buffer_pool_set_active(video_pool, true)) {
> +	if (!gst_buffer_pool_set_active(pool, true)) {
>  		gst_caps_unref(caps);
>  		GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,
>  				  ("Failed to active buffer pool"),
> @@ -588,7 +588,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
>  	}
>  
>  	gst_query_unref(query);
> -	return { video_pool, 0 };
> +	return { pool, 0 };
>  }
>  
>  /* Must be called with stream_lock held. */

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index b907a5759740..9c0ee491ab63 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -543,7 +543,7 @@  gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
 {
 	GstQuery *query = NULL;
 	const gboolean need_pool = true;
-	GstBufferPool *video_pool = NULL;
+	GstBufferPool *pool = NULL;
 
 	/*
 	 * Get the peer allocation hints to check if it supports the meta API.
@@ -564,22 +564,22 @@  gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
 	 * create a new pool.
 	 */
 	if (gst_query_get_n_allocation_pools(query) > 0)
-		gst_query_parse_nth_allocation_pool(query, 0, &video_pool, NULL, NULL, NULL);
+		gst_query_parse_nth_allocation_pool(query, 0, &pool, NULL, NULL, NULL);
 
-	if (!video_pool) {
+	if (!pool) {
 		GstStructure *config;
 		guint min_buffers = 3;
 
-		video_pool = gst_video_buffer_pool_new();
-		config = gst_buffer_pool_get_config(video_pool);
+		pool = gst_video_buffer_pool_new();
+		config = gst_buffer_pool_get_config(pool);
 		gst_buffer_pool_config_set_params(config, caps, info->size, min_buffers, 0);
 
 		GST_DEBUG_OBJECT(self, "Own pool config is %" GST_PTR_FORMAT, config);
 
-		gst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(video_pool), config);
+		gst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(pool), config);
 	}
 
-	if (!gst_buffer_pool_set_active(video_pool, true)) {
+	if (!gst_buffer_pool_set_active(pool, true)) {
 		gst_caps_unref(caps);
 		GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,
 				  ("Failed to active buffer pool"),
@@ -588,7 +588,7 @@  gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
 	}
 
 	gst_query_unref(query);
-	return { video_pool, 0 };
+	return { pool, 0 };
 }
 
 /* Must be called with stream_lock held. */