[0.11] gst-plugins-base: decodebin2: Intersect the factory caps with the current caps for the capsfilter

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


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

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Sep  7 14:19:32 2011 +0200

decodebin2: Intersect the factory caps with the current caps for the capsfilter

Otherwise we'll include many incompatible caps in the capsfilter that
will only slow down negotiation.

---

 gst/playback/gstdecodebin2.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
index 322ae28..5c39793 100644
--- a/gst/playback/gstdecodebin2.c
+++ b/gst/playback/gstdecodebin2.c
@@ -1555,7 +1555,7 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
     for (i = 0; i < factories->n_values; i++) {
       GstElementFactory *factory =
           g_value_get_object (g_value_array_get_nth (factories, i));
-      GstCaps *tcaps;
+      GstCaps *tcaps, *intersection;
       const GList *tmps;
 
       GST_DEBUG ("Trying factory %s",
@@ -1572,7 +1572,9 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
         if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS)
           continue;
         tcaps = gst_static_pad_template_get_caps (st);
-        gst_caps_merge (filter_caps, gst_caps_copy (tcaps));
+        intersection =
+            gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST);
+        gst_caps_merge (filter_caps, intersection);
         gst_caps_unref (tcaps);
       }
     }



More information about the gstreamer-commits mailing list