examples: va: Update the VA examples because of the new va lib.
authorHe Junyan <junyan.he@intel.com>
Fri, 7 May 2021 09:05:38 +0000 (17:05 +0800)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 18 May 2021 10:15:36 +0000 (12:15 +0200)
Because we introduce the new va lib, the va examples need to include
new header files and add more library linkage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2196>

gst-libs/gst/va/meson.build
tests/examples/va/main.c
tests/examples/va/meson.build
tests/examples/va/multiple-vpp.c

index 9999fbd..2591819 100644 (file)
@@ -14,7 +14,6 @@ va_headers = [
 
 gstva_dep = dependency('', required : false)
 
-have_va = false
 va_option = get_option('va')
 if va_option.disabled() or host_system != 'linux'
   subdir_done()
@@ -27,8 +26,7 @@ libva_drm_dep = dependency('libva-drm', version: libva_req, required: va_option)
 libgudev_dep = dependency('gudev-1.0', required: va_option)
 libdrm_dep = dependency('libdrm', required: false, fallback: ['libdrm', 'ext_libdrm'])
 
-have_va = libva_dep.found() and libva_drm_dep.found()
-if not (have_va and libgudev_dep.found())
+if not (libva_dep.found() and libva_drm_dep.found() and libgudev_dep.found())
   if va_option.enabled()
     error('The va lib was enabled explicity, but required dependencies were not found.')
   endif
index db87e53..2ed42c0 100644 (file)
@@ -14,6 +14,7 @@
 #include <gst/gst.h>
 #include <gst/app/gstappsink.h>
 #include <gst/video/video.h>
+#include <gst/va/gstvadisplay.h>
 
 #include <va/va_x11.h>
 
@@ -44,11 +45,11 @@ context_handler (GstBus * bus, GstMessage * msg, gpointer data)
 
   gst_println ("got need context %s", context_type);
 
-  if (g_strcmp0 (context_type, "gst.va.display.handle") == 0) {
+  if (g_strcmp0 (context_type, GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR) == 0) {
     GstContext *context;
     GstStructure *s;
 
-    context = gst_context_new ("gst.va.display.handle", TRUE);
+    context = gst_context_new (GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR, TRUE);
     s = gst_context_writable_structure (context);
     gst_structure_set (s, "va-display", G_TYPE_POINTER, app->va_dpy, NULL);
     gst_element_set_context (GST_ELEMENT (msg->src), context);
index 5dc6020..4f50b3e 100644 (file)
@@ -1,4 +1,4 @@
-if not have_va
+if not gstva_dep.found()
   subdir_done()
 endif
 
@@ -7,12 +7,12 @@ gtk_x11_dep = dependency('gtk+-x11-3.0', required : get_option('examples'))
 x11_dep = dependency('x11', required : get_option('examples'))
 libva_x11_dep = dependency('libva-x11', version: libva_req, required: get_option('examples'))
 
-if have_va and gtk_dep.found() and gtk_x11_dep.found() and x11_dep.found() and libva_x11_dep.found()
+if gtk_dep.found() and gtk_x11_dep.found() and x11_dep.found() and libva_x11_dep.found()
   executable('va-x11-render',
     'main.c',
     install: false,
     include_directories : [configinc],
-    dependencies : [gtk_dep, gtk_x11_dep, x11_dep, gst_dep, gstapp_dep, gstvideo_dep, libva_dep, libva_x11_dep],
+    dependencies : [gtk_dep, gtk_x11_dep, x11_dep, gst_dep, gstapp_dep, gstvideo_dep, gstva_dep, libva_x11_dep],
     c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
   )
 endif
@@ -21,6 +21,6 @@ executable('multiple-vpp',
   'multiple-vpp.c',
   install: false,
   include_directories : [configinc],
-  dependencies : [gst_dep, gstvideo_dep, gstcontroller_dep],
+  dependencies : [gst_dep, gstvideo_dep, gstva_dep, gstcontroller_dep],
   c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
 )
index 65cbd54..2fb8673 100644 (file)
@@ -4,6 +4,7 @@
 #include <gst/video/video.h>
 #include <gst/controller/gstinterpolationcontrolsource.h>
 #include <gst/controller/gstdirectcontrolbinding.h>
+#include <gst/va/gstvadisplay.h>
 
 #define CHANGE_DIR_WITH_EVENT 0
 
@@ -53,7 +54,8 @@ context_handler (GstBus * bus, GstMessage * msg, gpointer data)
       if (context) {
         context_type = gst_context_get_context_type (context);
 
-        if (g_strcmp0 (context_type, "gst.va.display.handle") == 0) {
+        if (g_strcmp0 (context_type,
+                GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR) == 0) {
           const GstStructure *s = gst_context_get_structure (context);
           GstObject *display = NULL;
 
@@ -81,7 +83,7 @@ context_handler (GstBus * bus, GstMessage * msg, gpointer data)
     case GST_MESSAGE_NEED_CONTEXT:
       gst_message_parse_context_type (msg, &context_type);
 
-      if (g_strcmp0 (context_type, "gst.va.display.handle") == 0) {
+      if (g_strcmp0 (context_type, GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR) == 0) {
         GstContext *context;
         GstStructure *s;
 
@@ -96,7 +98,8 @@ context_handler (GstBus * bus, GstMessage * msg, gpointer data)
           return GST_BUS_DROP;
         }
 
-        context = gst_context_new ("gst.va.display.handle", TRUE);
+        context =
+            gst_context_new (GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR, TRUE);
         s = gst_context_writable_structure (context);
         gst_structure_set (s, "gst-display", GST_TYPE_OBJECT, app->display,
             NULL);