vaapi: add meson build

https://bugzilla.gnome.org/show_bug.cgi?id=778250
This commit is contained in:
Scott D Phillips 2017-02-06 15:46:20 -08:00 committed by Víctor Manuel Jáquez Leal
parent 3cc4eb7b81
commit 412dd13e86
8 changed files with 441 additions and 0 deletions

View file

@ -0,0 +1,22 @@
gstvaapi_baseutils_sources = [
'gstbitwriter.c',
]
gstvaapi_baseutils_headers = [
'gstbitwriter.h',
]
gstvaapi_baseutils_deps = [gstbase_dep]
gstvaapi_baseutils = static_library('gstvaapi-baseutils-@0@'.format(api_version),
gstvaapi_baseutils_sources,
c_args : gstreamer_vaapi_args,
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,
dependencies : gstvaapi_baseutils_deps,
)
gstvaapi_baseutils_dep = declare_dependency(link_with: gstvaapi_baseutils,
include_directories : [libsinc],
dependencies : gstvaapi_baseutils_deps)

2
gst-libs/gst/meson.build Normal file
View file

@ -0,0 +1,2 @@
subdir('base')
subdir('vaapi')

View file

@ -0,0 +1,229 @@
gstlibvaapi_sources = [
'gstvaapibufferproxy.c',
'gstvaapicodec_objects.c',
'gstvaapicontext.c',
'gstvaapicontext_overlay.c',
'gstvaapidecoder.c',
'gstvaapidecoder_dpb.c',
'gstvaapidecoder_h264.c',
'gstvaapidecoder_mpeg2.c',
'gstvaapidecoder_mpeg4.c',
'gstvaapidecoder_objects.c',
'gstvaapidecoder_unit.c',
'gstvaapidecoder_vc1.c',
'gstvaapidisplay.c',
'gstvaapidisplaycache.c',
'gstvaapifilter.c',
'gstvaapiimage.c',
'gstvaapiimagepool.c',
'gstvaapiminiobject.c',
'gstvaapiobject.c',
'gstvaapiparser_frame.c',
'gstvaapipixmap.c',
'gstvaapiprofile.c',
'gstvaapisubpicture.c',
'gstvaapisurface.c',
'gstvaapisurface_drm.c',
'gstvaapisurfacepool.c',
'gstvaapisurfaceproxy.c',
'gstvaapitexture.c',
'gstvaapitexturemap.c',
'gstvaapiutils.c',
'gstvaapiutils_core.c',
'gstvaapiutils_h264.c',
'gstvaapiutils_h265.c',
'gstvaapiutils_mpeg2.c',
'gstvaapivalue.c',
'gstvaapivideopool.c',
'gstvaapiwindow.c',
'video-format.c',
]
gstlibvaapi_headers = [
'gstvaapibufferproxy.h',
'gstvaapidecoder.h',
'gstvaapidecoder_h264.h',
'gstvaapidecoder_h265.h',
'gstvaapidecoder_mpeg2.h',
'gstvaapidecoder_mpeg4.h',
'gstvaapidecoder_vc1.h',
'gstvaapidisplay.h',
'gstvaapifilter.h',
'gstvaapiimage.h',
'gstvaapiimagepool.h',
'gstvaapiobject.h',
'gstvaapipixmap.h',
'gstvaapiprofile.h',
'gstvaapisubpicture.h',
'gstvaapisurface.h',
'gstvaapisurface_drm.h',
'gstvaapisurfacepool.h',
'gstvaapisurfaceproxy.h',
'gstvaapitexture.h',
'gstvaapitexturemap.h',
'gstvaapitypes.h',
'gstvaapiutils_h264.h',
'gstvaapiutils_h265.h',
'gstvaapiutils_mpeg2.h',
'gstvaapivalue.h',
'gstvaapivideopool.h',
'gstvaapiwindow.h',
'video-format.h',
]
if USE_JPEG_DECODER
gstlibvaapi_sources += 'gstvaapidecoder_jpeg.c'
gstlibvaapi_headers += 'gstvaapidecoder_jpeg.h'
endif
if USE_VP8_DECODER
gstlibvaapi_sources += 'gstvaapidecoder_vp8.c'
gstlibvaapi_headers += 'gstvaapidecoder_vp8.h'
endif
if USE_H265_DECODER
gstlibvaapi_sources += 'gstvaapidecoder_h265.c'
gstlibvaapi_headers += 'gstvaapidecoder_h265.h'
endif
if USE_VP9_DECODER
gstlibvaapi_sources += 'gstvaapidecoder_vp9.c'
gstlibvaapi_headers += 'gstvaapidecoder_vp9.h'
endif
if USE_ENCODERS
gstlibvaapi_sources += [
'gstvaapicodedbuffer.c',
'gstvaapicodedbufferpool.c',
'gstvaapicodedbufferproxy.c',
'gstvaapiencoder.c',
'gstvaapiencoder_h264.c',
'gstvaapiencoder_mpeg2.c',
'gstvaapiencoder_objects.c',
]
gstlibvaapi_headers += [
'gstvaapicodedbuffer.h',
'gstvaapicodedbufferpool.h',
'gstvaapicodedbufferproxy.h',
'gstvaapiencoder.h',
'gstvaapiencoder_h264.h',
'gstvaapiencoder_mpeg2.h',
]
endif
if USE_JPEG_ENCODER
gstlibvaapi_sources += 'gstvaapiencoder_jpeg.c'
gstlibvaapi_headers += 'gstvaapiencoder_jpeg.h'
endif
if USE_VP8_ENCODER
gstlibvaapi_sources += 'gstvaapiencoder_vp8.c'
gstlibvaapi_headers += 'gstvaapiencoder_vp8.h'
endif
if USE_H265_ENCODER
gstlibvaapi_sources += 'gstvaapiencoder_h265.c'
gstlibvaapi_headers += 'gstvaapiencoder_h265.h'
endif
if USE_VP9_ENCODER
gstlibvaapi_sources += 'gstvaapiencoder_vp9.c'
gstlibvaapi_headers += 'gstvaapiencoder_vp9.h'
endif
if USE_DRM
gstlibvaapi_sources += [
'gstvaapidisplay_drm.c',
'gstvaapiwindow_drm.c',
]
gstlibvaapi_headers += [
'gstvaapidisplay_drm.h',
'gstvaapiwindow_drm.h',
]
endif
if USE_X11
gstlibvaapi_sources += [
'gstvaapidisplay_x11.c',
'gstvaapipixmap_x11.c',
'gstvaapiutils_x11.c',
'gstvaapiwindow_x11.c',
]
gstlibvaapi_headers += [
'gstvaapidisplay_x11.h',
'gstvaapipixmap_x11.h',
'gstvaapiwindow_x11.h',
]
endif
if USE_GLX
gstlibvaapi_sources += [
'gstvaapidisplay_glx.c',
'gstvaapitexture_glx.c',
'gstvaapiutils_glx.c',
'gstvaapiwindow_glx.c',
]
gstlibvaapi_headers += [
'gstvaapidisplay_glx.h',
'gstvaapitexture.h',
'gstvaapitexture_glx.h',
'gstvaapiwindow_glx.h',
]
endif
if USE_EGL
gstlibvaapi_sources += [
'gstvaapidisplay_egl.c',
'gstvaapisurface_egl.c',
'gstvaapitexture_egl.c',
'gstvaapiutils_egl.c',
'gstvaapiwindow_egl.c',
]
gstlibvaapi_headers += [
'gstvaapidisplay_egl.h',
'gstvaapisurface_egl.h',
'gstvaapitexture_egl.h',
'gstvaapiwindow_egl.h',
]
endif
if USE_WAYLAND
gstlibvaapi_sources += [
'gstvaapidisplay_wayland.c',
'gstvaapiwindow_wayland.c',
]
gstlibvaapi_headers += [
'gstvaapidisplay_wayland.h',
'gstvaapiwindow_wayland.h',
]
endif
gstlibvaapi_deps = [gstbase_dep, gstvideo_dep, gstcodecparsers_dep, libva_dep, gstvaapi_baseutils_dep]
if USE_DRM
gstlibvaapi_deps += [libva_drm_dep, libdrm_dep, libudev_dep]
endif
if USE_EGL
gstlibvaapi_deps += [egl_dep, gmodule_dep]
endif
if USE_GLX
gstlibvaapi_deps += [libva_x11_dep, x11_dep, gl_dep, libdl_dep]
endif
if USE_WAYLAND
gstlibvaapi_deps += [libva_wayland_dep, wayland_client_dep]
endif
if USE_X11
gstlibvaapi_deps += [libva_x11_dep, x11_dep, xrandr_dep, xrender_dep]
endif
gstlibvaapi = static_library('gstlibvaapi-@0@'.format(api_version),
gstlibvaapi_sources,
c_args : gstreamer_vaapi_args + ['-DIN_LIBGSTVAAPI', '-DIN_LIBGSTVAAPI_CORE', '-DGST_USE_UNSTABLE_API', '-DGST_VAAPI_VERSION_ID="@0@"'.format(gst_version)],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,
dependencies : gstlibvaapi_deps,
)
gstlibvaapi_dep = declare_dependency(link_with: gstlibvaapi,
include_directories : [libsinc],
dependencies : gstlibvaapi_deps)

