[0.11] gstreamer: typefind: answer caps queries with our typefound caps

Sebastian Dröge slomo at kemper.freedesktop.org
Fri Jan 27 07:44:58 PST 2012


Module: gstreamer
Branch: 0.11
Commit: 27ac781ba6ba4a9acec4dcb57751a4243a7da2ef
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=27ac781ba6ba4a9acec4dcb57751a4243a7da2ef

Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date:   Wed Jan 25 12:35:43 2012 +0000

typefind: answer caps queries with our typefound caps

This avoids merely forwarding the event to the sink, and getting
something useless such as ANY.

https://bugzilla.gnome.org/show_bug.cgi?id=667571

---

 plugins/elements/gsttypefindelement.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c
index 7134efb..9b401b1 100644
--- a/plugins/elements/gsttypefindelement.c
+++ b/plugins/elements/gsttypefindelement.c
@@ -381,6 +381,19 @@ gst_type_find_handle_src_query (GstPad * pad, GstObject * parent,
   gboolean res = FALSE;
 
   typefind = GST_TYPE_FIND_ELEMENT (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)



More information about the gstreamer-commits mailing list