va: libs: Add va_check_surface_has_status() helper function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4359>
This commit is contained in:
He Junyan 2023-04-06 19:39:04 +08:00 committed by Víctor Manuel Jáquez Leal
parent 933a155b1a
commit 2ec51dab7d
2 changed files with 28 additions and 0 deletions

View file

@ -383,6 +383,30 @@ va_check_surface (GstVaDisplay * display, VASurfaceID surface)
return (status == VA_STATUS_SUCCESS); return (status == VA_STATUS_SUCCESS);
} }
gboolean
va_check_surface_has_status (GstVaDisplay * display, VASurfaceID surface,
VASurfaceStatus surface_status)
{
VADisplay dpy = gst_va_display_get_va_dpy (display);
VAStatus status;
VASurfaceStatus state;
status = vaQuerySurfaceStatus (dpy, surface, &state);
if (status != VA_STATUS_SUCCESS) {
GST_ERROR ("vaQuerySurfaceStatus: %s", vaErrorStr (status));
return FALSE;
}
GST_LOG ("surface %#x status %d", surface, state);
/* Just query the surface, no flag to compare, we succeed. */
if (!surface_status)
return TRUE;
return ((state & surface_status) == surface_status);
}
gboolean gboolean
va_copy_surface (GstVaDisplay * display, VASurfaceID dst, VASurfaceID src) va_copy_surface (GstVaDisplay * display, VASurfaceID dst, VASurfaceID src)
{ {

View file

@ -51,6 +51,10 @@ gboolean va_sync_surface (GstVaDisplay * displa
GST_VA_API GST_VA_API
gboolean va_check_surface (GstVaDisplay * display, gboolean va_check_surface (GstVaDisplay * display,
VASurfaceID surface); VASurfaceID surface);
GST_VA_API
gboolean va_check_surface_has_status (GstVaDisplay * display,
VASurfaceID surface,
VASurfaceStatus surface_status);
gboolean va_copy_surface (GstVaDisplay * display, gboolean va_copy_surface (GstVaDisplay * display,
VASurfaceID dst, VASurfaceID dst,