1
gst-libs/meson.build Normal file
View file

@ -0,0 +1 @@
subdir('gst')

1
gst/meson.build Normal file
View file

@ -0,0 +1 @@
subdir('vaapi')

51
gst/vaapi/meson.build Normal file
View file

@ -0,0 +1,51 @@
vaapi_sources = [
'gstvaapi.c',
'gstvaapidecode.c',
'gstvaapidecodedoc.c',
'gstvaapipluginbase.c',
'gstvaapipluginutil.c',
'gstvaapipostproc.c',
'gstvaapipostprocutil.c',
'gstvaapisink.c',
'gstvaapivideobuffer.c',
'gstvaapivideocontext.c',
'gstvaapivideometa.c',
'gstvaapidecodebin.c',
'gstvaapivideobufferpool.c',
'gstvaapivideomemory.c',
'gstvaapivideometa_texture.c',
]
if USE_ENCODERS
vaapi_sources += [
'gstvaapiencode.c',
'gstvaapiencode_h264.c',
'gstvaapiencode_mpeg2.c',
]
endif
if USE_JPEG_ENCODER
vaapi_sources += 'gstvaapiencode_jpeg.c'
endif
if USE_VP8_ENCODER
vaapi_sources += 'gstvaapiencode_vp8.c'
endif
if USE_H265_ENCODER
vaapi_sources += 'gstvaapiencode_h265.c'
endif
if USE_VP9_ENCODER
vaapi_sources += 'gstvaapiencode_vp9.c'
endif
gstvaapi = library('gstvaapi',
vaapi_sources,
c_args : gstreamer_vaapi_args + ['-DGST_USE_UNSTABLE_API'],
include_directories : [configinc, libsinc],
dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, gstpbutils_dep,
libva_dep, gstlibvaapi_dep, gstgl_dep, libm],
install : true,
install_dir : plugins_install_dir,
)

