summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-11-28 06:02:26 -0800
committerKevin Mitchell <kevmitch@gmail.com>2014-11-28 10:48:36 -0800
commit4f208e6f68690417163418f182023cc4136c7413 (patch)
tree158cb1d06e1ca89d39d6fe1e44419ed28d5d6385
parent239c880fe23fb8edf64315b54388275b7a9750ec (diff)
downloadmpv-4f208e6f68690417163418f182023cc4136c7413.tar.bz2
mpv-4f208e6f68690417163418f182023cc4136c7413.tar.xz
ao/wasapi: check full GUID of KSDATAFORMAT to determine float
-rwxr-xr-xaudio/out/ao_wasapi_utils.c16
-rwxr-xr-xaudio/out/ao_wasapi_utils.h1
2 files changed, 9 insertions, 8 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 818ab09205..441a3a04d5 100755
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -182,7 +182,7 @@ static void set_format(WAVEFORMATEXTENSIBLE *wformat, WORD bytepersample,
wformat->dwChannelMask = chanmask;
}
-static int format_set_bits(int old_format, int bits, int fp)
+static int format_set_bits(int old_format, int bits, bool fp)
{
if (fp) {
switch (bits) {
@@ -199,15 +199,15 @@ static int set_ao_format(struct ao *ao,
WAVEFORMATEXTENSIBLE wformat)
{
struct wasapi_state *state = (struct wasapi_state *)ao->priv;
- if (wformat.SubFormat.Data1 != 1 && wformat.SubFormat.Data1 != 3) {
- MP_ERR(ao, "Unknown SubFormat %"PRIu32"\n",
- (uint32_t)wformat.SubFormat.Data1);
+ bool is_float =
+ !mp_GUID_compare(&mp_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, &wformat.SubFormat);
+
+ if ( !is_float &&
+ mp_GUID_compare(&mp_KSDATAFORMAT_SUBTYPE_PCM, &wformat.SubFormat) ) {
+ MP_ERR(ao, "Unknown SubFormat %s\n", mp_GUID_to_str(&wformat.SubFormat));
return 0;
}
-
- // .Data1 == 1 is PCM, .Data1 == 3 is IEEE_FLOAT
- int format = format_set_bits(ao->format,
- wformat.Format.wBitsPerSample, wformat.SubFormat.Data1 == 3);
+ int format = format_set_bits(ao->format, wformat.Format.wBitsPerSample, is_float);
if (!format)
return 0;
diff --git a/audio/out/ao_wasapi_utils.h b/audio/out/ao_wasapi_utils.h
index 135b556d12..9d5a8c7edf 100755
--- a/audio/out/ao_wasapi_utils.h
+++ b/audio/out/ao_wasapi_utils.h
@@ -31,6 +31,7 @@ int mp_GUID_compare(const GUID *l, const GUID *r);
int mp_PKEY_compare(const PROPERTYKEY *l, const PROPERTYKEY *r);
char *mp_GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid);
char *mp_PKEY_to_str_buf(char *buf, size_t buf_size, const PROPERTYKEY *pkey);
+#define mp_GUID_to_str(guid) mp_GUID_to_str_buf((char[40]){0}, 40, (guid))
#define mp_PKEY_to_str(pkey) mp_PKEY_to_str_buf((char[42]){0}, 42, (pkey))
int wasapi_fill_VistaBlob(wasapi_state *state);