libs: va: Add API to peek the allocator's display.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3322>
This commit is contained in:
He Junyan 2022-11-04 17:06:37 +08:00
parent 028920cfc4
commit b1a98433f8
2 changed files with 26 additions and 0 deletions

View file

@ -1902,6 +1902,30 @@ gst_va_allocator_set_hacks (GstAllocator * allocator, guint32 hacks)
self->hacks = hacks;
}
/**
* gst_va_allocator_peek_display:
* @allocator: a #GstAllocator
*
* Returns: (type #GstVaDisplay) (transfer none): the display which this
* @allocator belongs to. The reference of the display is unchanged.
*
* Since: 1.22
*/
GstVaDisplay *
gst_va_allocator_peek_display (GstAllocator * allocator)
{
if (!allocator)
return NULL;
if (GST_IS_VA_DMABUF_ALLOCATOR (allocator)) {
return GST_VA_DMABUF_ALLOCATOR (allocator)->display;
} else if (GST_IS_VA_ALLOCATOR (allocator)) {
return GST_VA_ALLOCATOR (allocator)->display;
}
return NULL;
}
/*============ Utilities =====================================================*/
/**

View file

@ -118,6 +118,8 @@ gboolean gst_va_allocator_get_format (GstAllocator * alloca
GST_VA_API
void gst_va_allocator_set_hacks (GstAllocator * allocator,
guint32 hacks);
GST_VA_API
GstVaDisplay * gst_va_allocator_peek_display (GstAllocator * allocator);
GST_VA_API
VASurfaceID gst_va_memory_get_surface (GstMemory * mem);