From fed0284d3cdf88f01ca06991d6fbd349c68bee97 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 14 Feb 2012 13:24:49 +0100 Subject: [PATCH] typefind: clean up src query handler --- plugins/elements/gsttypefindelement.c | 38 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 6f77068..d3bc979 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -384,27 +384,33 @@ gst_type_find_handle_src_query (GstPad * pad, GstObject * parent, GST_DEBUG_OBJECT (typefind, "Handling src query %s", GST_QUERY_TYPE_NAME (query)); - /* We can hijack caps query if we typefind already */ - if (GST_QUERY_TYPE (query) == GST_QUERY_CAPS) { - GST_DEBUG_OBJECT (typefind, "Got caps query, our caps are %" GST_PTR_FORMAT, - typefind->caps); - if (typefind->caps) { - gst_query_set_caps_result (query, typefind->caps); - res = TRUE; - goto out; - } - } - - res = gst_pad_peer_query (typefind->sink, query); - if (!res) - goto out; - switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_SCHEDULING: + /* FIXME, filter out the scheduling modes that we understand */ + res = gst_pad_peer_query (typefind->sink, query); + break; + case GST_QUERY_CAPS: + { + GST_DEBUG_OBJECT (typefind, + "Got caps query, our caps are %" GST_PTR_FORMAT, typefind->caps); + + /* We can hijack caps query if we typefind already */ + if (typefind->caps) { + gst_query_set_caps_result (query, typefind->caps); + res = TRUE; + } else { + res = gst_pad_peer_query (typefind->sink, query); + } + break; + } case GST_QUERY_POSITION: { gint64 peer_pos; GstFormat format; + if (!(res = gst_pad_peer_query (typefind->sink, query))) + goto out; + gst_query_parse_position (query, &format, &peer_pos); GST_OBJECT_LOCK (typefind); @@ -422,9 +428,9 @@ gst_type_find_handle_src_query (GstPad * pad, GstObject * parent, break; } default: + res = gst_pad_query_default (pad, parent, query); break; } - out: return res; } -- 2.7.4