2019-10-07 12:49:26 +00:00
|
|
|
mf_sources = [
|
2022-01-26 17:20:37 +00:00
|
|
|
'gstmfaacdec.cpp',
|
2022-01-27 16:45:30 +00:00
|
|
|
'gstmfaacenc.cpp',
|
2022-01-26 17:20:37 +00:00
|
|
|
'gstmfaudiodecoder.cpp',
|
2022-01-27 16:45:30 +00:00
|
|
|
'gstmfaudioencoder.cpp',
|
|
|
|
'gstmfdevice.cpp',
|
2020-01-07 08:45:22 +00:00
|
|
|
'gstmfh264enc.cpp',
|
2020-01-07 08:12:17 +00:00
|
|
|
'gstmfh265enc.cpp',
|
2022-01-28 16:52:26 +00:00
|
|
|
'gstmfmp3dec.cpp',
|
2020-05-21 20:55:03 +00:00
|
|
|
'gstmfmp3enc.cpp',
|
2022-01-23 17:41:29 +00:00
|
|
|
'gstmfplatloader.cpp',
|
2022-01-27 16:45:30 +00:00
|
|
|
'gstmfsourceobject.cpp',
|
|
|
|
'gstmftransform.cpp',
|
|
|
|
'gstmfutils.cpp',
|
|
|
|
'gstmfvideobuffer.cpp',
|
|
|
|
'gstmfvideoencoder.cpp',
|
|
|
|
'gstmfvideosrc.cpp',
|
|
|
|
'gstmfvp9enc.cpp',
|
2022-01-23 17:41:29 +00:00
|
|
|
'plugin.cpp',
|
2020-01-07 08:45:22 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
mf_desktop_sources = [
|
2019-10-07 12:49:26 +00:00
|
|
|
'gstmfsourcereader.cpp',
|
2021-08-27 10:19:57 +00:00
|
|
|
'gstwin32devicewatcher.cpp',
|
2020-05-20 14:23:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
mf_app_sources = [
|
|
|
|
'gstmfcapturewinrt.cpp',
|
|
|
|
'mediacapturewrapper.cpp',
|
2019-10-07 12:49:26 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
mf_header_deps = [
|
|
|
|
'mfidl.h',
|
|
|
|
'mfapi.h',
|
|
|
|
'mfreadwrite.h',
|
|
|
|
'mferror.h',
|
|
|
|
'strmif.h',
|
|
|
|
'mfobjects.h',
|
2020-01-07 08:45:22 +00:00
|
|
|
'codecapi.h',
|
2019-10-07 12:49:26 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
winapi_desktop = false
|
2020-05-20 14:23:08 +00:00
|
|
|
winapi_app = false
|
2019-10-07 12:49:26 +00:00
|
|
|
have_capture_engine = false
|
2020-12-20 20:11:03 +00:00
|
|
|
have_mf_d3d11 = false
|
2019-10-07 12:49:26 +00:00
|
|
|
mf_lib_deps = []
|
|
|
|
mf_config = configuration_data()
|
2020-12-20 20:11:03 +00:00
|
|
|
extra_c_args = ['-DCOBJMACROS']
|
|
|
|
extra_cpp_args = []
|
2019-10-07 12:49:26 +00:00
|
|
|
|
|
|
|
mf_option = get_option('mediafoundation')
|
|
|
|
if host_system != 'windows' or mf_option.disabled()
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.get_id() != 'msvc'
|
|
|
|
if mf_option.enabled()
|
|
|
|
error('mediafoundation plugin can only be built with MSVC')
|
|
|
|
endif
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
mf_lib = cc.find_library('mf', required : mf_option)
|
|
|
|
mfplat_lib = cc.find_library('mfplat', required : mf_option)
|
|
|
|
mfreadwrite_lib = cc.find_library('mfreadwrite', required : mf_option)
|
|
|
|
mfuuid_lib = cc.find_library('mfuuid', required : mf_option)
|
|
|
|
strmiids_lib = cc.find_library('strmiids', required : mf_option)
|
2020-05-17 15:41:14 +00:00
|
|
|
ole32_dep = cc.find_library('ole32', required : mf_option)
|
2020-05-20 14:23:08 +00:00
|
|
|
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
|
2019-10-07 12:49:26 +00:00
|
|
|
|
2020-05-17 15:41:14 +00:00
|
|
|
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()
|
2019-10-07 12:49:26 +00:00
|
|
|
if not have_mf_lib
|
|
|
|
if mf_option.enabled()
|
|
|
|
error('The mediafoundation plugin was enabled explicitly, but required libraries were not found.')
|
|
|
|
endif
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2020-05-17 15:41:14 +00:00
|
|
|
mf_lib_deps += [mf_lib, mfplat_lib, mfreadwrite_lib, mfuuid_lib, strmiids_lib, ole32_dep]
|
2019-10-07 12:49:26 +00:00
|
|
|
|
|
|
|
have_mf_header = true
|
|
|
|
foreach h: mf_header_deps
|
|
|
|
if have_mf_header
|
|
|
|
have_mf_header = cc.has_header(h)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
if not have_mf_header
|
|
|
|
if mf_option.enabled()
|
|
|
|
error('The mediafoundation plugin was enabled explicitly, but required headers were not found.')
|
|
|
|
endif
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
winapi_desktop = cxx.compiles('''#include <winapifamily.h>
|
|
|
|
#include <wrl.h>
|
|
|
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
|
|
|
#error "not win32"
|
|
|
|
#endif''',
|
|
|
|
dependencies: mf_lib_deps,
|
2020-07-14 10:59:09 +00:00
|
|
|
name: 'building for Win32')
|
2019-10-07 12:49:26 +00:00
|
|
|
|
2020-05-20 14:23:08 +00:00
|
|
|
if runtimeobject_lib.found()
|
|
|
|
winapi_app = cxx.compiles('''#include <winapifamily.h>
|
|
|
|
#include <windows.applicationmodel.core.h>
|
|
|
|
#include <wrl.h>
|
|
|
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
|
|
#error "not winrt"
|
2020-07-14 10:59:09 +00:00
|
|
|
#endif
|
|
|
|
#ifndef WINVER
|
|
|
|
#error "unknown minimum supported OS version"
|
|
|
|
#endif
|
|
|
|
#if (WINVER < 0x0A00)
|
|
|
|
#error "Windows 10 API is not guaranteed"
|
2020-05-20 14:23:08 +00:00
|
|
|
#endif''',
|
|
|
|
dependencies: [mf_lib_deps, runtimeobject_lib],
|
2020-07-14 10:59:09 +00:00
|
|
|
name: 'building for WinRT')
|
2020-05-20 14:23:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if not winapi_desktop and not winapi_app
|
|
|
|
error('Neither Desktop partition nor App partition')
|
|
|
|
endif
|
|
|
|
|
2020-07-14 10:59:09 +00:00
|
|
|
if winapi_app
|
2021-08-27 10:19:57 +00:00
|
|
|
if not gstwinrt_dep.found()
|
|
|
|
if mf_option.enabled()
|
|
|
|
error('The mediafoundation plugin was enabled explicitly, but GstWinRt library is unavailable')
|
|
|
|
else
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-05-20 14:23:08 +00:00
|
|
|
mf_sources += mf_app_sources
|
2021-08-27 10:19:57 +00:00
|
|
|
mf_lib_deps += [runtimeobject_lib, gstwinrt_dep]
|
2020-07-14 10:59:09 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if winapi_desktop
|
2020-01-07 08:45:22 +00:00
|
|
|
mf_sources += mf_desktop_sources
|
2020-12-20 20:11:03 +00:00
|
|
|
# We need d3d11_4.h header for querying "ExtendedNV12SharedTextureSupported"
|
|
|
|
# Since MFTEnum2 is desktop only we don't support d3d11 interop for UWP build
|
|
|
|
# And because MFTEnum2 is Windows 10 API, we will load MFTEnum2 symbol
|
|
|
|
# by using g_module_open() so that keep supporting old OS versions
|
2021-03-20 07:26:21 +00:00
|
|
|
if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
|
2020-12-20 20:11:03 +00:00
|
|
|
have_mf_d3d11 = true
|
2021-10-20 16:47:07 +00:00
|
|
|
mf_lib_deps += [gstd3d11_dep]
|
2020-12-20 20:11:03 +00:00
|
|
|
extra_c_args += ['-DGST_USE_UNSTABLE_API']
|
|
|
|
extra_cpp_args += ['-DGST_USE_UNSTABLE_API']
|
|
|
|
message ('Enable D3D11 interop for MediaFoundation plugin')
|
|
|
|
endif
|
2019-10-07 12:49:26 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-14 10:59:09 +00:00
|
|
|
mf_config.set10('GST_MF_WINAPI_APP', winapi_app)
|
|
|
|
mf_config.set10('GST_MF_WINAPI_DESKTOP', winapi_desktop)
|
2020-12-20 20:11:03 +00:00
|
|
|
mf_config.set10('GST_MF_HAVE_D3D11', have_mf_d3d11)
|
2019-10-07 12:49:26 +00:00
|
|
|
|
|
|
|
configure_file(
|
|
|
|
output: 'gstmfconfig.h',
|
|
|
|
configuration: mf_config,
|
|
|
|
)
|
|
|
|
|
2021-10-16 13:43:32 +00:00
|
|
|
# Work around for Windows SDK header issue
|
|
|
|
# https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues
|
|
|
|
extra_cpp_args += cxx.get_supported_arguments(['/Zc:twoPhase-'])
|
|
|
|
|
2019-10-07 12:49:26 +00:00
|
|
|
gstmediafoundation = library('gstmediafoundation',
|
|
|
|
mf_sources,
|
2020-12-20 20:11:03 +00:00
|
|
|
c_args : gst_plugins_bad_args + extra_c_args,
|
|
|
|
cpp_args : gst_plugins_bad_args + extra_cpp_args,
|
2019-10-07 12:49:26 +00:00
|
|
|
include_directories : [configinc],
|
2021-10-20 16:47:07 +00:00
|
|
|
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep, gmodule_dep] + mf_lib_deps,
|
2019-10-07 12:49:26 +00:00
|
|
|
install : true,
|
|
|
|
install_dir : plugins_install_dir,
|
|
|
|
)
|
|
|
|
plugins += [gstmediafoundation]
|