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.
This commit is contained in:
Tim-Philipp Müller 2013-07-22 17:30:31 +01:00
parent 6a1896d805
commit 580a94d18b

View file

@ -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;
}