5 'gstmsdkcontextutil.c',
7 'gstmsdkdecproputil.c',
17 'gstmsdksystemmemory.c',
19 'gstmsdkvideomemory.c',
32 msdk_option = get_option('msdk')
33 if msdk_option.disabled()
37 if host_machine.system() == 'windows'
38 msdk_sources += ['msdk_d3d.c', 'gstmsdkallocator_d3d.c' ]
40 if not gstva_dep.found()
41 if msdk_option.enabled()
42 error('The msdk plugin was enabled explicity, but required va dependencies were not found.')
46 msdk_sources += ['msdk_libva.c', 'gstmsdkallocator_libva.c', 'gstmsdk_va.c']
49 mfx_api = get_option('mfx_api')
51 if mfx_api != 'oneVPL'
52 mfx_dep = dependency('libmfx', version: ['>= 1.0', '<= 1.99'], required: false)
55 mfx_incdir = mfx_dep.get_variable('includedir')
59 # Old versions of MediaSDK don't provide a pkg-config file
60 mfx_root = run_command(python3, '-c', 'import os; print(os.environ.get("INTELMEDIASDKROOT", os.environ.get("MFX_HOME", "")))', check: false).stdout().strip()
63 mfx_libdir = [mfx_root + '/lib/lin_x64', mfx_root + '/lib/x64', mfx_root + '/lib64', mfx_root + '/lib']
64 if host_machine.system() == 'windows'
65 if host_machine.cpu_family() == 'x86'
66 mfx_libdir = [mfx_root + '/lib/win32']
68 mfx_libdir = [mfx_root + '/lib/x64']
71 mfx_incdir = join_paths([mfx_root, 'include'])
72 mfx_lib = cxx.find_library('mfx', dirs: mfx_libdir, required: msdk_option)
73 mfx_inc = include_directories(mfx_incdir)
74 mfx_dep = declare_dependency(include_directories: mfx_inc, dependencies: mfx_lib)
80 if not use_msdk and mfx_api != 'MSDK'
81 mfx_dep = dependency('vpl', version: '>= 2.2', required: false)
84 mfx_incdir = mfx_dep.get_variable('includedir')
90 if not use_msdk and not use_onevpl
91 if msdk_option.enabled()
92 error('msdk plugin enabled but the Intel Media SDK or the oneVPL SDK not found: consider setting PKG_CONFIG_PATH, INTELMEDIASDKROOT or MFX_HOME')
98 # Check oneVPL firstly
100 mfx_incdir = join_paths([mfx_incdir, 'vpl'])
101 mfx_inc = include_directories(mfx_incdir)
102 elif cxx.has_header('mfx/mfxdefs.h', args: '-I' + mfx_incdir)
103 mfx_incdir = join_paths([mfx_incdir, 'mfx'])
104 mfx_inc = include_directories(mfx_incdir)
107 if use_onevpl or cxx.has_header('mfxvp9.h', args: '-I' + mfx_incdir)
108 msdk_sources += [ 'gstmsdkvp9dec.c' ]
109 cdata.set10('USE_MSDK_VP9_DEC', 1)
112 # Usually MFX_VERSION 1026+ is required to support raw VP9 stream, however Fedora 30 has MFX_VERSION==1026
113 # but without support for raw VP9 stream, so mfxExtVP9Param is checked as well.
114 # See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/988#note_408093
115 mfx_ver126_check_code = '''
117 #include <mfxstructures.h>
118 #if MFX_VERSION < 1026
119 #error "The current version of mfx doesn't support raw vp9 stream"
124 have_mfx_ver126 = cc.compiles(mfx_ver126_check_code,
125 include_directories : [configinc, mfx_inc])
128 msdk_sources += [ 'gstmsdkvp9enc.c' ]
129 cdata.set10('USE_MSDK_VP9_ENC', 1)
132 mfx_ver134_check_code = '''
134 #if MFX_VERSION < 1034
135 #error "The current version of mfx doesn't support AV1 decoding"
139 have_mfx_ver134 = cc.compiles(mfx_ver134_check_code,
140 include_directories : [configinc, mfx_inc])
143 msdk_sources += [ 'gstmsdkav1dec.c' ]
144 cdata.set10('USE_MSDK_AV1_DEC', 1)
147 if host_machine.system() == 'windows'
148 if cc.get_id() != 'msvc' and msdk_option.enabled()
149 error('msdk plugin can only be built with MSVC')
151 legacy_stdio_dep = cc.find_library('legacy_stdio_definitions', required: get_option('msdk'))
152 d3d11_dep = cc.find_library('d3d11', required: get_option('msdk'))
153 msdk_deps = declare_dependency(dependencies: [d3d11_dep, legacy_stdio_dep])
154 msdk_deps_found = d3d11_dep.found() and legacy_stdio_dep.found() and cc.get_id() == 'msvc'
156 libdl_dep = cc.find_library('dl', required: get_option('msdk'))
157 libgudev_dep = dependency('gudev-1.0', required: get_option('msdk'))
158 libdrm_dep = dependency('libdrm', required: get_option('msdk'))
159 msdk_deps = declare_dependency(dependencies: [gstva_dep, libdl_dep, libgudev_dep, libdrm_dep])
160 msdk_deps_found = gstva_dep.found() and libdl_dep.found() and libgudev_dep.found() and libdrm_dep.found()
164 if host_machine.system() != 'windows'
165 driverdir = libva_dep.get_variable('driverdir', default_value: '')
167 driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
169 cdata.set_quoted('VA_DRIVERS_PATH', '@0@'.format(driverdir))
172 gstmsdktag = library('gstmsdk',
174 c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
175 include_directories : [configinc, mfx_inc],
176 dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, gstallocators_dep, gstcodecparsers_dep, mfx_dep, msdk_deps],
178 install_dir : plugins_install_dir,
180 pkgconfig.generate(gstmsdktag, install_dir : plugins_pkgconfig_install_dir)
181 plugins += [gstmsdktag]