From dce7a6f46ba3a33e182d9d10d1d23b3d7bc1db9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 8 Jun 2017 15:49:05 +0200 Subject: [PATCH] vaapivideobufferpool: rename video info structures Renamed private GstVideoInfo structure video_info to allocation_vinfo and alloc_info to negotiated_vinfo. The purpose of these renaming is to clarify the origin and purpose of these private variables: video_info (now allocation_vinfo) comes from the bufferpool configuration. It describes the physical video resolution to be allocated by the allocator, which may be different from the negotiated one. alloc_info (now vmeta_vinfo) comes from the negotiated caps in the pipeline. It represents how the frame is going to be mapped using the video meta. In Intel's VA-API backend, the allocation_vinfo resolution is bigger than the negotiated_info. https://bugzilla.gnome.org/show_bug.cgi?id=783599 --- gst/vaapi/gstvaapivideobufferpool.c | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c index 2782403a13..5339585cd3 100644 --- a/gst/vaapi/gstvaapivideobufferpool.c +++ b/gst/vaapi/gstvaapivideobufferpool.c @@ -44,9 +44,9 @@ enum struct _GstVaapiVideoBufferPoolPrivate { - GstVideoInfo video_info; + GstVideoInfo allocation_vinfo; GstAllocator *allocator; - GstVideoInfo alloc_info; + GstVideoInfo vmeta_vinfo; GstVaapiDisplay *display; guint options; guint use_dmabuf_memory:1; @@ -105,7 +105,7 @@ gst_vaapi_video_buffer_pool_get_property (GObject * object, guint prop_id, static void fill_video_alignment (GstVaapiVideoBufferPool * pool, GstVideoAlignment * align) { - GstVideoInfo *const vip = &pool->priv->alloc_info; + GstVideoInfo *const vip = &pool->priv->vmeta_vinfo; guint i; gst_video_alignment_reset (align); @@ -157,9 +157,9 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, if (!gst_buffer_pool_config_get_allocator (config, &allocator, NULL)) goto error_invalid_allocator; - if (gst_video_info_changed (&priv->video_info, &new_vip)) + if (gst_video_info_changed (&priv->allocation_vinfo, &new_vip)) gst_object_replace ((GstObject **) & priv->allocator, NULL); - priv->video_info = new_vip; + priv->allocation_vinfo = new_vip; { guint surface_alloc_flags; @@ -199,11 +199,12 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, alloc_vip = gst_allocator_get_vaapi_video_info (priv->allocator, NULL); if (!alloc_vip) goto error_create_allocator_info; - priv->alloc_info = *alloc_vip; + priv->vmeta_vinfo = *alloc_vip; } - if (GST_VIDEO_INFO_SIZE (&priv->alloc_info) != size) { + if (GST_VIDEO_INFO_SIZE (&priv->vmeta_vinfo) != size) { gst_buffer_pool_config_set_params (config, caps, - GST_VIDEO_INFO_SIZE (&priv->alloc_info), min_buffers, max_buffers); + GST_VIDEO_INFO_SIZE (&priv->vmeta_vinfo), min_buffers, + max_buffers); } } if (!priv->allocator) @@ -215,11 +216,11 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, 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)) { + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&priv->allocation_vinfo); i++) { + if (GST_VIDEO_INFO_PLANE_OFFSET (&priv->allocation_vinfo, i) != + GST_VIDEO_INFO_PLANE_OFFSET (&priv->vmeta_vinfo, i) || + GST_VIDEO_INFO_PLANE_STRIDE (&priv->allocation_vinfo, i) != + GST_VIDEO_INFO_PLANE_STRIDE (&priv->vmeta_vinfo, i)) { priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META; gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); @@ -327,7 +328,7 @@ gst_vaapi_video_buffer_pool_alloc_buffer (GstBufferPool * pool, gst_buffer_append_memory (buffer, mem); if (priv->options & GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META) { - GstVideoInfo *const vip = &priv->alloc_info; + GstVideoInfo *const vip = &priv->vmeta_vinfo; GstVideoMeta *vmeta; vmeta = gst_buffer_add_video_meta_full (buffer, 0, @@ -500,7 +501,7 @@ gst_vaapi_video_buffer_pool_init (GstVaapiVideoBufferPool * pool) pool->priv = priv; - gst_video_info_init (&priv->video_info); + gst_video_info_init (&priv->allocation_vinfo); } GstBufferPool *