diff options
author | Scott D Phillips <scott.d.phillips@intel.com> | 2016-06-14 09:45:22 -0700 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2016-06-15 15:44:00 +0200 |
commit | b5bf2e83f76e6828829fa0376a7c0041708dc3b9 (patch) | |
tree | cffd2d72c0f64f3b3fb1dd5791cd9c3c3374c99b /gst | |
parent | 2e5367a23c34d93973fff71c5b66b31081068dab (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
Diffstat (limited to 'gst')
-rw-r--r-- | gst/vaapi/gstvaapivideobufferpool.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c index fe0da52a..a3b9223f 100644 --- a/gst/vaapi/gstvaapivideobufferpool.c +++ b/gst/vaapi/gstvaapivideobufferpool.c @@ -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: |