0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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.
This commit is contained in:
Diogo Franco (Kovensky) 2013-07-21 21:28:17 -03:00 committed by wm4
parent 9fe2772780
commit 1b2dc3613f

View File

@ -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;
}