[libcamera-devel] [PATCH v3 11/27] gst: libcamerapad: Add a method to access the role
Nicolas Dufresne
nicolas at ndufresne.ca
Fri Mar 6 21:26:21 CET 2020
From: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Each pad can have a different roles. Users will have to request and configure
their pads role before moving to a higher state.
Signed-off-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/gstreamer/gstlibcamerapad.cpp | 8 ++++++++
src/gstreamer/gstlibcamerapad.h | 10 ++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp
index ca5c820..ed24557 100644
--- a/src/gstreamer/gstlibcamerapad.cpp
+++ b/src/gstreamer/gstlibcamerapad.cpp
@@ -100,3 +100,11 @@ gst_libcamera_pad_class_init(GstLibcameraPadClass *klass)
| G_PARAM_STATIC_STRINGS));
g_object_class_install_property(object_class, PROP_STREAM_ROLE, spec);
}
+
+StreamRole
+gst_libcamera_pad_get_role(GstPad *pad)
+{
+ auto *self = GST_LIBCAMERA_PAD(pad);
+ GLibLocker lock(GST_OBJECT(self));
+ return self->role;
+}
diff --git a/src/gstreamer/gstlibcamerapad.h b/src/gstreamer/gstlibcamerapad.h
index 2e745f1..f0a5e32 100644
--- a/src/gstreamer/gstlibcamerapad.h
+++ b/src/gstreamer/gstlibcamerapad.h
@@ -6,14 +6,16 @@
* gstlibcamerapad.h - GStreamer Capture Element
*/
-#include <gst/gst.h>
-
#ifndef __GST_LIBCAMERA_PAD_H__
#define __GST_LIBCAMERA_PAD_H__
+#include <gst/gst.h>
+
+#include <libcamera/stream.h>
+
#define GST_TYPE_LIBCAMERA_PAD gst_libcamera_pad_get_type()
-G_DECLARE_FINAL_TYPE(GstLibcameraPad, gst_libcamera_pad,
- GST_LIBCAMERA, PAD, GstPad)
+G_DECLARE_FINAL_TYPE(GstLibcameraPad, gst_libcamera_pad, GST_LIBCAMERA, PAD, GstPad)
+libcamera::StreamRole gst_libcamera_pad_get_role(GstPad *pad);
#endif /* __GST_LIBCAMERA_PAD_H__ */
--
2.24.1
More information about the libcamera-devel
mailing list