[libcamera-devel] [PATCH v1 12/23] gst: libcamerasrc: Store the srcpad in a vector

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Feb 12 00:15:00 CET 2020


Hi Nicolas,

Thank you for the patch.

On Tue, Jan 28, 2020 at 10:31:59PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> 
> This will allow implementing generic algorithm even if we cannot
> request pads yet.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index 4d0c7d0..be32a11 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -22,6 +22,7 @@ GST_DEBUG_CATEGORY_STATIC(source_debug);
>  struct GstLibcameraSrcState {
>  	std::shared_ptr<CameraManager> cm;
>  	std::shared_ptr<Camera> cam;
> +	std::vector<GstPad *> srcpads;

Could you include <vector>, and generally, any C++ headers that is
required by std:: symbols that you use ? They're currently included
indirectly, but to avoid future compilation issues if headers get
refactored, including the dependencies explicitly is best.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  };
>  
>  struct _GstLibcameraSrc {
> @@ -29,7 +30,6 @@ struct _GstLibcameraSrc {
>  
>  	GRecMutex stream_lock;
>  	GstTask *task;
> -	GstPad *srcpad;
>  
>  	gchar *camera_name;
>  
> @@ -258,8 +258,8 @@ gst_libcamera_src_init(GstLibcameraSrc *self)
>  	gst_task_set_leave_callback(self->task, gst_libcamera_src_task_leave, self, nullptr);
>  	gst_task_set_lock(self->task, &self->stream_lock);
>  
> -	self->srcpad = gst_pad_new_from_template(templ, "src");
> -	gst_element_add_pad(GST_ELEMENT(self), self->srcpad);
> +	state->srcpads.push_back(gst_pad_new_from_template(templ, "src"));
> +	gst_element_add_pad(GST_ELEMENT(self), state->srcpads[0]);
>  	self->state = state;
>  }
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list