va: pool: Add set_va_alignment() API.

We want to use gst_buffer_pool_config_set_va_alignment() to replace
gst_buffer_pool_config_get_video_alignment(). The later one is specific
for GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT option.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2282>
This commit is contained in:
He Junyan 2022-04-23 23:40:14 +08:00
parent 390ec99f1b
commit fd81cb2ad4
2 changed files with 26 additions and 0 deletions

View file

@ -80,6 +80,17 @@ gst_buffer_pool_config_get_va_allocation_params (GstStructure * config,
return TRUE; return TRUE;
} }
static inline gboolean
gst_buffer_pool_config_get_va_alignment (GstStructure * config,
GstVideoAlignment * align)
{
return gst_structure_get (config,
"va-padding-top", G_TYPE_UINT, &align->padding_top,
"va-padding-bottom", G_TYPE_UINT, &align->padding_bottom,
"va-padding-left", G_TYPE_UINT, &align->padding_left,
"va-padding-right", G_TYPE_UINT, &align->padding_right, NULL);
}
static gboolean static gboolean
gst_va_pool_set_config (GstBufferPool * pool, GstStructure * config) gst_va_pool_set_config (GstBufferPool * pool, GstStructure * config)
{ {
@ -354,6 +365,17 @@ gst_buffer_pool_config_set_va_allocation_params (GstStructure * config,
"use-derived", GST_TYPE_VA_FEATURE, use_derived, NULL); "use-derived", GST_TYPE_VA_FEATURE, use_derived, NULL);
} }
void
gst_buffer_pool_config_set_va_alignment (GstStructure * config,
const GstVideoAlignment * align)
{
gst_structure_set (config,
"va-padding-top", G_TYPE_UINT, align->padding_top,
"va-padding-bottom", G_TYPE_UINT, align->padding_bottom,
"va-padding-left", G_TYPE_UINT, align->padding_left,
"va-padding-right", G_TYPE_UINT, align->padding_right, NULL);
}
gboolean gboolean
gst_va_pool_requires_video_meta (GstBufferPool * pool) gst_va_pool_requires_video_meta (GstBufferPool * pool)
{ {

View file

@ -21,6 +21,7 @@
#pragma once #pragma once
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/va/gstva.h> #include <gst/va/gstva.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -43,6 +44,9 @@ void gst_buffer_pool_config_set_va_allocation_params (GstStructu
guint usage_hint, guint usage_hint,
GstVaFeature use_derived); GstVaFeature use_derived);
GST_VA_API GST_VA_API
void gst_buffer_pool_config_set_va_alignment (GstStructure * config,
const GstVideoAlignment * align);
GST_VA_API
GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps, GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps,
guint size, guint size,
guint min_buffers, guint min_buffers,