[libcamera-devel,v1,11/23] gst: libcamerapad: Add a method to access the role

Message ID 20200129033210.278800-12-nicolas@ndufresne.ca
State Superseded
Headers show
Series
  • GStreamer Element for libcamera
Related show

Commit Message

Nicolas Dufresne Jan. 29, 2020, 3:31 a.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 src/gstreamer/gstlibcamerapad.cpp | 8 ++++++++
 src/gstreamer/gstlibcamerapad.h   | 2 ++
 2 files changed, 10 insertions(+)

Comments

Laurent Pinchart Feb. 11, 2020, 7:52 p.m. UTC | #1
Hi Nicolas,

Thank you for the patch.

On Tue, Jan 28, 2020 at 10:31:58PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Maybe a commit message ? (This comments applies to the other patches
too, I won't repeat it).

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.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 c6c22e4..b18584c 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);
> +	GST_OBJECT_LOCKER(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__ */

Patch

diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp
index c6c22e4..b18584c 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);
+	GST_OBJECT_LOCKER(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__ */