From d6dbd2094ec83765248ce382912cfc2f6bef73f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 17 Jul 2012 20:54:45 +0100 Subject: [PATCH] dvdreadsrc: mustn't drop queries like caps query if not started yet --- ext/dvdread/dvdreadsrc.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/ext/dvdread/dvdreadsrc.c b/ext/dvdread/dvdreadsrc.c index dfc387a5ef..ca0bf5519e 100644 --- a/ext/dvdread/dvdreadsrc.c +++ b/ext/dvdread/dvdreadsrc.c @@ -1550,35 +1550,39 @@ static gboolean gst_dvd_read_src_src_query (GstBaseSrc * basesrc, GstQuery * query) { GstDvdReadSrc *src = GST_DVD_READ_SRC (basesrc); - gboolean started; gboolean res = TRUE; - GST_LOG_OBJECT (src, "handling %s query", - gst_query_type_get_name (GST_QUERY_TYPE (query))); - - GST_OBJECT_LOCK (src); - started = (GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_FLAG_STARTED)); - GST_OBJECT_UNLOCK (src); - - if (!started) { - GST_DEBUG_OBJECT (src, "query failed: not started"); - return FALSE; - } + GST_LOG_OBJECT (src, "handling %s query", GST_QUERY_TYPE_NAME (query)); switch (GST_QUERY_TYPE (query)) { case GST_QUERY_DURATION: GST_OBJECT_LOCK (src); - res = gst_dvd_read_src_do_duration_query (src, query); + if (GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_FLAG_STARTED)) { + res = gst_dvd_read_src_do_duration_query (src, query); + } else { + GST_DEBUG_OBJECT (src, "query failed: not started"); + res = FALSE; + } GST_OBJECT_UNLOCK (src); break; case GST_QUERY_POSITION: GST_OBJECT_LOCK (src); - res = gst_dvd_read_src_do_position_query (src, query); + if (GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_FLAG_STARTED)) { + res = gst_dvd_read_src_do_position_query (src, query); + } else { + GST_DEBUG_OBJECT (src, "query failed: not started"); + res = FALSE; + } GST_OBJECT_UNLOCK (src); break; case GST_QUERY_CONVERT: GST_OBJECT_LOCK (src); - res = gst_dvd_read_src_do_convert_query (src, query); + if (GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_FLAG_STARTED)) { + res = gst_dvd_read_src_do_convert_query (src, query); + } else { + GST_DEBUG_OBJECT (src, "query failed: not started"); + res = FALSE; + } GST_OBJECT_UNLOCK (src); break; default: