From 580a94d18b4bd41266630ce60818af9ce63db5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 22 Jul 2013 17:30:31 +0100 Subject: [PATCH] interlace: fix negotiation if filter caps are passed to query_caps Make videotestsrc ! interlace ! $anything work again. Problem was that upstream filter caps were passed which contained interlace-mode=progressive, which doesn't intersect too well with interlace's source pad template caps, leading to not-negotiated errors. --- gst/interlace/gstinterlace.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gst/interlace/gstinterlace.c b/gst/interlace/gstinterlace.c index 8917f6f107..c503abf15f 100644 --- a/gst/interlace/gstinterlace.c +++ b/gst/interlace/gstinterlace.c @@ -501,14 +501,25 @@ gst_interlace_getcaps (GstPad * pad, GstInterlace * interlace, GstCaps * filter) GstPad *otherpad; GstCaps *othercaps, *tcaps; GstCaps *icaps; + GstCaps *clean_filter = NULL; const char *mode; + guint i; otherpad = (pad == interlace->srcpad) ? interlace->sinkpad : interlace->srcpad; - tcaps = gst_pad_get_pad_template_caps (otherpad); - othercaps = gst_pad_peer_query_caps (otherpad, filter); + if (filter != NULL) { + clean_filter = gst_caps_copy (filter); + for (i = 0; i < gst_caps_get_size (clean_filter); ++i) { + GstStructure *s; + s = gst_caps_get_structure (clean_filter, i); + gst_structure_remove_field (s, "interlace-mode"); + } + } + + tcaps = gst_pad_get_pad_template_caps (otherpad); + othercaps = gst_pad_peer_query_caps (otherpad, clean_filter); if (othercaps) { icaps = gst_caps_intersect (othercaps, tcaps); gst_caps_unref (othercaps); @@ -516,8 +527,8 @@ gst_interlace_getcaps (GstPad * pad, GstInterlace * interlace, GstCaps * filter) icaps = tcaps; } - if (filter) { - othercaps = gst_caps_intersect (icaps, filter); + if (clean_filter) { + othercaps = gst_caps_intersect (icaps, clean_filter); gst_caps_unref (icaps); icaps = othercaps; } @@ -533,6 +544,9 @@ gst_interlace_getcaps (GstPad * pad, GstInterlace * interlace, GstCaps * filter) gst_caps_unref (tcaps); + if (clean_filter) + gst_caps_unref (clean_filter); + return icaps; }