textoverlay: Query downstream caps for checking if caps features are supported, not...
authorSebastian Dröge <sebastian@centricular.com>
Tue, 28 Jul 2015 10:57:20 +0000 (13:57 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 28 Jul 2015 11:14:50 +0000 (14:14 +0300)
accept-caps is not recursive and might stop at the next downstream element,
while caps queries are generally recursive. The next element might accept any
capsfeatures we want, but that doesn't mean that further downstream it will
also work.

Additionally for the future:
We should probably check if downstream *prefers* the
overlay meta, and only enforce usage of it if we can't handle
the format ourselves and thus would have to drop the overlays.
Otherwise we should prefer what downstream wants here.

ext/pango/gstbasetextoverlay.c

index 96b66f1..54d9d1a 100644 (file)
@@ -727,6 +727,8 @@ gst_base_text_overlay_negotiate (GstBaseTextOverlay * overlay, GstCaps * caps)
   if (upstream_has_meta) {
     overlay_caps = gst_caps_ref (caps);
   } else {
+    GstCaps *peercaps;
+
     /* BaseTransform requires caps for the allocation query to work */
     overlay_caps = gst_caps_copy (caps);
     f = gst_caps_get_features (overlay_caps, 0);
@@ -734,8 +736,14 @@ gst_base_text_overlay_negotiate (GstBaseTextOverlay * overlay, GstCaps * caps)
         GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
 
     /* Then check if downstream accept overlay composition in caps */
-    caps_has_meta = gst_pad_peer_query_accept_caps (overlay->srcpad,
-        overlay_caps);
+    /* FIXME: We should probably check if downstream *prefers* the
+     * overlay meta, and only enforce usage of it if we can't handle
+     * the format ourselves and thus would have to drop the overlays.
+     * Otherwise we should prefer what downstream wants here.
+     */
+    peercaps = gst_pad_peer_query_caps (overlay->srcpad, NULL);
+    caps_has_meta = gst_caps_can_intersect (peercaps, overlay_caps);
+    gst_caps_unref (peercaps);
 
     GST_DEBUG ("caps have overlay meta %d", caps_has_meta);
   }