From c335f00d626eb8c83fea19d7fcbcd1b8e9157e5d Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 7 May 2021 17:05:38 +0800 Subject: [PATCH] examples: va: Update the VA examples because of the new va lib. Because we introduce the new va lib, the va examples need to include new header files and add more library linkage. Part-of: --- gst-libs/gst/va/meson.build | 4 +--- tests/examples/va/main.c | 5 +++-- tests/examples/va/meson.build | 8 ++++---- tests/examples/va/multiple-vpp.c | 9 ++++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gst-libs/gst/va/meson.build b/gst-libs/gst/va/meson.build index 9999fbd92c..2591819b06 100644 --- a/gst-libs/gst/va/meson.build +++ b/gst-libs/gst/va/meson.build @@ -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 diff --git a/tests/examples/va/main.c b/tests/examples/va/main.c index db87e530f1..2ed42c0ca9 100644 --- a/tests/examples/va/main.c +++ b/tests/examples/va/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -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); diff --git a/tests/examples/va/meson.build b/tests/examples/va/meson.build index 5dc602054a..4f50b3eb53 100644 --- a/tests/examples/va/meson.build +++ b/tests/examples/va/meson.build @@ -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'], ) diff --git a/tests/examples/va/multiple-vpp.c b/tests/examples/va/multiple-vpp.c index 65cbd54f49..2fb8673585 100644 --- a/tests/examples/va/multiple-vpp.c +++ b/tests/examples/va/multiple-vpp.c @@ -4,6 +4,7 @@ #include #include #include +#include #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);