diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-28 02:25:18 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-28 10:48:36 -0800 |
commit | fb5d88a2873329fb263682006258bed45e920284 (patch) | |
tree | bfd8efce8825d93129385f94702d8be6a82a9535 /audio | |
parent | 81464780e92207f073a203e187aa20e96a6b1aa6 (diff) |
ao/wasapi: safely define PKEY constants
Before these definitions were incorrectly guarded by and #ifdef
but since they aren't macros, this would never be true so that
if they were ever added to mingw headers we would have problems.
rename KSDATAFORMAT constants with the same mp prefix for consistency.
also use DEFINE_GUID rather than defining the bare structure
Diffstat (limited to 'audio')
-rwxr-xr-x | audio/out/ao_wasapi_utils.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 55094cbdda..608d0afd18 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -35,22 +35,19 @@ #define MIXER_DEFAULT_LABEL L"mpv - video player" -#ifndef PKEY_Device_FriendlyName -DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, +DEFINE_PROPERTYKEY(mp_PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); -DEFINE_PROPERTYKEY(PKEY_Device_DeviceDesc, +DEFINE_PROPERTYKEY(mp_PKEY_Device_DeviceDesc, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2); -#endif -/* Supposed to use __uuidof, but it is C++ only, declare our own */ -static const GUID local_KSDATAFORMAT_SUBTYPE_PCM = { - 0x1, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} -}; -static const GUID local_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { - 0x3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} -}; +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); union WAVEFMT { WAVEFORMATEX *ex; @@ -139,9 +136,9 @@ static void set_format(WAVEFORMATEXTENSIBLE *wformat, WORD bytepersample, wformat->Format.cbSize = 22; /* must be at least 22 for WAVE_FORMAT_EXTENSIBLE */ if (bytepersample == 4) - wformat->SubFormat = local_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + wformat->SubFormat = mp_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; else - wformat->SubFormat = local_KSDATAFORMAT_SUBTYPE_PCM; + wformat->SubFormat = mp_KSDATAFORMAT_SUBTYPE_PCM; wformat->Samples.wValidBitsPerSample = wformat->Format.wBitsPerSample; wformat->dwChannelMask = chanmask; } @@ -284,7 +281,7 @@ static int try_passthrough(struct ao *ao) }, .Samples.wValidBitsPerSample = 16, .dwChannelMask = mp_chmap_to_waveext(&ao->channels), - .SubFormat = local_KSDATAFORMAT_SUBTYPE_PCM, + .SubFormat = mp_KSDATAFORMAT_SUBTYPE_PCM, }; wformat.SubFormat.Data1 = WAVE_FORMAT_DOLBY_AC3_SPDIF; // see INIT_WAVEFORMATEX_GUID macro @@ -599,7 +596,7 @@ static char* get_device_name(IMMDevice *pDevice) { PROPVARIANT devname; PropVariantInit(&devname); - hr = IPropertyStore_GetValue(pProps, &PKEY_Device_FriendlyName, &devname); + hr = IPropertyStore_GetValue(pProps, &mp_PKEY_Device_FriendlyName, &devname); EXIT_ON_ERROR(hr); namestr = mp_to_utf8(NULL, devname.pwszVal); @@ -624,7 +621,7 @@ static char* get_device_desc(IMMDevice *pDevice) { PROPVARIANT devdesc; PropVariantInit(&devdesc); - hr = IPropertyStore_GetValue(pProps, &PKEY_Device_DeviceDesc, &devdesc); + hr = IPropertyStore_GetValue(pProps, &mp_PKEY_Device_DeviceDesc, &devdesc); EXIT_ON_ERROR(hr); desc = mp_to_utf8(NULL, devdesc.pwszVal); |