From 8a5e28251e3c784e9fe69dedec31763e9452e510 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 2 Apr 2017 14:55:55 +0800 Subject: [PATCH] Fix mingw build --- CMakeLists.txt | 2 +- src/recorder/wasapi_recorder.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1015cbc4..8d987b43b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ if (UNIX AND NOT APPLE) pkg_check_modules(VPX vpx) else() find_path(VPX_INCLUDEDIR NAMES vpx/vpx_codec.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include") - find_library(VPX_LIBRARIES NAMES vpxmt PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") + find_library(VPX_LIBRARIES NAMES vpxmt libvpx PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") endif() include_directories(${VPX_INCLUDEDIR}) diff --git a/src/recorder/wasapi_recorder.cpp b/src/recorder/wasapi_recorder.cpp index 96d615ad9..0e75beee6 100644 --- a/src/recorder/wasapi_recorder.cpp +++ b/src/recorder/wasapi_recorder.cpp @@ -30,6 +30,27 @@ #include #include +#if defined (__MINGW32__) || defined(__CYGWIN__) + #include "utils/types.hpp" + inline GUID uuidFromString(const char* s) + { + unsigned long p0; + unsigned int p1, p2, p3, p4, p5, p6, p7, p8, p9, p10; + sscanf_s(s, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", + &p0, &p1, &p2, &p3, &p4, &p5, &p6, &p7, &p8, &p9, &p10); + GUID g = { p0, (uint16_t)p1, (uint16_t)p2, { (uint8_t)p3, (uint8_t)p4, + (uint8_t)p5, (uint8_t)p6, (uint8_t)p7, (uint8_t)p8, (uint8_t)p9, + (uint8_t)p10 }}; + return g; + } + #undef KSDATAFORMAT_SUBTYPE_PCM + #define KSDATAFORMAT_SUBTYPE_PCM \ + uuidFromString("00000001-0000-0010-8000-00aa00389b71") + #undef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT + #define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT \ + uuidFromString("00000003-0000-0010-8000-00aa00389b71") +#endif + namespace Recorder { // ========================================================================