vaapipostproc: improve heuristics for detecting native VA surfaces.

Use the new gst_caps_has_vaapi_surface() helper function to detect
whether the sink pad caps contain native VA surfaces, or not, i.e.
no raw video caps.

Also rename is_raw_yuv to get_va_surfaces to make the variable more
explicit as we just want a way to differentiate raw video caps from
VA surfaces actually.
This commit is contained in:
Gwenole Beauchesne 2014-08-20 10:37:02 +02:00
parent 6d8c5221b2
commit d82e6a8866
2 changed files with 5 additions and 4 deletions

View file

@ -830,7 +830,7 @@ gst_vaapipostproc_update_sink_caps(GstVaapiPostproc *postproc, GstCaps *caps,
gst_util_uint64_scale(GST_SECOND, GST_VIDEO_INFO_FPS_D(&vi), gst_util_uint64_scale(GST_SECOND, GST_VIDEO_INFO_FPS_D(&vi),
(1 + deinterlace) * GST_VIDEO_INFO_FPS_N(&vi)) : 0; (1 + deinterlace) * GST_VIDEO_INFO_FPS_N(&vi)) : 0;
postproc->is_raw_yuv = GST_VIDEO_INFO_IS_YUV(&vi); postproc->get_va_surfaces = gst_caps_has_vaapi_surface(caps);
return TRUE; return TRUE;
} }
@ -1098,7 +1098,7 @@ gst_vaapipostproc_transform_size(GstBaseTransform *trans,
{ {
GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(trans); GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(trans);
if (direction == GST_PAD_SINK || !postproc->is_raw_yuv) if (direction == GST_PAD_SINK || postproc->get_va_surfaces)
*othersize = 0; *othersize = 0;
else else
*othersize = size; *othersize = size;
@ -1237,7 +1237,7 @@ gst_vaapipostproc_propose_allocation(GstBaseTransform *trans,
GstVaapiPluginBase * const plugin = GST_VAAPI_PLUGIN_BASE(trans); GstVaapiPluginBase * const plugin = GST_VAAPI_PLUGIN_BASE(trans);
/* Let vaapidecode allocate the video buffers */ /* Let vaapidecode allocate the video buffers */
if (!postproc->is_raw_yuv) if (postproc->get_va_surfaces)
return FALSE; return FALSE;
if (!gst_vaapi_plugin_base_propose_allocation(plugin, query)) if (!gst_vaapi_plugin_base_propose_allocation(plugin, query))
return FALSE; return FALSE;
@ -1587,6 +1587,7 @@ gst_vaapipostproc_init(GstVaapiPostproc *postproc)
postproc->deinterlace_method = DEFAULT_DEINTERLACE_METHOD; postproc->deinterlace_method = DEFAULT_DEINTERLACE_METHOD;
postproc->field_duration = GST_CLOCK_TIME_NONE; postproc->field_duration = GST_CLOCK_TIME_NONE;
postproc->keep_aspect = TRUE; postproc->keep_aspect = TRUE;
postproc->get_va_surfaces = TRUE;
gst_video_info_init(&postproc->sinkpad_info); gst_video_info_init(&postproc->sinkpad_info);
gst_video_info_init(&postproc->srcpad_info); gst_video_info_init(&postproc->srcpad_info);

View file

@ -166,7 +166,7 @@ struct _GstVaapiPostproc {
gfloat brightness; gfloat brightness;
gfloat contrast; gfloat contrast;
guint is_raw_yuv : 1; guint get_va_surfaces : 1;
guint use_vpp : 1; guint use_vpp : 1;
guint keep_aspect : 1; guint keep_aspect : 1;
}; };