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
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-06-29 13:57:02 +02:00
parent 6d73ca8da2
commit 649c00d3c7

View file

@ -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);
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;
}
if (raw_caps) {
out_caps = gst_caps_make_writable (out_caps);
gst_caps_append (out_caps, gst_caps_copy (raw_caps));
} else {
GST_WARNING_OBJECT (postproc, "failed to create YUV sink caps");
}
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);
}