mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
msdk: bufferpool: set alignment to video meta
else gst_video_meta_validate_alignment will report error like "videometa gstvideometa.c:416:gst_video_meta_validate_alignment: Stride of plane 0 defined in meta (384) is different from the one computed from the alignment (320)" Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1224>
This commit is contained in:
parent
0dfd05e574
commit
cab1ddf48b
1 changed files with 16 additions and 6 deletions
|
@ -54,6 +54,9 @@ struct _GstMsdkBufferPoolPrivate
|
||||||
mfxFrameAllocResponse *alloc_response;
|
mfxFrameAllocResponse *alloc_response;
|
||||||
GstMsdkMemoryType memory_type;
|
GstMsdkMemoryType memory_type;
|
||||||
gboolean add_videometa;
|
gboolean add_videometa;
|
||||||
|
gboolean need_alignment;
|
||||||
|
GstVideoAlignment alignment;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define gst_msdk_buffer_pool_parent_class parent_class
|
#define gst_msdk_buffer_pool_parent_class parent_class
|
||||||
|
@ -131,13 +134,13 @@ gst_msdk_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
priv->add_videometa = gst_buffer_pool_config_has_option (config,
|
priv->add_videometa = gst_buffer_pool_config_has_option (config,
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||||
|
|
||||||
if (priv->add_videometa && gst_buffer_pool_config_has_option (config,
|
priv->need_alignment = gst_buffer_pool_config_has_option (config,
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
|
||||||
GstVideoAlignment alignment;
|
|
||||||
|
|
||||||
gst_msdk_set_video_alignment (&video_info, 0, 0, &alignment);
|
if (priv->add_videometa && priv->need_alignment) {
|
||||||
gst_video_info_align (&video_info, &alignment);
|
gst_msdk_set_video_alignment (&video_info, 0, 0, &priv->alignment);
|
||||||
gst_buffer_pool_config_set_video_alignment (config, &alignment);
|
gst_video_info_align (&video_info, &priv->alignment);
|
||||||
|
gst_buffer_pool_config_set_video_alignment (config, &priv->alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->memory_type = _msdk_get_memory_type (config);
|
priv->memory_type = _msdk_get_memory_type (config);
|
||||||
|
@ -246,6 +249,13 @@ gst_msdk_buffer_pool_alloc_buffer (GstBufferPool * pool,
|
||||||
GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info),
|
GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info),
|
||||||
GST_VIDEO_INFO_N_PLANES (info), info->offset, info->stride);
|
GST_VIDEO_INFO_N_PLANES (info), info->offset, info->stride);
|
||||||
|
|
||||||
|
if (priv->need_alignment) {
|
||||||
|
if (!gst_video_meta_set_alignment (vmeta, priv->alignment)) {
|
||||||
|
GST_ERROR_OBJECT (pool, "failed to set alignment");
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->memory_type == GST_MSDK_MEMORY_TYPE_VIDEO) {
|
if (priv->memory_type == GST_MSDK_MEMORY_TYPE_VIDEO) {
|
||||||
vmeta->map = gst_video_meta_map_msdk_memory;
|
vmeta->map = gst_video_meta_map_msdk_memory;
|
||||||
vmeta->unmap = gst_video_meta_unmap_msdk_memory;
|
vmeta->unmap = gst_video_meta_unmap_msdk_memory;
|
||||||
|
|
Loading…
Reference in a new issue