From 71a28f959313c573097fa23d5894b0104f092352 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 14 Jan 2020 13:37:57 -0500 Subject: gst: Add pads to the source This simply adds the boiler plate for pads on the source element. The design is that we have one pad, called "src", that will always be present, and then more pads can be requested prior in READY or less state. Initially pads have one property "stream-role" that let you decide which role this pad will have. Signed-off-by: Nicolas Dufresne Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/gstreamer/gstlibcamerasrc.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gstreamer/gstlibcamerasrc.cpp') diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 38075032..79d4196c 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -8,12 +8,26 @@ #include "gstlibcamerasrc.h" +#include "gstlibcamerapad.h" + struct _GstLibcameraSrc { GstElement parent; }; G_DEFINE_TYPE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT); +#define TEMPLATE_CAPS GST_STATIC_CAPS("video/x-raw; image/jpeg") + +/* For the simple case, we have a src pad that is always present. */ +GstStaticPadTemplate src_template = { + "src", GST_PAD_SRC, GST_PAD_ALWAYS, TEMPLATE_CAPS +}; + +/* More pads can be requested in state < PAUSED */ +GstStaticPadTemplate request_src_template = { + "src_%s", GST_PAD_SRC, GST_PAD_REQUEST, TEMPLATE_CAPS +}; + static void gst_libcamera_src_init(GstLibcameraSrc *self) { @@ -28,4 +42,10 @@ gst_libcamera_src_class_init(GstLibcameraSrcClass *klass) "libcamera Source", "Source/Video", "Linux Camera source using libcamera", "Nicolas Dufresne