4 'gstmfaudiodecoder.cpp',
5 'gstmfaudioencoder.cpp',
11 'gstmfplatloader.cpp',
12 'gstmfsourceobject.cpp',
15 'gstmfvideobuffer.cpp',
16 'gstmfvideoencoder.cpp',
22 mf_desktop_sources = [
23 'gstmfcapturedshow.cpp',
24 'gstmfsourcereader.cpp',
25 'gstwin32devicewatcher.cpp',
29 'gstmfcapturewinrt.cpp',
30 'mediacapturewrapper.cpp',
43 winapi_desktop = false
45 have_capture_engine = false
48 mf_config = configuration_data()
49 extra_c_args = ['-DCOBJMACROS']
52 mf_option = get_option('mediafoundation')
53 if host_system != 'windows' or mf_option.disabled()
57 if cc.get_id() != 'msvc'
58 if mf_option.enabled()
59 error('mediafoundation plugin can only be built with MSVC')
64 mf_lib = cc.find_library('mf', required : mf_option)
65 mfplat_lib = cc.find_library('mfplat', required : mf_option)
66 mfreadwrite_lib = cc.find_library('mfreadwrite', required : mf_option)
67 mfuuid_lib = cc.find_library('mfuuid', required : mf_option)
68 strmiids_lib = cc.find_library('strmiids', required : mf_option)
69 ole32_dep = cc.find_library('ole32', required : mf_option)
70 runtimeobject_lib = cc.find_library('runtimeobject', required : false)
72 have_mf_lib = mf_lib.found() and mfplat_lib.found() and mfreadwrite_lib.found() and mfuuid_lib.found() and strmiids_lib.found() and ole32_dep.found()
74 if mf_option.enabled()
75 error('The mediafoundation plugin was enabled explicitly, but required libraries were not found.')
80 mf_lib_deps += [mf_lib, mfplat_lib, mfreadwrite_lib, mfuuid_lib, strmiids_lib, ole32_dep]
83 foreach h: mf_header_deps
85 have_mf_header = cc.has_header(h)
90 if mf_option.enabled()
91 error('The mediafoundation plugin was enabled explicitly, but required headers were not found.')
96 winapi_desktop = cxx.compiles('''#include <winapifamily.h>
98 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
101 dependencies: mf_lib_deps,
102 name: 'building for Win32')
104 if runtimeobject_lib.found()
105 winapi_app = cxx.compiles('''#include <winapifamily.h>
106 #include <windows.applicationmodel.core.h>
108 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
112 #error "unknown minimum supported OS version"
114 #if (WINVER < 0x0A00)
115 #error "Windows 10 API is not guaranteed"
117 dependencies: [mf_lib_deps, runtimeobject_lib],
118 name: 'building for WinRT')
121 if not winapi_desktop and not winapi_app
122 error('Neither Desktop partition nor App partition')
126 if not gstwinrt_dep.found()
127 if mf_option.enabled()
128 error('The mediafoundation plugin was enabled explicitly, but GstWinRt library is unavailable')
134 mf_sources += mf_app_sources
135 mf_lib_deps += [runtimeobject_lib, gstwinrt_dep]
139 mf_sources += mf_desktop_sources
140 # We need d3d11_4.h header for querying "ExtendedNV12SharedTextureSupported"
141 # Since MFTEnum2 is desktop only we don't support d3d11 interop for UWP build
142 # And because MFTEnum2 is Windows 10 API, we will load MFTEnum2 symbol
143 # by using g_module_open() so that keep supporting old OS versions
144 if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
146 mf_lib_deps += [gstd3d11_dep]
147 extra_c_args += ['-DGST_USE_UNSTABLE_API']
148 extra_cpp_args += ['-DGST_USE_UNSTABLE_API']
149 message ('Enable D3D11 interop for MediaFoundation plugin')
153 mf_config.set10('GST_MF_WINAPI_APP', winapi_app)
154 mf_config.set10('GST_MF_WINAPI_DESKTOP', winapi_desktop)
155 mf_config.set10('GST_MF_HAVE_D3D11', have_mf_d3d11)
158 output: 'gstmfconfig.h',
159 configuration: mf_config,
162 # Work around for Windows SDK header issue
163 # https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues
164 extra_cpp_args += cxx.get_supported_arguments(['/Zc:twoPhase-'])
166 gstmediafoundation = library('gstmediafoundation',
168 c_args : gst_plugins_bad_args + extra_c_args,
169 cpp_args : gst_plugins_bad_args + extra_cpp_args,
170 include_directories : [configinc],
171 dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep, gmodule_dep] + mf_lib_deps,
173 install_dir : plugins_install_dir,
175 plugins += [gstmediafoundation]