From 36d1b2884955452676d9a01c0744f9ee1aeca6a1 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Fri, 27 Mar 2015 16:09:22 -0700 Subject: [PATCH] ao/wasapi: use built in KSDATAFORMATs Rather than defining them ourselves. Thanks to rossy for figuring out the headers. --- audio/out/ao_wasapi_utils.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 8d8fcb3e40..9e2ffe0dff 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -19,7 +19,9 @@ #include #include -#include +#include +#include +#include #include #include #include @@ -40,13 +42,6 @@ DEFINE_PROPERTYKEY(mp_PKEY_Device_DeviceDesc, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2); -DEFINE_GUID(mp_KSDATAFORMAT_SUBTYPE_PCM, - 0x00000001, 0x0000, 0x0010, 0x80, 0x00, - 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -DEFINE_GUID(mp_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, - 0x00000003, 0x0000, 0x0010, 0x80, 0x00, - 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); - char *mp_GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid) { snprintf(buf, buf_size, @@ -163,9 +158,9 @@ static void set_waveformat(WAVEFORMATEXTENSIBLE *wformat, wformat->Format.wBitsPerSample = bits; wformat->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); if (is_float) { - wformat->SubFormat = mp_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + wformat->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; } else { - wformat->SubFormat = mp_KSDATAFORMAT_SUBTYPE_PCM; + wformat->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; } wformat->Samples.wValidBitsPerSample = valid_bits; wformat->dwChannelMask = mp_chmap_to_waveext(channels); @@ -218,7 +213,7 @@ static bool waveformat_is_float(WAVEFORMATEX *wf) case WAVE_FORMAT_EXTENSIBLE: { WAVEFORMATEXTENSIBLE *wformat = (WAVEFORMATEXTENSIBLE *)wf; - return IsEqualGUID(&mp_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, &wformat->SubFormat); + return IsEqualGUID(&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, &wformat->SubFormat); } case WAVE_FORMAT_IEEE_FLOAT: return true; @@ -233,7 +228,7 @@ static bool waveformat_is_pcm_int(WAVEFORMATEX *wf) case WAVE_FORMAT_EXTENSIBLE: { WAVEFORMATEXTENSIBLE *wformat = (WAVEFORMATEXTENSIBLE *)wf; - return IsEqualGUID(&mp_KSDATAFORMAT_SUBTYPE_PCM, &wformat->SubFormat); + return IsEqualGUID(&KSDATAFORMAT_SUBTYPE_PCM, &wformat->SubFormat); } case WAVE_FORMAT_PCM: return true; @@ -551,7 +546,7 @@ static bool try_passthrough(struct ao *ao) }, .Samples.wValidBitsPerSample = 16, .dwChannelMask = mp_chmap_to_waveext(&ao->channels), - .SubFormat = mp_KSDATAFORMAT_SUBTYPE_PCM, + .SubFormat = KSDATAFORMAT_SUBTYPE_PCM, }; wformat.SubFormat.Data1 = WAVE_FORMAT_DOLBY_AC3_SPDIF; // see INIT_WAVEFORMATEX_GUID macro