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)
{
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;