va: pool: Add gst_va_pool_new_with_config().
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 27 Jul 2021 11:03:37 +0000 (13:03 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 10 Aug 2021 17:31:58 +0000 (17:31 +0000)
It is a function helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>

sys/va/gstvapool.c
sys/va/gstvapool.h

index fb2fd0ca0e7a5fc08cfc78ceabb5ab183aa30800..42bfbfc7e00b4a219e5433b3a463f3c1e4d36870 100644 (file)
@@ -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;
+}
index af8416965bc8604beeb8423037863a380e2953b5..080168ab49f67762cf07db9d9e64da646679007e 100644 (file)
@@ -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