mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +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;
|
||||
}
|
||||
|
||||
#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
|
||||
autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
||||
GstElement * element, GstQuery * query, GstSourceGroup * group)
|
||||
|
@ -4669,6 +4678,7 @@ autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
|||
have_sink = TRUE;
|
||||
} else {
|
||||
GstCaps *subcaps = gst_subtitle_overlay_create_factory_caps ();
|
||||
GST_PLAY_BIN_FILTER_CAPS (filter, subcaps);
|
||||
if (!result)
|
||||
result = subcaps;
|
||||
else
|
||||
|
@ -4700,6 +4710,7 @@ autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
|
|||
templ_caps = gst_static_pad_template_get_caps (l->data);
|
||||
|
||||
if (!gst_caps_is_any (templ_caps)) {
|
||||
GST_PLAY_BIN_FILTER_CAPS (filter, templ_caps);
|
||||
if (!result)
|
||||
result = templ_caps;
|
||||
else
|
||||
|
@ -4727,17 +4738,13 @@ done:
|
|||
GstPad *target = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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_caps_unref (result);
|
||||
|
|
Loading…
Reference in a new issue