mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
playbin: improve autoplug_query_caps return
Makes autoplug_query_caps return downstream_caps + intersect_first(filter_caps, element_caps) https://bugzilla.gnome.org/show_bug.cgi?id=724828
This commit is contained in:
parent
12bafecc6c
commit
45dfceacdb
1 changed files with 14 additions and 7 deletions
|
@ -4565,6 +4565,15 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
|
||||||
return GST_AUTOPLUG_SELECT_EXPOSE;
|
return GST_AUTOPLUG_SELECT_EXPOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GST_PLAY_BIN_FILTER_CAPS(filter,caps) G_STMT_START { \
|
||||||
|
if ((filter)) { \
|
||||||
|
GstCaps *intersection = \
|
||||||
|
gst_caps_intersect_full ((filter), (caps), GST_CAPS_INTERSECT_FIRST); \
|
||||||
|
gst_caps_unref ((caps)); \
|
||||||
|
(caps) = intersection; \
|
||||||
|
} \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
||||||
GstElement * element, GstQuery * query, GstSourceGroup * group)
|
GstElement * element, GstQuery * query, GstSourceGroup * group)
|
||||||
|
@ -4669,6 +4678,7 @@ autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
||||||
have_sink = TRUE;
|
have_sink = TRUE;
|
||||||
} else {
|
} else {
|
||||||
GstCaps *subcaps = gst_subtitle_overlay_create_factory_caps ();
|
GstCaps *subcaps = gst_subtitle_overlay_create_factory_caps ();
|
||||||
|
GST_PLAY_BIN_FILTER_CAPS (filter, subcaps);
|
||||||
if (!result)
|
if (!result)
|
||||||
result = subcaps;
|
result = subcaps;
|
||||||
else
|
else
|
||||||
|
@ -4700,6 +4710,7 @@ autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
||||||
templ_caps = gst_static_pad_template_get_caps (l->data);
|
templ_caps = gst_static_pad_template_get_caps (l->data);
|
||||||
|
|
||||||
if (!gst_caps_is_any (templ_caps)) {
|
if (!gst_caps_is_any (templ_caps)) {
|
||||||
|
GST_PLAY_BIN_FILTER_CAPS (filter, templ_caps);
|
||||||
if (!result)
|
if (!result)
|
||||||
result = templ_caps;
|
result = templ_caps;
|
||||||
else
|
else
|
||||||
|
@ -4727,17 +4738,13 @@ done:
|
||||||
GstPad *target = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
|
GstPad *target = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
result = gst_caps_merge (result, gst_pad_get_pad_template_caps (target));
|
GstCaps *target_caps = gst_pad_get_pad_template_caps (target);
|
||||||
|
GST_PLAY_BIN_FILTER_CAPS (filter, target_caps);
|
||||||
|
result = gst_caps_merge (result, target_caps);
|
||||||
gst_object_unref (target);
|
gst_object_unref (target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter) {
|
|
||||||
GstCaps *intersection =
|
|
||||||
gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
|
|
||||||
gst_caps_unref (result);
|
|
||||||
result = intersection;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_query_set_caps_result (query, result);
|
gst_query_set_caps_result (query, result);
|
||||||
gst_caps_unref (result);
|
gst_caps_unref (result);
|
||||||
|
|
Loading…
Reference in a new issue