From 649c00d3c73310077277624307a0a27768abd4e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 29 Jun 2016 13:57:02 +0200 Subject: [PATCH] vaapipostproc: return caps template if no display This patch is a fix for my bad review of commit 6d73ca8d. The element should be able to return the available raw caps handled by the VA display, but that only should happen when there a VA display. If there's none, the element should use the caps template. https://bugzilla.gnome.org/show_bug.cgi?id=768161 --- gst/vaapi/gstvaapipostproc.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 2a2f521..43e6582 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -911,31 +911,27 @@ ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc) if (postproc->allowed_sinkpad_caps) return TRUE; + if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc)) + return FALSE; + /* Create VA caps */ out_caps = gst_caps_from_string (GST_VAAPI_MAKE_SURFACE_CAPS ", " GST_CAPS_INTERLACED_MODES); if (!out_caps) { - GST_ERROR_OBJECT (postproc, "failed to create VA sink caps"); + GST_WARNING_OBJECT (postproc, "failed to create VA sink caps"); return FALSE; } - /* Append raw video caps */ - if (GST_VAAPI_PLUGIN_BASE (postproc)->display) { - raw_caps = - gst_vaapi_plugin_base_get_allowed_raw_caps (GST_VAAPI_PLUGIN_BASE - (postproc)); - } else { - raw_caps = - gst_caps_from_string (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " - GST_CAPS_INTERLACED_MODES); - } - - if (raw_caps) { - out_caps = gst_caps_make_writable (out_caps); - gst_caps_append (out_caps, gst_caps_copy (raw_caps)); - } else { + raw_caps = gst_vaapi_plugin_base_get_allowed_raw_caps + (GST_VAAPI_PLUGIN_BASE (postproc)); + if (!raw_caps) { + gst_caps_unref (out_caps); GST_WARNING_OBJECT (postproc, "failed to create YUV sink caps"); + return FALSE; } + + out_caps = gst_caps_make_writable (out_caps); + gst_caps_append (out_caps, gst_caps_copy (raw_caps)); postproc->allowed_sinkpad_caps = out_caps; /* XXX: append VA/VPP filters */ @@ -1011,7 +1007,7 @@ gst_vaapipostproc_transform_caps_impl (GstBaseTransform * trans, /* Generate the sink pad caps, that could be fixated afterwards */ if (direction == GST_PAD_SRC) { if (!ensure_allowed_sinkpad_caps (postproc)) - return NULL; + return gst_caps_from_string (gst_vaapipostproc_sink_caps_str); return gst_caps_ref (postproc->allowed_sinkpad_caps); } -- 2.7.4