basetransform: If suggested caps are not compatible with upstream try to come up with compatible caps

Fixes bug #662199.
This commit is contained in:
Sebastian Dröge 2011-12-07 09:50:40 +01:00
parent c33b50e00f
commit 7fb67e9d6f

View file

@ -1894,6 +1894,7 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
*/
peercaps =
gst_pad_peer_get_caps_reffed (GST_BASE_TRANSFORM_SINK_PAD (trans));
if (peercaps) {
GstCaps *intersect;
@ -1901,16 +1902,19 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
gst_caps_intersect_full (sink_suggest, peercaps,
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
/* If intersected caps is empty then just keep them empty. The
* code below will try to come up with possible caps if there
* are any */
gst_caps_unref (sink_suggest);
sink_suggest = intersect;
}
if (!gst_caps_is_fixed (sink_suggest) || gst_caps_is_empty (sink_suggest)) {
GST_DEBUG_OBJECT (trans, "Suggested caps is not fixed: %"
GST_PTR_FORMAT, sink_suggest);
if (gst_caps_is_empty (sink_suggest))
goto not_supported;
/* If the suggested caps are not empty and not fixed, try to fixate them */
if (!gst_caps_is_fixed (sink_suggest)
&& !gst_caps_is_empty (sink_suggest)) {
GST_DEBUG_OBJECT (trans,
"Suggested caps is not fixed: %" GST_PTR_FORMAT, sink_suggest);
/* try the alloc caps if it is still not fixed */
if (!gst_caps_is_fixed (sink_suggest)) {
@ -1941,6 +1945,11 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
sink_suggest);
}
/* Check if the suggested caps are compatible with our
* sinkpad template caps and if they're not (or were
* empty after intersecting with the peer caps above)
* we try to come up with any supported caps
*/
if (sink_suggest) {
templ = gst_pad_get_pad_template_caps (pad);