[0.11] gst-plugins-base: Revert "Revert "decodebin2: Do a subset check before actually using a factory""

Sebastian Dröge slomo at kemper.freedesktop.org
Thu Sep 8 05:42:32 PDT 2011


Module: gst-plugins-base
Branch: 0.11
Commit: 21bc8ddcb769852060519dc50f75ec15c866ba35
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=21bc8ddcb769852060519dc50f75ec15c866ba35

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Thu Sep  8 14:42:13 2011 +0200

Revert "Revert "decodebin2: Do a subset check before actually using a factory""

This reverts commit 5f5d832a3bcff0828758f164fcb13c4258aefb36.

---

 gst/playback/gstdecodebin2.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
index 9a877bb..1563bed 100644
--- a/gst/playback/gstdecodebin2.c
+++ b/gst/playback/gstdecodebin2.c
@@ -1741,6 +1741,46 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
     /* Remove selected factory from the list. */
     g_value_array_remove (factories, 0);
 
+    /* Check if the caps are really supported by the factory. The
+     * factory list is non-empty-subset filtered while caps
+     * are only accepted by a pad if they are a subset of the
+     * pad caps.
+     *
+     * FIXME: Only do this for fixed caps here. Non-fixed caps
+     * can happen if a Parser/Converter was autoplugged before
+     * this. We then assume that it will be able to convert to
+     * everything that the decoder would want.
+     *
+     * A subset check will fail here because the parser caps
+     * will be generic and while the decoder will only
+     * support a subset of the parser caps.
+     */
+    if (gst_caps_is_fixed (caps)) {
+      const GList *templs;
+      gboolean skip = FALSE;
+
+      templs = gst_element_factory_get_static_pad_templates (factory);
+
+      while (templs) {
+        GstStaticPadTemplate *templ = (GstStaticPadTemplate *) templs->data;
+
+        if (templ->direction == GST_PAD_SINK) {
+          GstCaps *templcaps = gst_static_caps_get (&templ->static_caps);
+
+          if (!gst_caps_is_subset (caps, templcaps)) {
+            gst_caps_unref (templcaps);
+            skip = TRUE;
+            break;
+          }
+
+          gst_caps_unref (templcaps);
+        }
+        templs = g_list_next (templs);
+      }
+      if (skip)
+        continue;
+    }
+
     /* If the factory is for a parser we first check if the factory
      * was already used for the current chain. If it was used already
      * we would otherwise create an infinite loop here because the



More information about the gstreamer-commits mailing list