mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
playsinkconvertbin: improve gst_play_sink_convert_bin_getcaps return
If we have the peer caps and a caps filter, return peer_caps + intersect_first (filter, converter_caps) instead of intersect_first (filter, peer_caps + converter_caps) and preservers downstream caps preference order. https://bugzilla.gnome.org/show_bug.cgi?id=724893
This commit is contained in:
parent
ba9e8f0797
commit
5c1167a2c7
1 changed files with 15 additions and 9 deletions
|
@ -338,6 +338,15 @@ gst_play_sink_convert_bin_sink_setcaps (GstPlaySinkConvertBin * self,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define GST_PLAY_SINK_CONVERT_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 GstCaps *
|
||||
gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter)
|
||||
{
|
||||
|
@ -378,27 +387,24 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter)
|
|||
gst_caps_unref (downstream_filter);
|
||||
gst_object_unref (peer);
|
||||
if (self->converter_caps && is_raw_caps (peer_caps, self->audio)) {
|
||||
ret = gst_caps_merge (peer_caps, gst_caps_ref (self->converter_caps));
|
||||
GstCaps *converter_caps = gst_caps_ref (self->converter_caps);
|
||||
GST_PLAY_SINK_CONVERT_BIN_FILTER_CAPS (filter, converter_caps);
|
||||
ret = gst_caps_merge (peer_caps, converter_caps);
|
||||
} else {
|
||||
ret = peer_caps;
|
||||
GST_PLAY_SINK_CONVERT_BIN_FILTER_CAPS (filter, ret);
|
||||
}
|
||||
} else {
|
||||
ret = gst_caps_ref (self->converter_caps);
|
||||
GST_PLAY_SINK_CONVERT_BIN_FILTER_CAPS (filter, ret);
|
||||
}
|
||||
} else {
|
||||
ret = gst_caps_new_any ();
|
||||
ret = filter ? gst_caps_ref (filter) : gst_caps_new_any ();
|
||||
}
|
||||
GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
|
||||
|
||||
gst_object_unref (self);
|
||||
|
||||
if (filter) {
|
||||
GstCaps *intersection =
|
||||
gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (ret);
|
||||
ret = intersection;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, ret);
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue