va: display: Add gst_va_display_has_vpp()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-10-04 21:31:53 +02:00 committed by GStreamer Marge Bot
parent 7e9e17ebbe
commit 2947bd6ef1
2 changed files with 39 additions and 0 deletions

View file

@ -135,3 +135,41 @@ bail:
g_free (va_formats);
return ret;
}
gboolean
gst_va_display_has_vpp (GstVaDisplay * self)
{
VADisplay dpy;
VAEntrypoint *entrypoints;
VAStatus status;
int i, max, num;
gboolean found = FALSE;
g_return_val_if_fail (GST_IS_VA_DISPLAY (self), FALSE);
dpy = gst_va_display_get_va_dpy (self);
gst_va_display_lock (self);
max = vaMaxNumEntrypoints (dpy);
gst_va_display_unlock (self);
entrypoints = g_new (VAEntrypoint, max);
gst_va_display_lock (self);
status = vaQueryConfigEntrypoints (dpy, VAProfileNone, entrypoints, &num);
gst_va_display_unlock (self);
if (status != VA_STATUS_SUCCESS) {
GST_ERROR ("vaQueryImageFormats: %s", vaErrorStr (status));
goto bail;
}
for (i = 0; i < num; i++) {
if (entrypoints[i] == VAEntrypointVideoProc) {
found = TRUE;
break;
}
}
bail:
g_free (entrypoints);
return found;
}

View file

@ -28,5 +28,6 @@ GArray * gst_va_display_get_profiles (GstVaDisplay * self,
guint32 codec,
VAEntrypoint entrypoint);
GArray * gst_va_display_get_image_formats (GstVaDisplay * self);
gboolean gst_va_display_has_vpp (GstVaDisplay * self);
G_END_DECLS