10 'gstmfsourceobject.c',
15 'gstmfvideobuffer.cpp',
19 mf_desktop_sources = [
20 'gstmfsourcereader.cpp',
21 'gstwin32devicewatcher.cpp',
25 'gstmfcapturewinrt.cpp',
26 'mediacapturewrapper.cpp',
39 winapi_desktop = false
41 have_capture_engine = false
44 mf_config = configuration_data()
45 extra_c_args = ['-DCOBJMACROS']
48 mf_option = get_option('mediafoundation')
49 if host_system != 'windows' or mf_option.disabled()
53 if cc.get_id() != 'msvc'
54 if mf_option.enabled()
55 error('mediafoundation plugin can only be built with MSVC')
60 mf_lib = cc.find_library('mf', required : mf_option)
61 mfplat_lib = cc.find_library('mfplat', required : mf_option)
62 mfreadwrite_lib = cc.find_library('mfreadwrite', required : mf_option)
63 mfuuid_lib = cc.find_library('mfuuid', required : mf_option)
64 strmiids_lib = cc.find_library('strmiids', required : mf_option)
65 ole32_dep = cc.find_library('ole32', required : mf_option)
66 runtimeobject_lib = cc.find_library('runtimeobject', required : false)
68 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()
70 if mf_option.enabled()
71 error('The mediafoundation plugin was enabled explicitly, but required libraries were not found.')
76 mf_lib_deps += [mf_lib, mfplat_lib, mfreadwrite_lib, mfuuid_lib, strmiids_lib, ole32_dep]
79 foreach h: mf_header_deps
81 have_mf_header = cc.has_header(h)
86 if mf_option.enabled()
87 error('The mediafoundation plugin was enabled explicitly, but required headers were not found.')
92 winapi_desktop = cxx.compiles('''#include <winapifamily.h>
94 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
97 dependencies: mf_lib_deps,
98 name: 'building for Win32')
100 if runtimeobject_lib.found()
101 winapi_app = cxx.compiles('''#include <winapifamily.h>
102 #include <windows.applicationmodel.core.h>
104 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
108 #error "unknown minimum supported OS version"
110 #if (WINVER < 0x0A00)
111 #error "Windows 10 API is not guaranteed"
113 dependencies: [mf_lib_deps, runtimeobject_lib],
114 name: 'building for WinRT')
117 if not winapi_desktop and not winapi_app
118 error('Neither Desktop partition nor App partition')
122 if not gstwinrt_dep.found()
123 if mf_option.enabled()
124 error('The mediafoundation plugin was enabled explicitly, but GstWinRt library is unavailable')
130 mf_sources += mf_app_sources
131 mf_lib_deps += [runtimeobject_lib, gstwinrt_dep]
135 mf_sources += mf_desktop_sources
136 # We need d3d11_4.h header for querying "ExtendedNV12SharedTextureSupported"
137 # Since MFTEnum2 is desktop only we don't support d3d11 interop for UWP build
138 # And because MFTEnum2 is Windows 10 API, we will load MFTEnum2 symbol
139 # by using g_module_open() so that keep supporting old OS versions
140 if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
142 mf_lib_deps += [gstd3d11_dep, gmodule_dep]
143 extra_c_args += ['-DGST_USE_UNSTABLE_API']
144 extra_cpp_args += ['-DGST_USE_UNSTABLE_API']
145 message ('Enable D3D11 interop for MediaFoundation plugin')
149 mf_config.set10('GST_MF_WINAPI_APP', winapi_app)
150 mf_config.set10('GST_MF_WINAPI_DESKTOP', winapi_desktop)
151 mf_config.set10('GST_MF_HAVE_D3D11', have_mf_d3d11)
154 output: 'gstmfconfig.h',
155 configuration: mf_config,
158 gstmediafoundation = library('gstmediafoundation',
160 c_args : gst_plugins_bad_args + extra_c_args,
161 cpp_args : gst_plugins_bad_args + extra_cpp_args,
162 include_directories : [configinc],
163 dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep] + mf_lib_deps,
165 install_dir : plugins_install_dir,
167 pkgconfig.generate(gstmediafoundation, install_dir : plugins_pkgconfig_install_dir)
168 plugins += [gstmediafoundation]