Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ if(EGE_ENABLE_CAMERA_CAPTURE)
target_link_libraries(xege PRIVATE Threads::Threads)
elseif(WIN32)
target_sources(xege PRIVATE ${EGE_CCAP_WINDOWS_SOURCES})
if(MINGW)
# mingw-w64 9.x 的 mfidl.h 缺少 MFCreateDeviceSource 声明(10.0.0 起才补齐),
# 但 mf.lib 一直导出该符号。编译器/运行时头文件补丁统一放在
# src/compiler_compat/<toolchain>/,这里只强制包含到实际用到它的 ccap MSMF 源文件。
set_source_files_properties(
"3rdparty/ccap/src/ccap_imp_windows_msmf.cpp"
PROPERTIES COMPILE_OPTIONS
"-include;${CMAKE_CURRENT_SOURCE_DIR}/src/compiler_compat/mingw-w64/mfidl_compat.h")
endif()
target_link_libraries(xege PRIVATE
mf mfplat mfreadwrite mfuuid shlwapi propsys)
target_compile_definitions(xege PRIVATE
Expand Down
22 changes: 22 additions & 0 deletions src/compiler_compat/mingw-w64/mfidl_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

/*
* mingw-w64 < 10.0.0 compatibility declarations for Media Foundation headers.
*
* mfidl.h in these toolchains does not declare MFCreateDeviceSource even though
* mf.lib exports it. The declaration was added to mfidl.idl in mingw-w64
* v10.0.0; older MinGW toolchains therefore need this build-time shim.
*
* This header is private to the build and is force-included only into ccap's
* Media Foundation translation unit. MSVC and newer mingw-w64 headers never
* see an active declaration here.
*/
#if defined(_WIN32) && defined(__MINGW32__) && \
(!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 10)

#include <mfapi.h>
#include <mfidl.h>

extern "C" HRESULT WINAPI MFCreateDeviceSource(IMFAttributes *pAttributes, IMFMediaSource **ppSource);

#endif
Loading