summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamerasrc.cpp
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2020-01-14 13:37:57 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-07 01:57:45 +0200
commit71a28f959313c573097fa23d5894b0104f092352 (patch)
tree9f63836911be6603d3958587da31dd185508a247 /src/gstreamer/gstlibcamerasrc.cpp
parent7e82d3c2a1ecca4f2041a1a095a0725fe9d172c0 (diff)
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 <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/gstreamer/gstlibcamerasrc.cpp')
-rw-r--r--src/gstreamer/gstlibcamerasrc.cpp20
1 files changed, 20 insertions, 0 deletions
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 <nicolas.dufresne@collabora.com");
+ gst_element_class_add_static_pad_template_with_gtype(element_class,
+ &src_template,
+ GST_TYPE_LIBCAMERA_PAD);
+ gst_element_class_add_static_pad_template_with_gtype(element_class,
+ &request_src_template,
+ GST_TYPE_LIBCAMERA_PAD);
}