va: display: Add gst_va_display_has_vpp()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 4 Oct 2021 19:31:53 +0000 (21:31 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 10 Oct 2021 17:03:29 +0000 (17:03 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>

subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c
subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.h

index b9f970f..7593f9e 100644 (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;
+}
index 86e5a6d..2f9200b 100644 (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