mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
gstvaapivideomemory: allocator's image size getter
Add the method gst_allocator_get_vaapi_image_size() for the GstVaapiVideoAllocator, which gets the size of the allocated images with the current video info. This method replaces the direct call to the allocator's image info when the pool is configured.
This commit is contained in:
parent
d0ee0b4e72
commit
892b6d3822
3 changed files with 31 additions and 3 deletions
|
@ -832,10 +832,8 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin,
|
|||
if (!pool) {
|
||||
if (!ensure_srcpad_allocator (plugin, &vi))
|
||||
goto error_create_allocator;
|
||||
|
||||
/* Update video size with allocator's image size */
|
||||
size = GST_VIDEO_INFO_SIZE (&GST_VAAPI_VIDEO_ALLOCATOR_CAST
|
||||
(plugin->srcpad_allocator)->image_info);
|
||||
gst_allocator_get_vaapi_image_size (plugin->srcpad_allocator, &size);
|
||||
pool = gst_vaapi_plugin_base_create_pool (plugin, caps, size, min, max,
|
||||
pool_options, plugin->srcpad_allocator);
|
||||
if (!pool)
|
||||
|
|
|
@ -1036,6 +1036,32 @@ gst_allocator_set_vaapi_video_info (GstAllocator * allocator,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_allocator_get_vaapi_image_size:
|
||||
* @allocator: a #GstAllocator instance.
|
||||
* @size: (out) (optional): the VA image size created by @allocator.
|
||||
*
|
||||
* This function gets the size of the VA images instantiated by the
|
||||
* @allocator.
|
||||
*
|
||||
* Returns: %TRUE if @allocator is VA valid
|
||||
**/
|
||||
gboolean
|
||||
gst_allocator_get_vaapi_image_size (GstAllocator * allocator, guint * size)
|
||||
{
|
||||
GstVaapiVideoAllocator *alloc;
|
||||
|
||||
g_return_val_if_fail (GST_IS_ALLOCATOR (allocator), FALSE);
|
||||
|
||||
if (g_strcmp0 (allocator->mem_type, GST_VAAPI_VIDEO_MEMORY_NAME))
|
||||
return FALSE;
|
||||
alloc = GST_VAAPI_VIDEO_ALLOCATOR_CAST (allocator);
|
||||
if (alloc && size)
|
||||
*size = GST_VIDEO_INFO_SIZE (&alloc->image_info);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_vaapi_is_dmabuf_allocator (GstAllocator * allocator)
|
||||
{
|
||||
|
|
|
@ -216,6 +216,10 @@ gboolean
|
|||
gst_allocator_set_vaapi_video_info (GstAllocator * allocator,
|
||||
const GstVideoInfo * vip, guint flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
gst_allocator_get_vaapi_image_size (GstAllocator * allocator, guint * size);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
gst_vaapi_is_dmabuf_allocator (GstAllocator * allocator);
|
||||
|
|
Loading…
Reference in a new issue