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

Message ID 20200227200407.490616-7-nicolas.dufresne@collabora.com
State Accepted
Headers show
Series
  • GStreamer Element for libcamera
Related show

Commit Message

Nicolas Dufresne Feb. 27, 2020, 8:03 p.m. UTC
This pad will always be present and will allow simple pipeline to be used to
stream from the camera.

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

Patch

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 085c489..fb403cf 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