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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3322>
This commit is contained in:
He Junyan 2022-11-04 20:28:34 +08:00
parent 464650a5d0
commit 3875c420f7
2 changed files with 27 additions and 0 deletions

View file

@ -2127,3 +2127,28 @@ gst_va_buffer_get_aux_surface (GstBuffer * buffer)
return surface_buffer->surface;
}
/**
* gst_va_buffer_peek_display:
* @buffer: a #GstBuffer
*
* Returns: (type #GstVaDisplay) (transfer none): the display which this
* @buffer belongs to. The reference of the display is unchanged.
*
* Since: 1.22
*/
GstVaDisplay *
gst_va_buffer_peek_display (GstBuffer * buffer)
{
GstMemory *mem;
if (!buffer)
return NULL;
mem = gst_buffer_peek_memory (buffer, 0);
/* Buffer without mem, not VA kind memory. */
if (!mem)
return NULL;
return gst_va_memory_peek_display (mem);
}

View file

@ -132,5 +132,7 @@ GST_VA_API
gboolean gst_va_buffer_create_aux_surface (GstBuffer * buffer);
GST_VA_API
VASurfaceID gst_va_buffer_get_aux_surface (GstBuffer * buffer);
GST_VA_API
GstVaDisplay * gst_va_buffer_peek_display (GstBuffer * buffer);
G_END_DECLS