From 861ef4d218b40391ae752dae43ac8b8e3cd5f5ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 1 Mar 2016 11:35:49 +0100 Subject: [PATCH] vaapidecode: intersect with filter in getcaps() In commit 6034734d I forgot to add the caps filter intersection in the getcaps() vmethod generating a regression when a capsfilter is set in the pipeline. This commit adds the caps filter intersection. --- gst/vaapi/gstvaapidecode.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index ed68ccb95f..8b40baf333 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1005,13 +1005,16 @@ static GstCaps * gst_vaapidecode_sink_getcaps (GstVideoDecoder * vdec, GstCaps * filter) { GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); + GstCaps *tmp, *caps = NULL; if (decode->allowed_caps) goto bail; /* if we haven't a display yet, return our pad's template caps */ - if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (decode)) - return gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SINK_PAD (vdec)); + if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (decode)) { + caps = gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SINK_PAD (vdec)); + goto bail; + } /* if the allowed caps calculation fails, return an empty caps, so * the auto-plug can try other decoder */ @@ -1019,7 +1022,16 @@ gst_vaapidecode_sink_getcaps (GstVideoDecoder * vdec, GstCaps * filter) return gst_caps_new_empty (); bail: - return gst_caps_ref (decode->allowed_caps); + if (!caps) + caps = gst_caps_ref (decode->allowed_caps); + + if (filter) { + tmp = caps; + caps = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (tmp); + } + + return caps; } static gboolean