vaapivideobufferpool: add video meta to config when needed

In cases where we know the video meta must be present, add it to
the pool configuration.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766184
This commit is contained in:
Scott D Phillips 2016-06-14 09:45:22 -07:00 committed by Víctor Manuel Jáquez Leal
parent 2e5367a23c
commit b5bf2e83f7

View file

@ -139,6 +139,7 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
const GstVideoInfo *alloc_vip;
GstVideoAlignment align;
GstAllocator *allocator;
gboolean ret, updated = FALSE;
GST_DEBUG_OBJECT (pool, "config %" GST_PTR_FORMAT, config);
@ -184,6 +185,21 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
if (gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META))
priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META;
else {
gint i;
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&priv->video_info); i++) {
if (GST_VIDEO_INFO_PLANE_OFFSET (&priv->video_info, i) !=
GST_VIDEO_INFO_PLANE_OFFSET (&priv->alloc_info, i) ||
GST_VIDEO_INFO_PLANE_STRIDE (&priv->video_info, i) !=
GST_VIDEO_INFO_PLANE_STRIDE (&priv->alloc_info, i)) {
priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META;
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
updated = TRUE;
break;
}
}
}
if (gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
@ -195,9 +211,10 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META))
priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_GL_TEXTURE_UPLOAD;
return
ret =
GST_BUFFER_POOL_CLASS
(gst_vaapi_video_buffer_pool_parent_class)->set_config (pool, config);
return !updated && ret;
/* ERRORS */
error_invalid_config: