Commit 3ffd20e6 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

wasapi: don't up-mix

parent 8a449a61
......@@ -367,15 +367,14 @@ static void vlc_ToWave(WAVEFORMATEXTENSIBLE *restrict wf,
wf->dwChannelMask |= chans_in[i];
}
static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
static int vlc_FromWave(WAVEFORMATEX *restrict wf,
audio_sample_format_t *restrict audio)
{
audio->i_rate = wf->nSamplesPerSec;
audio->i_physical_channels = 0;
if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
{
......@@ -409,18 +408,32 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
if (wfe->Samples.wValidBitsPerSample != wf->wBitsPerSample)
return -1;
for (unsigned i = 0; chans_in[i]; i++)
if (wfe->dwChannelMask & chans_in[i])
audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
if (wf->nChannels <= audio->i_channels)
{
/* VLC will downmix to match the modified format */
audio->i_physical_channels = 0;
for (unsigned i = 0; chans_in[i]; i++)
if (wfe->dwChannelMask & chans_in[i])
audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio);
if (wf->nChannels != audio->i_channels)
return -1;
}
else
{
/* Force the modified format channels to VLC one in order to avoid
* a useless up-mixing */
wfe->dwChannelMask = 0;
for (unsigned i = 0; pi_vlc_chan_order_wg4[i]; i++)
if (audio->i_physical_channels & pi_vlc_chan_order_wg4[i])
wfe->dwChannelMask |= chans_in[i];
wf->nChannels = audio->i_channels;
}
}
else
return -1;
audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio);
if (wf->nChannels != audio->i_channels)
return -1;
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment