decodebin: Create a new decode element with the parser/convert capsfilter if there is a multiqueue after the parser

https://bugzilla.gnome.org/show_bug.cgi?id=767102
This commit is contained in:
Sebastian Dröge 2016-06-01 16:56:13 +03:00
parent fb21fc3af1
commit 17d04998c0

View file

@ -1740,12 +1740,10 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
if (is_parser_converter) { if (is_parser_converter) {
GstCaps *filter_caps; GstCaps *filter_caps;
gint i; gint i;
GstElement *capsfilter;
GstPad *p; GstPad *p;
GstDecodeElement *delem; GstDecodeElement *delem;
g_assert (chain->elements != NULL);
delem = (GstDecodeElement *) chain->elements->data;
filter_caps = gst_caps_new_empty (); filter_caps = gst_caps_new_empty ();
for (i = 0; i < factories->n_values; i++) { for (i = 0; i < factories->n_values; i++) {
GstElementFactory *factory = GstElementFactory *factory =
@ -1779,17 +1777,28 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
/* Append the parser caps to prevent any not-negotiated errors */ /* Append the parser caps to prevent any not-negotiated errors */
filter_caps = gst_caps_merge (filter_caps, gst_caps_ref (caps)); filter_caps = gst_caps_merge (filter_caps, gst_caps_ref (caps));
delem->capsfilter = gst_element_factory_make ("capsfilter", NULL); if (chain->elements) {
g_object_set (G_OBJECT (delem->capsfilter), "caps", filter_caps, NULL); delem = (GstDecodeElement *) chain->elements->data;
capsfilter = delem->capsfilter =
gst_element_factory_make ("capsfilter", NULL);
} else {
delem = g_slice_new0 (GstDecodeElement);
capsfilter = delem->element =
gst_element_factory_make ("capsfilter", NULL);
delem->capsfilter = NULL;
chain->elements = g_list_prepend (chain->elements, delem);
}
g_object_set (G_OBJECT (capsfilter), "caps", filter_caps, NULL);
gst_caps_unref (filter_caps); gst_caps_unref (filter_caps);
gst_element_set_state (delem->capsfilter, GST_STATE_PAUSED); gst_element_set_state (capsfilter, GST_STATE_PAUSED);
gst_bin_add (GST_BIN_CAST (dbin), gst_object_ref (delem->capsfilter)); gst_bin_add (GST_BIN_CAST (dbin), gst_object_ref (capsfilter));
decode_pad_set_target (dpad, NULL); decode_pad_set_target (dpad, NULL);
p = gst_element_get_static_pad (delem->capsfilter, "sink"); p = gst_element_get_static_pad (capsfilter, "sink");
gst_pad_link_full (pad, p, GST_PAD_LINK_CHECK_NOTHING); gst_pad_link_full (pad, p, GST_PAD_LINK_CHECK_NOTHING);
gst_object_unref (p); gst_object_unref (p);
p = gst_element_get_static_pad (delem->capsfilter, "src"); p = gst_element_get_static_pad (capsfilter, "src");
decode_pad_set_target (dpad, p); decode_pad_set_target (dpad, p);
pad = p; pad = p;