decodebin2: Intersect the factory caps with the current caps for the capsfilter

Otherwise we'll include many incompatible caps in the capsfilter that
will only slow down negotiation.
This commit is contained in:
Sebastian Dröge 2011-09-07 14:19:32 +02:00
parent 950af0438b
commit 46e26824d4

View file

@ -1555,7 +1555,7 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
for (i = 0; i < factories->n_values; i++) { for (i = 0; i < factories->n_values; i++) {
GstElementFactory *factory = GstElementFactory *factory =
g_value_get_object (g_value_array_get_nth (factories, i)); g_value_get_object (g_value_array_get_nth (factories, i));
GstCaps *tcaps; GstCaps *tcaps, *intersection;
const GList *tmps; const GList *tmps;
GST_DEBUG ("Trying factory %s", GST_DEBUG ("Trying factory %s",
@ -1572,7 +1572,9 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS)
continue; continue;
tcaps = gst_static_pad_template_get_caps (st); tcaps = gst_static_pad_template_get_caps (st);
gst_caps_merge (filter_caps, gst_caps_copy (tcaps)); intersection =
gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_merge (filter_caps, intersection);
gst_caps_unref (tcaps); gst_caps_unref (tcaps);
} }
} }