wasapi: Don't redefine GUIDs when building under newer MinGW

Latest MSYS2 MinGW provides these now, so we don't need to define them
if they're already present in the header.

The AudioClient3 GUID requires the Windows 10 SDK, so it's only
available in the latest MinGW, and the MinGW in Cerbero is too old.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5155>
This commit is contained in:
Nirbheek Chauhan 2023-08-08 14:42:40 +01:00 committed by GStreamer Marge Bot
parent b7dcca4c98
commit 41b3443b95
2 changed files with 21 additions and 5 deletions

View file

@ -37,7 +37,8 @@ GST_DEBUG_CATEGORY_EXTERN (gst_wasapi_debug);
#include <functiondiscoverykeys_devpkey.h>
/* __uuidof is only available in C++, so we hard-code the GUID values for all
* these. This is ok because these are ABI. */
* these. This is ok because these are ABI. MSYS2 provides these in C. */
#ifndef HAVE_AUDCLNT_GUIDS
const CLSID CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,
{0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e}
};
@ -54,10 +55,6 @@ const IID IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,
{0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2}
};
const IID IID_IAudioClient3 = { 0x7ed4ee07, 0x8e67, 0x4cd4,
{0x8c, 0x1a, 0x2b, 0x7a, 0x59, 0x87, 0xad, 0x42}
};
const IID IID_IAudioClock = { 0xcd63314f, 0x3fba, 0x4a1b,
{0x81, 0x2c, 0xef, 0x96, 0x35, 0x87, 0x28, 0xe7}
};
@ -69,6 +66,13 @@ const IID IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,
const IID IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,
{0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2}
};
#endif
#ifndef HAVE_AUDCLNT3_GUID
const IID IID_IAudioClient3 = { 0x7ed4ee07, 0x8e67, 0x4cd4,
{0x8c, 0x1a, 0x2b, 0x7a, 0x59, 0x87, 0xad, 0x42}
};
#endif
/* Desktop only defines */
#ifndef KSAUDIO_SPEAKER_MONO

View file

@ -28,6 +28,18 @@ if ole32_dep.found() and ksuser_dep.found() and have_audioclient_h
wasapi_args += ['-DHAVE_AUDCLNT_STREAMOPTIONS']
endif
# MinGW defines some of these GUIDs in headers, whereas with MSVC we're
# expected to define them in the code. Check which ones we need to provide.
if cc.get_id() != 'msvc'
if cc.has_header_symbol('audioclient.h', 'IID_IAudioClient')
wasapi_args += ['-DHAVE_AUDCLNT_GUIDS']
endif
if cc.has_header_symbol('audioclient.h', 'IID_IAudioClient3')
wasapi_args += ['-DHAVE_AUDCLNT3_GUID']
endif
endif
gstwasapi = library('gstwasapi',
wasapi_sources,
c_args : gst_plugins_bad_args + wasapi_args,