129
meson.build Normal file
View file

@ -0,0 +1,129 @@
project('gstreamer-vaapi', 'c',
version : '1.11.1.1',
meson_version : '>= 0.36.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
gst_version = meson.project_version()
version_arr = gst_version.split('.')
gst_version_major = version_arr[0]
gst_version_minor = version_arr[1]
gst_version_micro = version_arr[2]
if version_arr.length() == 4
gst_version_nano = version_arr[3]
else
gst_version_nano = 0
endif
glib_req = '>= 2.40.0'
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
# Mandatory GST deps
cc = meson.get_compiler('c')
libm = cc.find_library('m', required : false)
gst_dep = dependency('gstreamer-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_dep'])
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_base_dep'])
gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
fallback : ['gst-plugins-base', 'pbutils_dep'])
gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
fallback : ['gst-plugins-base', 'allocators_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
fallback : ['gst-plugins-base', 'video_dep'])
gstcodecparsers_dep = dependency('gstreamer-codecparsers-1.0', version : gst_req,
fallback : ['gst-plugins-bad', 'gstcodecparsers_dep'], required: false)
gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
fallback : ['gst-plugins-bad', 'gstgl_dep'], required: false)
gmodule_dep = dependency('gmodule-2.0', required: false)
libva_dep = dependency('libva', version: '>= 0.30.4')
libva_drm_dep = dependency('libva-drm', version: '>= 0.33.0', required: false)
libva_wayland_dep = dependency('libva-wayland', version: '>= 0.33.0', required: false)
libva_x11_dep = dependency('libva-x11', version: '>= 0.31.0', required: false)
libdrm_dep = dependency('libdrm', required: false)
libudev_dep = dependency('libudev', required: false)
egl_dep = dependency('egl', required: false)
gl_dep = dependency('gl', required: false)
glesv2_dep = dependency('glesv2', required: false)
glesv3_dep = dependency('glesv3', required: false)
libdl_dep = cc.find_library('dl', rqeuired: false)
wayland_client_dep = dependency('wayland-client', required: false)
x11_dep = dependency('x11', required: false)
xrandr_dep = dependency('xrandr', required: false)
xrender_dep = dependency('xrender', required: false)
GLES_VERSION_MASK = 0
GLES_VERSION_MASK += gl_dep.found() ? 1 : 0
GLES_VERSION_MASK += glesv2_dep.found() ? 4 : 0
GLES_VERSION_MASK += glesv3_dep.found() ? 8 : 0
USE_ENCODERS = libva_dep.version().version_compare('>= 0.34.0') and get_option('with_encoders') != 'no'
USE_H265_DECODER = cc.has_header('va/va_dec_hevc.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_H265_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_hevc.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_JPEG_DECODER = cc.has_header('va/va_dec_jpeg.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_JPEG_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_jpeg.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_VP8_DECODER = cc.has_header('va/va_dec_vp8.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_VP8_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_vp8.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_VP9_DECODER = cc.has_header('va/va_dec_vp9.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_VP9_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_vp9.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
USE_DRM = libva_drm_dep.found() and libdrm_dep.found() and libudev_dep.found() and get_option('with_drm') != 'no'
USE_EGL = gmodule_dep.found() and egl_dep.found() and GLES_VERSION_MASK != 0 and get_option('with_egl') != 'no'
USE_GLX = libva_x11_dep.found() and x11_dep.found() and gl_dep.found() and libdl_dep.found() and get_option('with_glx') != 'no'
USE_WAYLAND = libva_wayland_dep.found() and wayland_client_dep.found() and get_option('with_wayland') != 'no'
USE_X11 = libva_x11_dep.found() and x11_dep.found() and get_option('with_x11') != 'no'
cdata = configuration_data()
cdata.set('GST_API_VERSION_S', '"@0@.@1@"'.format(gst_version_major, gst_version_minor))
cdata.set('PACKAGE', '"gstreamer-vaapi"')
cdata.set('VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE_NAME', '"GStreamer VA-API Plug-ins"')
cdata.set('PACKAGE_STRING', '"GStreamer VA-API Plug-ins @0@"'.format(gst_version))
cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
cdata.set10('USE_DRM', USE_DRM)
cdata.set10('USE_EGL', USE_EGL)
cdata.set10('USE_ENCODERS', USE_ENCODERS)
cdata.set10('USE_GLX', USE_GLX)
cdata.set10('USE_H265_DECODER', USE_H265_DECODER)
cdata.set10('USE_H265_ENCODER', USE_H265_ENCODER)
cdata.set10('USE_JPEG_DECODER', USE_JPEG_DECODER)
cdata.set10('USE_JPEG_ENCODER', USE_JPEG_ENCODER)
cdata.set10('USE_VP8_DECODER', USE_VP8_DECODER)
cdata.set10('USE_VP8_ENCODER', USE_VP8_ENCODER)
cdata.set10('USE_VP9_DECODER', USE_VP9_DECODER)
cdata.set10('USE_VP9_ENCODER', USE_VP9_ENCODER)
cdata.set10('USE_WAYLAND', USE_WAYLAND)
cdata.set10('USE_X11', USE_X11)
cdata.set10('HAVE_XKBLIB', cc.has_header('X11/XKBlib.h', dependencies: x11_dep))
cdata.set10('HAVE_XRANDR', xrandr_dep.found())
cdata.set10('HAVE_XRENDER', xrender_dep.found())
cdata.set10('USE_VA_VPP', true)
cdata.set10('USE_GST_GL_HELPERS', gstgl_dep.found())
cdata.set('GLES_VERSION_MASK', GLES_VERSION_MASK)
runcmd = run_command('pkg-config', '--variable=driverdir', 'libva')
if runcmd.returncode() == 0
cdata.set('VA_DRIVERS_PATH', '"@0@"'.format(runcmd.stdout().strip()))
endif
api_version = '1.0'
soversion = 0
# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro
libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
configure_file(configuration: cdata, output: 'config.h')
gstreamer_vaapi_args = ['-DHAVE_CONFIG_H']
configinc = include_directories('.')
libsinc = include_directories('gst-libs')
subdir('gst-libs')
subdir('gst')
#subdir('tests')
python3 = find_program('python3')
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')

6
meson_options.txt Normal file
View file

@ -0,0 +1,6 @@
option('with_encoders', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_drm', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_x11', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_glx', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_wayland', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_egl', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')