summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott D Phillips <scott.d.phillips@intel.com>2016-06-14 09:45:22 -0700
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-06-15 20:40:57 +0200
commit73d8e8ca114ddd3b251d5f6041b9920355564825 (patch)
treedfe65a1c6d14e512fc33c427493506a2d9c9df0d
parent7389c220dcc4f946a6898d48877c47d2441d0d48 (diff)
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
-rw-r--r--gst/vaapi/gstvaapivideobufferpool.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c
index 8e45bbc4..b0e38a24 100644
--- a/gst/vaapi/gstvaapivideobufferpool.c
+++ b/gst/vaapi/gstvaapivideobufferpool.c
@@ -141,7 +141,7 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
GstVideoInfo *const new_vip = &priv->video_info[!priv->video_info_index];
GstVideoAlignment align;
GstAllocator *allocator;
- gboolean changed_caps, use_dmabuf_memory;
+ gboolean changed_caps, use_dmabuf_memory, ret, updated = FALSE;
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
goto error_invalid_config;
@@ -191,6 +191,21 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
priv->has_video_meta = gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
+ if (!priv->has_video_meta) {
+ gint i;
+ for (i = 0; i < GST_VIDEO_INFO_N_PLANES (new_vip); i++) {
+ if (GST_VIDEO_INFO_PLANE_OFFSET (new_vip, i) !=
+ GST_VIDEO_INFO_PLANE_OFFSET (&priv->alloc_info, i) ||
+ GST_VIDEO_INFO_PLANE_STRIDE (new_vip, i) !=
+ GST_VIDEO_INFO_PLANE_STRIDE (&priv->alloc_info, i)) {
+ priv->has_video_meta = TRUE;
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ updated = TRUE;
+ break;
+ }
+ }
+ }
priv->has_video_alignment = gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
@@ -202,9 +217,10 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
priv->has_texture_upload_meta = gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
- return
+ ret =
GST_BUFFER_POOL_CLASS
(gst_vaapi_video_buffer_pool_parent_class)->set_config (pool, config);
+ return !updated && ret;
/* ERRORS */
error_invalid_config: