From: Matthew Waters Date: Thu, 23 Oct 2014 13:35:22 +0000 (+1100) Subject: glmixer: override the caps query in order to 'convert' capsfeatures X-Git-Tag: 1.19.3~511^2~1294^2~315 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33584480b5e2f75db6f6f1faf55fbcac67ce53e2;p=platform%2Fupstream%2Fgstreamer.git glmixer: override the caps query in order to 'convert' capsfeatures Otherwise, it is only possible for the sink pads and the src pads to have the exact same caps features. We can convert from any feature to another feature so support that. --- diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index da6ba67..a80d2b7 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -287,6 +287,37 @@ gst_gl_mixer_pad_sink_acceptcaps (GstPad * pad, GstGLMixer * mix, return ret; } +static GstCaps * +gst_gl_mixer_pad_sink_getcaps (GstPad * pad, GstGLMixer * mix, GstCaps * filter) +{ + GstCaps *srccaps; + GstCaps *template_caps; + GstCaps *filtered_caps; + GstCaps *returned_caps; + gboolean had_current_caps = TRUE; + + template_caps = gst_pad_get_pad_template_caps (pad); + + srccaps = gst_pad_get_current_caps (pad); + if (srccaps == NULL) { + had_current_caps = FALSE; + srccaps = template_caps; + } + + filtered_caps = srccaps; + if (filter) + filtered_caps = gst_caps_intersect (srccaps, filter); + returned_caps = gst_caps_intersect (filtered_caps, template_caps); + + gst_caps_unref (srccaps); + if (filter) + gst_caps_unref (filtered_caps); + if (had_current_caps) + gst_caps_unref (template_caps); + + return returned_caps; +} + static gboolean gst_gl_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad, GstQuery * query) @@ -297,6 +328,17 @@ gst_gl_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad, GST_TRACE ("QUERY %" GST_PTR_FORMAT, query); switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_gl_mixer_pad_sink_getcaps (GST_PAD (bpad), mix, filter); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + ret = TRUE; + break; + } case GST_QUERY_ACCEPT_CAPS: { GstCaps *caps;