4 'gstmfaudiodecoder.cpp',
5 'gstmfaudioencoder.cpp',
11 'gstmfplatloader.cpp',
12 'gstmfsourceobject.cpp',
15 'gstmfvideobuffer.cpp',
16 'gstmfvideoencoder.cpp',
22 mf_desktop_sources = [
23 'gstmfsourcereader.cpp',
24 'gstwin32devicewatcher.cpp',
28 'gstmfcapturewinrt.cpp',
29 'mediacapturewrapper.cpp',
42 winapi_desktop = false
44 have_capture_engine = false
47 mf_config = configuration_data()
48 extra_c_args = ['-DCOBJMACROS']
51 mf_option = get_option('mediafoundation')
52 if host_system != 'windows' or mf_option.disabled()
56 if cc.get_id() != 'msvc'
57 if mf_option.enabled()
58 error('mediafoundation plugin can only be built with MSVC')
63 mf_lib = cc.find_library('mf', required : mf_option)
64 mfplat_lib = cc.find_library('mfplat', required : mf_option)
65 mfreadwrite_lib = cc.find_library('mfreadwrite', required : mf_option)
66 mfuuid_lib = cc.find_library('mfuuid', required : mf_option)
67 strmiids_lib = cc.find_library('strmiids', required : mf_option)
68 ole32_dep = cc.find_library('ole32', required : mf_option)
69 runtimeobject_lib = cc.find_library('runtimeobject', required : false)
71 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()
73 if mf_option.enabled()
74 error('The mediafoundation plugin was enabled explicitly, but required libraries were not found.')
79 mf_lib_deps += [mf_lib, mfplat_lib, mfreadwrite_lib, mfuuid_lib, strmiids_lib, ole32_dep]
82 foreach h: mf_header_deps
84 have_mf_header = cc.has_header(h)
89 if mf_option.enabled()
90 error('The mediafoundation plugin was enabled explicitly, but required headers were not found.')
95 winapi_desktop = cxx.compiles('''#include <winapifamily.h>
97 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
100 dependencies: mf_lib_deps,
101 name: 'building for Win32')
103 if runtimeobject_lib.found()
104 winapi_app = cxx.compiles('''#include <winapifamily.h>
105 #include <windows.applicationmodel.core.h>
107 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
111 #error "unknown minimum supported OS version"
113 #if (WINVER < 0x0A00)
114 #error "Windows 10 API is not guaranteed"
116 dependencies: [mf_lib_deps, runtimeobject_lib],
117 name: 'building for WinRT')
120 if not winapi_desktop and not winapi_app
121 error('Neither Desktop partition nor App partition')
125 if not gstwinrt_dep.found()
126 if mf_option.enabled()
127 error('The mediafoundation plugin was enabled explicitly, but GstWinRt library is unavailable')
133 mf_sources += mf_app_sources
134 mf_lib_deps += [runtimeobject_lib, gstwinrt_dep]
138 mf_sources += mf_desktop_sources
139 # We need d3d11_4.h header for querying "ExtendedNV12SharedTextureSupported"
140 # Since MFTEnum2 is desktop only we don't support d3d11 interop for UWP build
141 # And because MFTEnum2 is Windows 10 API, we will load MFTEnum2 symbol
142 # by using g_module_open() so that keep supporting old OS versions
143 if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
145 mf_lib_deps += [gstd3d11_dep]
146 extra_c_args += ['-DGST_USE_UNSTABLE_API']
147 extra_cpp_args += ['-DGST_USE_UNSTABLE_API']
148 message ('Enable D3D11 interop for MediaFoundation plugin')
152 mf_config.set10('GST_MF_WINAPI_APP', winapi_app)
153 mf_config.set10('GST_MF_WINAPI_DESKTOP', winapi_desktop)
154 mf_config.set10('GST_MF_HAVE_D3D11', have_mf_d3d11)
157 output: 'gstmfconfig.h',
158 configuration: mf_config,
161 # Work around for Windows SDK header issue
162 # https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues
163 extra_cpp_args += cxx.get_supported_arguments(['/Zc:twoPhase-'])
165 gstmediafoundation = library('gstmediafoundation',
167 c_args : gst_plugins_bad_args + extra_c_args,
168 cpp_args : gst_plugins_bad_args + extra_cpp_args,
169 include_directories : [configinc],
170 dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep, gmodule_dep] + mf_lib_deps,
172 install_dir : plugins_install_dir,
174 plugins += [gstmediafoundation]