autoconvert: Look at all possibilities for accept-caps even if there is a selected subelement

If the accept-caps succeeds with a different subelement, then the subsequent
caps event will change the current subelement.
This commit is contained in:
Olivier Crête 2012-09-11 18:53:43 -04:00
parent 60739b828d
commit 977f84d272

View file

@ -1039,28 +1039,37 @@ gst_auto_convert_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
gst_object_unref (sub_sinkpad);
gst_object_unref (subelement);
} else {
if (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) {
GstCaps *caps;
GstCaps *accept_caps;
gst_query_parse_accept_caps (query, &accept_caps);
if (ret && GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) {
gboolean res;
gst_query_parse_accept_caps_result (query, &res);
caps = gst_auto_convert_getcaps (autoconvert, accept_caps, GST_PAD_SINK);
gst_query_set_accept_caps_result (query,
gst_caps_can_intersect (caps, accept_caps));
gst_caps_unref (caps);
return TRUE;
if (!res)
goto ignore_acceptcaps_failure;
}
GST_WARNING_OBJECT (autoconvert, "Got query %s while no element was"
" selected, letting through",
gst_query_type_get_name (GST_QUERY_TYPE (query)));
ret = gst_pad_peer_query (autoconvert->srcpad, query);
return ret;
}
return ret;
ignore_acceptcaps_failure:
if (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) {
GstCaps *caps;
GstCaps *accept_caps;
gst_query_parse_accept_caps (query, &accept_caps);
caps = gst_auto_convert_getcaps (autoconvert, accept_caps, GST_PAD_SINK);
gst_query_set_accept_caps_result (query,
gst_caps_can_intersect (caps, accept_caps));
gst_caps_unref (caps);
return TRUE;
}
GST_WARNING_OBJECT (autoconvert, "Got query %s while no element was"
" selected, letting through",
gst_query_type_get_name (GST_QUERY_TYPE (query)));
return gst_pad_peer_query (autoconvert->srcpad, query);
}
/**