From 1b2dc3613fb940033f3f9e2ee29df6bb3884ee2c Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Sun, 21 Jul 2013 21:28:17 -0300 Subject: 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. --- audio/out/ao_wasapi.c | 7 ++++--- 1 file 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; } -- cgit v1.2.3