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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2196>
This commit is contained in:
He Junyan 2021-05-07 17:05:38 +08:00 committed by Víctor Manuel Jáquez Leal
parent 031b77ce97
commit c335f00d62
4 changed files with 14 additions and 12 deletions

View 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

View 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);

View 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'],
)

View 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);