From 2947bd6ef119ba751bda2ba02b280c67f51b223d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 4 Oct 2021 21:31:53 +0200 Subject: [PATCH] va: display: Add gst_va_display_has_vpp() Part-of: --- .../sys/va/gstvadisplay_priv.c | 38 +++++++++++++++++++ .../sys/va/gstvadisplay_priv.h | 1 + 2 files changed, 39 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c index b9f970f9ad..7593f9efb7 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c @@ -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; +} diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.h b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.h index 86e5a6d514..2f9200b48e 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.h +++ b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.h @@ -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