vaapipostproc: set interlace mode

if the vaapipostproc is configured to not do deinterlacing, the
interlace-mode in the src caps should be the same as the input caps.

https://bugzilla.gnome.org/show_bug.cgi?id=777395
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-01-20 19:00:24 +01:00
parent 42df9ba98c
commit d8abbd7652
2 changed files with 31 additions and 1 deletions

View file

@ -68,7 +68,7 @@ static const char gst_vaapipostproc_src_caps_str[] =
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS "; "
#endif
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
GST_CAPS_INTERLACED_MODES;
/* *INDENT-ON* */
/* *INDENT-OFF* */

View file

@ -585,6 +585,28 @@ _set_colorimetry (GstVaapiPostproc * postproc, GstVideoFormat format,
return TRUE;
}
static gboolean
_set_interlace_mode (GstVaapiPostproc * postproc, GstVideoInfo * vinfo,
GstStructure * outs)
{
const gchar *interlace_mode = NULL;
if (is_deinterlace_enabled (postproc, vinfo)) {
interlace_mode = "progressive";
} else {
interlace_mode =
gst_video_interlace_mode_to_string (GST_VIDEO_INFO_INTERLACE_MODE
(vinfo));
}
if (!interlace_mode)
return FALSE;
gst_structure_set (outs, "interlace-mode", G_TYPE_STRING, interlace_mode,
NULL);
return TRUE;
}
static gboolean
_set_preferred_format (GstStructure * outs, GstVideoFormat format)
{
@ -649,6 +671,9 @@ _get_preferred_caps (GstVaapiPostproc * postproc, GstVideoInfo * vinfo,
if (f == GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY)
_set_colorimetry (postproc, format, structure);
if (!_set_interlace_mode (postproc, vinfo, structure))
goto interlace_mode_failed;
outcaps = gst_caps_new_empty ();
gst_caps_append_structure_full (outcaps, structure,
gst_caps_features_copy (features));
@ -673,6 +698,11 @@ invalid_caps:
GST_WARNING_OBJECT (postproc, "No valid src caps found");
return NULL;
}
interlace_mode_failed:
{
GST_WARNING_OBJECT (postproc, "Invalid sink caps interlace mode");
return NULL;
}
}
/**