vapluginsutils: add helper gst_va_create_other_pool()

This helper function creates a software-based buffer pool, where if size is
zero, its value is retrieved from the canonical size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-12-13 11:31:12 +01:00
parent 4a22cc8fb3
commit 1c7ce208bd
2 changed files with 31 additions and 0 deletions

View file

@ -73,3 +73,29 @@ gst_va_create_feature_name (GstVaDevice * device,
if (*rank > 0)
*rank -= 1;
}
GstBufferPool *
gst_va_create_other_pool (GstAllocator * allocator,
GstAllocationParams * params, GstCaps * caps, guint size)
{
GstBufferPool *pool = NULL;
GstStructure *config;
if (size == 0) {
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
return NULL;
size = GST_VIDEO_INFO_SIZE (&info);
}
pool = gst_video_buffer_pool_new ();
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
gst_buffer_pool_config_set_allocator (config, allocator, params);
if (!gst_buffer_pool_set_config (pool, config))
gst_clear_object (&pool);
return pool;
}

View file

@ -45,4 +45,9 @@ void gst_va_create_feature_name (GstVaDevice * device,
gchar ** desc,
guint * rank);
GstBufferPool * gst_va_create_other_pool (GstAllocator * allocator,
GstAllocationParams * params,
GstCaps * caps,
guint size);
G_END_DECLS