summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2013-07-21 21:28:17 -0300
committerwm4 <wm4@nowhere>2013-07-22 02:42:38 +0200
commit1b2dc3613fb940033f3f9e2ee29df6bb3884ee2c (patch)
tree20e4258a67047cd4a79f76ad7e6dc79f2989cc94 /audio
parent9fe277278070ca32b7b08bc29000d28777848266 (diff)
downloadmpv-1b2dc3613fb940033f3f9e2ee29df6bb3884ee2c.tar.bz2
mpv-1b2dc3613fb940033f3f9e2ee29df6bb3884ee2c.tar.xz
ao_wasapi: Fix S/PDIF passthrough init
MSDN tells me to multiply the samplerates by 4 (for setting up the S/PDIF signal frequency), but doesn't mention that I'm only supposed to do it on the new, NT6.1+ IEC 61937 structs. Works on my Realtek Digital Output, but as I can't connect any hardware to it I can't hear the result. Also, always ask for little-endian AC3. I'm not sure if this is supposed to be LE or NE, but Windows is LE on all platforms, so we go with LE.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 1a4ec04fff..d5a89ca587 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -399,8 +399,8 @@ static int try_passthrough(struct wasapi_state *state,
.Format = {
.wFormatTag = WAVE_FORMAT_EXTENSIBLE,
.nChannels = ao->channels.num,
- .nSamplesPerSec = ao->samplerate * 4,
- .nAvgBytesPerSec = (ao->samplerate * 4) * (ao->channels.num * 2),
+ .nSamplesPerSec = ao->samplerate,
+ .nAvgBytesPerSec = (ao->samplerate) * (ao->channels.num * 2),
.nBlockAlign = ao->channels.num * 2,
.wBitsPerSample = 16,
.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX),
@@ -416,13 +416,14 @@ static int try_passthrough(struct wasapi_state *state,
EnterCriticalSection(&state->print_lock);
mp_msg(MSGT_AO, MSGL_V, "ao-wasapi: trying passthrough for %s...\n",
- af_fmt2str_short(ao->format));
+ af_fmt2str_short((ao->format&~AF_FORMAT_END_MASK) | AF_FORMAT_LE));
LeaveCriticalSection(&state->print_lock);
HRESULT hr = IAudioClient_IsFormatSupported(state->pAudioClient,
state->share_mode,
u.ex, NULL);
if (!FAILED(hr)) {
+ ao->format = (ao->format&~AF_FORMAT_END_MASK) | AF_FORMAT_LE;
state->format = wformat;
return 1;
}