From 113546b777ed24c785698b0ec09a385224eb745a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 24 Nov 2011 12:37:58 +0100 Subject: [PATCH] playsinkconvertbin: Override acceptcaps function for the two ghostpads The ghostpad acceptcaps functions are not valid in this case because we don't only accept the caps accepted by the target but could also insert converters. Fixes bug #663892. --- gst/playback/gstplaysinkconvertbin.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c index 99a2e38..50b1d6d 100644 --- a/gst/playback/gstplaysinkconvertbin.c +++ b/gst/playback/gstplaysinkconvertbin.c @@ -394,6 +394,22 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad) gst_object_unref (self); + GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, ret); + + return ret; +} + +static gboolean +gst_play_sink_convert_bin_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstCaps *allowed_caps; + gboolean ret; + + allowed_caps = gst_pad_get_caps_reffed (pad); + /* FIXME 0.11: Should be a subset check now */ + ret = gst_caps_can_intersect (caps, allowed_caps); + gst_caps_unref (allowed_caps); + return ret; } @@ -561,6 +577,8 @@ gst_play_sink_convert_bin_init (GstPlaySinkConvertBin * self) GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_sink_setcaps)); gst_pad_set_getcaps_function (self->sinkpad, GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_getcaps)); + gst_pad_set_acceptcaps_function (self->sinkpad, + GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_acceptcaps)); self->sink_proxypad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (self->sinkpad))); @@ -572,6 +590,8 @@ gst_play_sink_convert_bin_init (GstPlaySinkConvertBin * self) self->srcpad = gst_ghost_pad_new_no_target_from_template ("src", templ); gst_pad_set_getcaps_function (self->srcpad, GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_getcaps)); + gst_pad_set_acceptcaps_function (self->srcpad, + GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_acceptcaps)); gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad); gst_object_unref (templ); -- 2.7.4