From 2added54c3bed73a9bdb5e1f013ad6ddcb1ba8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 27 Jul 2021 13:03:37 +0200 Subject: [PATCH] va: pool: Add gst_va_pool_new_with_config(). It is a function helper. Part-of: --- sys/va/gstvapool.c | 23 +++++++++++++++++++++++ sys/va/gstvapool.h | 9 +++++++++ 2 files changed, 32 insertions(+) diff --git a/sys/va/gstvapool.c b/sys/va/gstvapool.c index fb2fd0ca0e..42bfbfc7e0 100644 --- a/sys/va/gstvapool.c +++ b/sys/va/gstvapool.c @@ -343,3 +343,26 @@ gst_va_pool_requires_video_meta (GstBufferPool * pool) { return GST_VA_POOL (pool)->force_videometa; } + +GstBufferPool * +gst_va_pool_new_with_config (GstCaps * caps, guint size, guint min_buffers, + guint max_buffers, guint usage_hint, GstAllocator * allocator, + GstAllocationParams * alloc_params) +{ + GstBufferPool *pool; + GstStructure *config; + + pool = gst_va_pool_new (); + + config = gst_buffer_pool_get_config (pool); + gst_buffer_pool_config_set_params (config, caps, size, min_buffers, + max_buffers); + gst_buffer_pool_config_set_va_allocation_params (config, usage_hint); + gst_buffer_pool_config_set_allocator (config, allocator, alloc_params); + gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); + + if (!gst_buffer_pool_set_config (pool, config)) + gst_clear_object (&pool); + + return pool; +} diff --git a/sys/va/gstvapool.h b/sys/va/gstvapool.h index af8416965b..080168ab49 100644 --- a/sys/va/gstvapool.h +++ b/sys/va/gstvapool.h @@ -31,4 +31,13 @@ GstBufferPool * gst_va_pool_new (void); gboolean gst_va_pool_requires_video_meta (GstBufferPool * pool); void gst_buffer_pool_config_set_va_allocation_params (GstStructure * config, guint usage_hint); + +GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps, + guint size, + guint min_buffers, + guint max_buffers, + guint usage_hint, + GstAllocator * allocator, + GstAllocationParams * alloc_params); + G_END_DECLS