From e0a878aef3fa381f181f9ff17ce2b31667ac0635 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 11 Aug 2014 11:33:28 -0300 Subject: [PATCH] dvbsuboverlay: always intersect with the filter in getcaps Avoids returning unsupported caps to peers https://bugzilla.gnome.org/show_bug.cgi?id=733916 --- gst/dvbsuboverlay/gstdvbsuboverlay.c | 41 ++++++++++++------------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c index de65084..2f36269 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.c +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c @@ -550,12 +550,6 @@ gst_dvbsub_overlay_get_videosink_caps (GstDVBSubOverlay * render, GstPad * pad, /* if peer returns ANY caps, return filtered src pad template caps */ caps = gst_pad_get_pad_template_caps (srcpad); - if (filter) { - GstCaps *intersection = gst_caps_intersect_full (filter, caps, - GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = intersection; - } } else { @@ -572,14 +566,15 @@ gst_dvbsub_overlay_get_videosink_caps (GstDVBSubOverlay * render, GstPad * pad, } else { /* no peer, our padtemplate is enough then */ caps = gst_pad_get_pad_template_caps (pad); - if (filter) { - GstCaps *intersection; + } - intersection = - gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = intersection; - } + if (filter) { + GstCaps *intersection; + + intersection = + gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (caps); + caps = intersection; } GST_DEBUG_OBJECT (render, "returning %" GST_PTR_FORMAT, caps); @@ -618,13 +613,6 @@ gst_dvbsub_overlay_get_src_caps (GstDVBSubOverlay * render, GstPad * pad, /* if peer returns ANY caps, return filtered sink pad template caps */ caps = gst_pad_get_pad_template_caps (sinkpad); - if (filter) { - GstCaps *intersection = gst_caps_intersect_full (filter, caps, - GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = intersection; - } - } else { /* return upstream caps + composition feature + upstream caps @@ -640,14 +628,13 @@ gst_dvbsub_overlay_get_src_caps (GstDVBSubOverlay * render, GstPad * pad, } else { /* no peer, our padtemplate is enough then */ caps = gst_pad_get_pad_template_caps (pad); - if (filter) { - GstCaps *intersection; + } - intersection = - gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = intersection; - } + if (filter) { + GstCaps *intersection = gst_caps_intersect_full (filter, caps, + GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (caps); + caps = intersection; } GST_DEBUG_OBJECT (render, "returning %" GST_PTR_FORMAT, caps); -- 2.7.4