Skip to content

Commit 55c72a8

Browse files
committed
Camera (Windows): fix Windows Server Core compatibility
1 parent b602bb2 commit 55c72a8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,6 @@ elseif(WIN32)
944944
PRIVATE "dwmapi"
945945
PRIVATE "gdi32"
946946
PRIVATE "iphlpapi"
947-
PRIVATE "mf"
948-
PRIVATE "mfplat"
949947
PRIVATE "ole32"
950948
PRIVATE "oleaut32"
951949
PRIVATE "ws2_32"

src/detection/camera/camera_windows.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ struct on_scope_exit {
2121
extern "C"
2222
const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
2323
{
24-
// TODO: check if supported by Windows Server Core
24+
FF_LIBRARY_LOAD(mfplat, NULL, "dlopen mfplat" FF_LIBRARY_EXTENSION " failed", "mfplat" FF_LIBRARY_EXTENSION, 1)
25+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(mfplat, MFCreateAttributes)
26+
FF_LIBRARY_LOAD(mf, NULL, "dlopen mf" FF_LIBRARY_EXTENSION " failed", "mf" FF_LIBRARY_EXTENSION, 1)
27+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(mf, MFEnumDeviceSources)
2528

2629
const char* error = ffInitCom();
2730
if (error)
2831
return error;
2932

3033
IMFAttributes* FF_AUTO_RELEASE_COM_OBJECT attrs = nullptr;
31-
if (FAILED(MFCreateAttributes(&attrs, 1)))
34+
if (FAILED(ffMFCreateAttributes(&attrs, 1)))
3235
return "MFCreateAttributes() failed";
3336

3437
if (FAILED(attrs->SetGUID(
@@ -40,7 +43,7 @@ const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
4043
IMFActivate** devices = NULL;
4144
uint32_t count;
4245

43-
if (FAILED(MFEnumDeviceSources(attrs, &devices, &count)))
46+
if (FAILED(ffMFEnumDeviceSources(attrs, &devices, &count)))
4447
return "MFEnumDeviceSources() failed";
4548

4649
for (uint32_t i = 0; i < count; i++)

0 commit comments

Comments
 (0)