From fd81cb2ad444b8a2910cf6eb1d978f9c013cc2fd Mon Sep 17 00:00:00 2001 From: He Junyan Date: Sat, 23 Apr 2022 23:40:14 +0800 Subject: [PATCH] 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: --- .../gst-libs/gst/va/gstvapool.c | 22 +++++++++++++++++++ .../gst-libs/gst/va/gstvapool.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c index 792e2c5c8a..f14c8b675a 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c @@ -80,6 +80,17 @@ gst_buffer_pool_config_get_va_allocation_params (GstStructure * config, 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 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); } +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 gst_va_pool_requires_video_meta (GstBufferPool * pool) { diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h index 15313439f4..e204f46287 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include G_BEGIN_DECLS @@ -43,6 +44,9 @@ void gst_buffer_pool_config_set_va_allocation_params (GstStructu guint usage_hint, GstVaFeature use_derived); 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, guint size, guint min_buffers,