[libcamera-devel] [PATCH v2 11/27] gst: libcamerapad: Add a method to access the role
Nicolas Dufresne
nicolas.dufresne at collabora.com
Thu Feb 27 21:03:51 CET 2020
Each pad can have a different roles. Users will have to request and configure
their pads roles before moving 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 | 2 ++
2 files changed, 10 insertions(+)
diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp
index 6212c3b..d4f5b15 100644
--- a/src/gstreamer/gstlibcamerapad.cpp
+++ b/src/gstreamer/gstlibcamerapad.cpp
@@ -99,3 +99,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..3dea0e7 100644
--- a/src/gstreamer/gstlibcamerapad.h
+++ b/src/gstreamer/gstlibcamerapad.h
@@ -7,6 +7,7 @@
*/
#include <gst/gst.h>
+#include <libcamera/stream.h>
#ifndef __GST_LIBCAMERA_PAD_H__
#define __GST_LIBCAMERA_PAD_H__
@@ -15,5 +16,6 @@
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