[libcamera-devel,v1,16/23] gst: libcamerasrc: Push segment event

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

Commit Message

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

Now that we have stream-start and caps, we can now push a segment event to
announce what time will our buffer correlate to. For live sources this is just
an open segment in time format.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 src/gstreamer/gstlibcamerasrc.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

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

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

On Tue, Jan 28, 2020 at 10:32:03PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Now that we have stream-start and caps, we can now push a segment event to
> announce what time will our buffer correlate to. For live sources this is just
> an open segment in time format.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

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

> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index 7b478fa..0df71c6 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -191,6 +191,11 @@ gst_libcamera_src_task_enter(GstTask *task, GThread *thread, gpointer user_data)
>  			flow_ret = GST_FLOW_NOT_NEGOTIATED;
>  			break;
>  		}
> +
> +		/* Send an open segment event with time format */
> +		GstSegment segment;
> +		gst_segment_init(&segment, GST_FORMAT_TIME);
> +		gst_pad_push_event(srcpad, gst_event_new_segment(&segment));
>  	}
>  
>  	ret = state->cam->configure(state->config.get());

Patch

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 7b478fa..0df71c6 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -191,6 +191,11 @@  gst_libcamera_src_task_enter(GstTask *task, GThread *thread, gpointer user_data)
 			flow_ret = GST_FLOW_NOT_NEGOTIATED;
 			break;
 		}
+
+		/* Send an open segment event with time format */
+		GstSegment segment;
+		gst_segment_init(&segment, GST_FORMAT_TIME);
+		gst_pad_push_event(srcpad, gst_event_new_segment(&segment));
 	}
 
 	ret = state->cam->configure(state->config.get());