5 'gstwasapi2client.cpp',
7 'gstwasapi2ringbuffer.cpp',
11 mmdeviceapi_symbols = [
12 'ActivateAudioInterfaceAsync',
13 'DEVINTERFACE_AUDIO_RENDER',
14 'DEVINTERFACE_AUDIO_CAPTURE',
17 wasapi2_option = get_option('wasapi2')
18 if host_system != 'windows'
19 if wasapi2_option.disabled()
21 elif wasapi2_option.enabled()
22 error('Cannot build wasapi2 plugin when not building for Windows')
26 ole32_dep = cc.find_library('ole32', required : get_option('wasapi2'))
27 ksuser_dep = cc.find_library('ksuser', required : get_option('wasapi2'))
28 runtimeobject_dep = cc.find_library('runtimeobject', required : get_option('wasapi2'))
29 mmdeviceapi_dep = cc.find_library('mmdevapi', required : get_option('wasapi2'))
30 mfplat_dep = cc.find_library('mfplat', required : get_option('wasapi2'))
31 wasapi2_dep = [ole32_dep, ksuser_dep, runtimeobject_dep, mmdeviceapi_dep, mfplat_dep]
32 extra_args = ['-DGST_USE_UNSTABLE_API']
34 foreach dep: wasapi2_dep
36 if wasapi2_option.enabled()
37 error('wasapi2 plugin was enabled explicitly, but required dependencies were not found')
44 if not cxx.has_header_symbol ('audioclient.h', 'IAudioClient3', dependencies : wasapi2_dep)
45 if wasapi2_option.enabled()
46 error('wasapi2 plugin was enabled explicitly, but IAudioClient3 is unavailable')
52 foreach symbol: mmdeviceapi_symbols
53 if not cxx.has_header_symbol ('mmdeviceapi.h', symbol, dependencies : wasapi2_dep)
54 if wasapi2_option.enabled()
55 error('wasapi2 plugin was enabled explicitly, but @1@ is unavailable'.format(symbol))
62 winapi_app = cxx.compiles('''#include <winapifamily.h>
63 #include <windows.applicationmodel.core.h>
65 #include <wrl/wrappers/corewrappers.h>
66 #include <audioclient.h>
67 #include <mmdeviceapi.h>
68 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
71 int main (int argc, char ** argv) {
72 IAudioClient3 *client = NULL;
75 dependencies: wasapi2_dep,
76 name: 'building for WINAPI_PARTITION_APP')
79 if wasapi2_option.enabled()
80 error('wasapi2 plugin was enabled explicitly, but build target is not include WINAPI_PARTITION_APP')
86 win10_sdk = cxx.compiles('''#include <windows.h>
87 #ifndef WDK_NTDDI_VERSION
88 #error "unknown Windows SDK version"
90 #if (WDK_NTDDI_VERSION < 0x0A000000)
91 #error "Not a Windows 10 SDK"
94 name: 'building with Windows 10 SDK')
97 if wasapi2_option.enabled()
98 error('wasapi2 plugin was enabled explicitly, but Windows 10 SDK is unavailable')
104 building_for_win10 = cxx.compiles('''#include <windows.h>
106 #error "unknown minimum supported OS version"
108 #if (WINVER < 0x0A00)
109 #error "Windows 10 API is not guaranteed"
112 name: 'building for Windows 10')
114 if not building_for_win10
115 message('Bumping target Windows version to Windows 10 for building wasapi2 plugin')
116 extra_args += ['-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
119 if not gstwinrt_dep.found()
120 if wasapi2_option.enabled()
121 error('wasapi2 plugin was enabled explicitly, but GstWinRt library is unavailable')
127 # Work around for Windows SDK header issue
128 # https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues
129 extra_cpp_args = cxx.get_supported_arguments(['/Zc:twoPhase-'])
131 gstwasapi2 = library('gstwasapi2',
133 c_args : gst_plugins_bad_args + ['-DCOBJMACROS'] + extra_args,
134 cpp_args : gst_plugins_bad_args + extra_args + extra_cpp_args,
135 include_directories : [configinc],
136 dependencies : [gstaudio_dep, gstwinrt_dep] + wasapi2_dep,
138 install_dir : plugins_install_dir)
139 pkgconfig.generate(gstwasapi2, install_dir : plugins_pkgconfig_install_dir)
140 plugins += [gstwasapi2]