deinterleave: Return the current caps on the srcpads on caps queries
authorSebastian Dröge <sebastian@centricular.com>
Wed, 16 Mar 2016 18:26:16 +0000 (20:26 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 24 Mar 2016 12:47:40 +0000 (14:47 +0200)
It's not like we could accept any other caps here. The caps are decided by the
upstream caps event.

Also keep the filter order intact when filtering the results against the
filter caps.

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

gst/interleave/deinterleave.c

index 0c2e502..b38fcbe 100644 (file)
@@ -556,6 +556,19 @@ gst_deinterleave_getcaps (GstPad * pad, GstObject * parent, GstCaps * filter)
   GstIteratorResult res;
   GValue v = G_VALUE_INIT;
 
+  if (pad != self->sink) {
+    ret = gst_pad_get_current_caps (pad);
+    if (ret) {
+      if (filter) {
+        GstCaps *tmp =
+            gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
+        gst_caps_unref (ret);
+        ret = tmp;
+      }
+      return ret;
+    }
+  }
+
   /* Intersect all of our pad template caps with the peer caps of the pad
    * to get all formats that are possible up- and downstream.
    *
@@ -636,7 +649,7 @@ gst_deinterleave_getcaps (GstPad * pad, GstObject * parent, GstCaps * filter)
   if (filter) {
     GstCaps *aux;
 
-    aux = gst_caps_intersect (ret, filter);
+    aux = gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
     gst_caps_unref (ret);
     ret = aux;
   }