[libcamera-devel,v1,06/23] gst: libcamerasrc: Allocate and add static pad

Message ID 20200129033210.278800-7-nicolas@ndufresne.ca
State Superseded
Headers show
Series
  • GStreamer Element for libcamera
Related show

Commit Message

Nicolas Dufresne Jan. 29, 2020, 3:31 a.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 src/gstreamer/gstlibcamerasrc.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart Feb. 11, 2020, 7:24 p.m. UTC | #1
Hi Nicolas,

Thank you for the patch.

On Tue, Jan 28, 2020 at 10:31:53PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

A commit message could be nice. Apart from that,

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

> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index a8bcede..50bba39 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -11,6 +11,7 @@
>  
>  struct _GstLibcameraSrc {
>  	GstElement parent;
> +	GstPad *srcpad;
>  };
>  
>  G_DEFINE_TYPE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT);
> @@ -30,6 +31,10 @@ GstStaticPadTemplate request_src_template = {
>  static void
>  gst_libcamera_src_init(GstLibcameraSrc *self)
>  {
> +	GstPadTemplate *templ = gst_element_get_pad_template(GST_ELEMENT(self), "src");
> +
> +	self->srcpad = gst_pad_new_from_template(templ, "src");
> +	gst_element_add_pad(GST_ELEMENT(self), self->srcpad);
>  }
>  
>  static void

Patch

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index a8bcede..50bba39 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -11,6 +11,7 @@ 
 
 struct _GstLibcameraSrc {
 	GstElement parent;
+	GstPad *srcpad;
 };
 
 G_DEFINE_TYPE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT);
@@ -30,6 +31,10 @@  GstStaticPadTemplate request_src_template = {
 static void
 gst_libcamera_src_init(GstLibcameraSrc *self)
 {
+	GstPadTemplate *templ = gst_element_get_pad_template(GST_ELEMENT(self), "src");
+
+	self->srcpad = gst_pad_new_from_template(templ, "src");
+	gst_element_add_pad(GST_ELEMENT(self), self->srcpad);
 }
 
 static void