2016-10-13 21:30:43 +00:00
|
|
|
msdk_sources = [
|
|
|
|
'gstmsdk.c',
|
2018-11-23 12:41:57 +00:00
|
|
|
'gstmsdkbufferpool.c',
|
2018-02-13 21:41:28 +00:00
|
|
|
'gstmsdkcontext.c',
|
2018-02-13 22:50:08 +00:00
|
|
|
'gstmsdkcontextutil.c',
|
2016-11-07 20:32:38 +00:00
|
|
|
'gstmsdkdec.c',
|
2018-11-23 12:41:57 +00:00
|
|
|
'gstmsdkdecproputil.c',
|
2016-10-13 21:30:43 +00:00
|
|
|
'gstmsdkenc.c',
|
2016-11-07 20:32:38 +00:00
|
|
|
'gstmsdkh264dec.c',
|
2016-10-13 21:30:43 +00:00
|
|
|
'gstmsdkh264enc.c',
|
2016-11-29 03:14:20 +00:00
|
|
|
'gstmsdkh265dec.c',
|
2016-10-13 21:30:43 +00:00
|
|
|
'gstmsdkh265enc.c',
|
2016-11-22 21:55:00 +00:00
|
|
|
'gstmsdkmjpegdec.c',
|
2016-10-05 22:32:43 +00:00
|
|
|
'gstmsdkmjpegenc.c',
|
2018-01-10 19:40:24 +00:00
|
|
|
'gstmsdkmpeg2dec.c',
|
2016-10-13 21:30:43 +00:00
|
|
|
'gstmsdkmpeg2enc.c',
|
2018-11-23 12:41:57 +00:00
|
|
|
'gstmsdksystemmemory.c',
|
|
|
|
'gstmsdkvc1dec.c',
|
|
|
|
'gstmsdkvideomemory.c',
|
2017-10-30 06:06:32 +00:00
|
|
|
'gstmsdkvp8dec.c',
|
2018-11-23 12:41:57 +00:00
|
|
|
'gstmsdkvpp.c',
|
2018-04-03 18:21:46 +00:00
|
|
|
'gstmsdkvpputil.c',
|
2018-11-23 12:41:57 +00:00
|
|
|
'msdk-enums.c',
|
|
|
|
'msdk.c',
|
|
|
|
]
|
|
|
|
|
2016-11-03 17:47:00 +00:00
|
|
|
if host_machine.system() == 'windows'
|
2018-02-13 22:54:03 +00:00
|
|
|
msdk_sources += ['msdk_d3d.c', 'gstmsdkallocator_d3d.c' ]
|
2016-11-03 17:47:00 +00:00
|
|
|
else
|
2018-02-13 21:43:42 +00:00
|
|
|
msdk_sources += ['msdk_libva.c', 'gstmsdkallocator_libva.c']
|
2016-11-03 17:47:00 +00:00
|
|
|
endif
|
|
|
|
|
2018-10-29 19:51:14 +00:00
|
|
|
have_msdk = false
|
|
|
|
msdk_dep = []
|
2021-02-18 05:38:25 +00:00
|
|
|
use_msdk = false
|
|
|
|
use_onevpl = false
|
2018-10-29 19:51:14 +00:00
|
|
|
|
2018-10-28 14:54:52 +00:00
|
|
|
msdk_option = get_option('msdk')
|
|
|
|
if msdk_option.disabled()
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2021-02-18 05:38:25 +00:00
|
|
|
mfx_api = get_option('mfx_api')
|
|
|
|
|
|
|
|
if mfx_api != 'oneVPL'
|
|
|
|
mfx_dep = dependency('libmfx', version: ['>= 1.0', '<= 1.99'], required: false)
|
|
|
|
|
|
|
|
if mfx_dep.found()
|
|
|
|
mfx_incdir = mfx_dep.get_pkgconfig_variable('includedir')
|
|
|
|
mfx_inc = []
|
|
|
|
use_msdk = true
|
|
|
|
else
|
|
|
|
# Old versions of MediaSDK don't provide a pkg-config file
|
|
|
|
mfx_root = run_command(python3, '-c', 'import os; print(os.environ.get("INTELMEDIASDKROOT", os.environ.get("MFX_HOME", "")))').stdout().strip()
|
2018-10-28 14:54:52 +00:00
|
|
|
|
2021-02-18 05:38:25 +00:00
|
|
|
if mfx_root != ''
|
|
|
|
mfx_libdir = [mfx_root + '/lib/lin_x64', mfx_root + '/lib/x64', mfx_root + '/lib64', mfx_root + '/lib']
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
if host_machine.cpu_family() == 'x86'
|
|
|
|
mfx_libdir = [mfx_root + '/lib/win32']
|
|
|
|
else
|
|
|
|
mfx_libdir = [mfx_root + '/lib/x64']
|
|
|
|
endif
|
2019-07-24 18:44:21 +00:00
|
|
|
endif
|
2021-02-18 05:38:25 +00:00
|
|
|
mfx_incdir = join_paths([mfx_root, 'include'])
|
|
|
|
mfx_lib = cxx.find_library('mfx', dirs: mfx_libdir, required: msdk_option)
|
|
|
|
mfx_inc = include_directories(mfx_incdir)
|
|
|
|
mfx_dep = declare_dependency(include_directories: mfx_inc, dependencies: mfx_lib)
|
|
|
|
use_msdk = true
|
2019-07-24 18:44:21 +00:00
|
|
|
endif
|
2021-02-18 05:38:25 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not use_msdk and mfx_api != 'MSDK'
|
|
|
|
mfx_dep = dependency('vpl', version: '>= 2.2', required: false)
|
|
|
|
|
|
|
|
if mfx_dep.found()
|
|
|
|
mfx_incdir = mfx_dep.get_pkgconfig_variable('includedir')
|
|
|
|
mfx_inc = []
|
|
|
|
use_onevpl = true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not use_msdk and not use_onevpl
|
|
|
|
if msdk_option.enabled()
|
|
|
|
error('msdk plugin enabled but the Intel Media SDK or the oneVPL SDK not found: consider setting PKG_CONFIG_PATH, INTELMEDIASDKROOT or MFX_HOME')
|
2016-11-03 17:47:00 +00:00
|
|
|
else
|
2019-01-08 12:30:29 +00:00
|
|
|
subdir_done()
|
2016-11-03 17:47:00 +00:00
|
|
|
endif
|
2019-01-08 12:30:29 +00:00
|
|
|
endif
|
2016-10-13 21:30:43 +00:00
|
|
|
|
2021-02-18 05:38:25 +00:00
|
|
|
# Check oneVPL firstly
|
|
|
|
if use_onevpl
|
|
|
|
mfx_incdir = join_paths([mfx_incdir, 'vpl'])
|
|
|
|
mfx_inc = include_directories(mfx_incdir)
|
|
|
|
elif cxx.has_header('mfx/mfxdefs.h', args: '-I' + mfx_incdir)
|
2019-01-08 12:36:09 +00:00
|
|
|
mfx_incdir = join_paths([mfx_incdir, 'mfx'])
|
2019-11-05 12:46:59 +00:00
|
|
|
mfx_inc = include_directories(mfx_incdir)
|
2019-01-08 12:30:29 +00:00
|
|
|
endif
|
|
|
|
|
2021-02-18 05:38:25 +00:00
|
|
|
if use_onevpl or cxx.has_header('mfxvp9.h', args: '-I' + mfx_incdir)
|
2019-01-08 12:33:44 +00:00
|
|
|
msdk_sources += [ 'gstmsdkvp9dec.c' ]
|
|
|
|
cdata.set10('USE_MSDK_VP9_DEC', 1)
|
|
|
|
endif
|
|
|
|
|
2020-02-12 03:23:18 +00:00
|
|
|
# Usually MFX_VERSION 1026+ is required to support raw VP9 stream, however Fedora 30 has MFX_VERSION==1026
|
|
|
|
# but without support for raw VP9 stream, so mfxExtVP9Param is checked as well.
|
|
|
|
# See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/988#note_408093
|
2020-01-15 08:02:11 +00:00
|
|
|
mfx_ver126_check_code = '''
|
|
|
|
#include <mfxdefs.h>
|
2020-02-12 03:23:18 +00:00
|
|
|
#include <mfxstructures.h>
|
2020-01-15 08:02:11 +00:00
|
|
|
#if MFX_VERSION < 1026
|
|
|
|
#error "The current version of mfx doesn't support raw vp9 stream"
|
2020-02-12 03:23:18 +00:00
|
|
|
#endif
|
|
|
|
mfxExtVP9Param ext;
|
2020-01-15 08:02:11 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
have_mfx_ver126 = cc.compiles(mfx_ver126_check_code,
|
|
|
|
include_directories : [configinc, mfx_inc])
|
|
|
|
|
|
|
|
if have_mfx_ver126
|
|
|
|
msdk_sources += [ 'gstmsdkvp9enc.c' ]
|
|
|
|
cdata.set10('USE_MSDK_VP9_ENC', 1)
|
|
|
|
endif
|
|
|
|
|
2020-07-20 02:13:13 +00:00
|
|
|
mfx_ver134_check_code = '''
|
|
|
|
#include <mfxdefs.h>
|
|
|
|
#if MFX_VERSION < 1034
|
|
|
|
#error "The current version of mfx doesn't support AV1 decoding"
|
|
|
|
#endif
|
|
|
|
'''
|
|
|
|
|
|
|
|
have_mfx_ver134 = cc.compiles(mfx_ver134_check_code,
|
|
|
|
include_directories : [configinc, mfx_inc])
|
|
|
|
|
|
|
|
if have_mfx_ver134
|
|
|
|
msdk_sources += [ 'gstmsdkav1dec.c' ]
|
|
|
|
cdata.set10('USE_MSDK_AV1_DEC', 1)
|
|
|
|
endif
|
|
|
|
|
2019-01-08 12:30:29 +00:00
|
|
|
if host_machine.system() == 'windows'
|
2019-01-19 18:23:56 +00:00
|
|
|
if cc.get_id() != 'msvc' and msdk_option.enabled()
|
|
|
|
error('msdk plugin can only be built with MSVC')
|
|
|
|
endif
|
|
|
|
legacy_stdio_dep = cc.find_library('legacy_stdio_definitions', required: get_option('msdk'))
|
|
|
|
d3d11_dep = cc.find_library('d3d11', required: get_option('msdk'))
|
2019-01-08 12:30:29 +00:00
|
|
|
msdk_deps = declare_dependency(dependencies: [d3d11_dep, legacy_stdio_dep])
|
|
|
|
msdk_deps_found = d3d11_dep.found() and legacy_stdio_dep.found() and cc.get_id() == 'msvc'
|
|
|
|
else
|
2021-06-16 17:23:37 +00:00
|
|
|
libva_dep = dependency('libva', required: get_option('msdk'))
|
|
|
|
libva_drm_dep = dependency('libva-drm', required: get_option('msdk'))
|
2019-01-19 18:23:56 +00:00
|
|
|
libdl_dep = cc.find_library('dl', required: get_option('msdk'))
|
|
|
|
libgudev_dep = dependency('gudev-1.0', required: get_option('msdk'))
|
2021-01-12 07:33:49 +00:00
|
|
|
libdrm_dep = dependency('libdrm', required: get_option('msdk'))
|
2021-06-16 17:23:37 +00:00
|
|
|
msdk_deps = declare_dependency(dependencies: [libva_dep, libva_drm_dep, libdl_dep, libgudev_dep, libdrm_dep])
|
|
|
|
msdk_deps_found = libva_dep.found() and libva_drm_dep.found() and libdl_dep.found() and libgudev_dep.found() and libdrm_dep.found()
|
|
|
|
driverdir = libva_dep.get_pkgconfig_variable('driverdir')
|
|
|
|
if driverdir == ''
|
|
|
|
driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
|
|
|
|
endif
|
|
|
|
cdata.set_quoted('VA_DRIVERS_PATH', '@0@'.format(driverdir))
|
2019-01-08 12:30:29 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if msdk_deps_found
|
|
|
|
gstmsdktag = library('gstmsdk',
|
|
|
|
msdk_sources,
|
2020-03-22 11:15:42 +00:00
|
|
|
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
|
2019-11-05 12:46:59 +00:00
|
|
|
include_directories : [configinc, mfx_inc],
|
2020-03-22 11:15:42 +00:00
|
|
|
dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, gstallocators_dep, gstcodecparsers_dep, mfx_dep, msdk_deps],
|
2019-01-08 12:30:29 +00:00
|
|
|
install : true,
|
|
|
|
install_dir : plugins_install_dir,
|
|
|
|
)
|
|
|
|
pkgconfig.generate(gstmsdktag, install_dir : plugins_pkgconfig_install_dir)
|
2018-10-22 09:30:45 +00:00
|
|
|
plugins += [gstmsdktag]
|
2019-01-08 12:30:29 +00:00
|
|
|
have_msdk = true
|
2016-10-13 21:30:43 +00:00
|
|
|
endif
|