qmlglsrc: Stop when basesrc calls unlock()

Instead of stopping capture when the state changes,
handle other cases of basesrc stopping capture by - such
as handling an EOS event - by implementing an unlock()
method

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3612>
This commit is contained in:
Jan Schmidt 2022-12-21 02:31:05 +11:00 committed by GStreamer Marge Bot
parent 7050b00c10
commit 2b09f7a006

View file

@ -54,6 +54,7 @@ static GstStateChangeReturn gst_qt_src_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static gboolean gst_qt_src_start (GstBaseSrc * basesrc); static gboolean gst_qt_src_start (GstBaseSrc * basesrc);
static gboolean gst_qt_src_stop (GstBaseSrc * basesrc); static gboolean gst_qt_src_stop (GstBaseSrc * basesrc);
static gboolean gst_qt_src_unlock(GstBaseSrc *basesrc);
static GstStaticPadTemplate gst_qt_src_template = static GstStaticPadTemplate gst_qt_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
@ -123,6 +124,7 @@ gst_qt_src_class_init (GstQtSrcClass * klass)
gstbasesrc_class->query = gst_qt_src_query; gstbasesrc_class->query = gst_qt_src_query;
gstbasesrc_class->start = gst_qt_src_start; gstbasesrc_class->start = gst_qt_src_start;
gstbasesrc_class->stop = gst_qt_src_stop; gstbasesrc_class->stop = gst_qt_src_stop;
gstbasesrc_class->unlock = gst_qt_src_unlock;
gstbasesrc_class->decide_allocation = gst_qt_src_decide_allocation; gstbasesrc_class->decide_allocation = gst_qt_src_decide_allocation;
gstpushsrc_class->fill = gst_qt_src_fill; gstpushsrc_class->fill = gst_qt_src_fill;
@ -513,8 +515,6 @@ gst_qt_src_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
if (qt_src->window)
qt_window_stop (qt_src->window);
break; break;
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
@ -554,6 +554,15 @@ gst_qt_src_start (GstBaseSrc * basesrc)
return TRUE; return TRUE;
} }
static gboolean
gst_qt_src_unlock(GstBaseSrc *basesrc)
{
GstQtSrc *qt_src = GST_QT_SRC (basesrc);
if (qt_src->window)
qt_window_stop (qt_src->window);
return TRUE;
}
static gboolean static gboolean
gst_qt_src_stop (GstBaseSrc * basesrc) gst_qt_src_stop (GstBaseSrc * basesrc)
{ {