Commit 807a6c9a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

wasapi: fix channel order mask

parent b05a4450
...@@ -635,12 +635,12 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf, ...@@ -635,12 +635,12 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
audio_sample_format_t *restrict audio) audio_sample_format_t *restrict audio)
{ {
audio->i_rate = wf->nSamplesPerSec; audio->i_rate = wf->nSamplesPerSec;
audio->i_physical_channels = 0;
if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE) if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{ {
const WAVEFORMATEXTENSIBLE *wfe = (void *)wf; const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
audio->i_physical_channels = 0;
for (unsigned i = 0; chans_in[i]; i++) for (unsigned i = 0; chans_in[i]; i++)
if (wfe->dwChannelMask & chans_in[i]) if (wfe->dwChannelMask & chans_in[i])
audio->i_physical_channels |= pi_vlc_chan_order_wg4[i]; audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
...@@ -654,6 +654,20 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf, ...@@ -654,6 +654,20 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
return 0; return 0;
} }
static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
uint8_t *restrict table)
{
uint32_t mask = 0;
if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
mask = wfe->dwChannelMask;
}
return aout_CheckChannelReorder(chans_in, chans_out, mask, table);
}
static wchar_t *var_InheritWide(vlc_object_t *obj, const char *name) static wchar_t *var_InheritWide(vlc_object_t *obj, const char *name)
{ {
char *v8 = var_InheritString(obj, name); char *v8 = var_InheritString(obj, name);
...@@ -811,9 +825,8 @@ retry: ...@@ -811,9 +825,8 @@ retry:
else else
assert(pwf == NULL); assert(pwf == NULL);
sys->chans_to_reorder = aout_CheckChannelReorder(chans_in, chans_out, sys->chans_to_reorder = vlc_CheckWaveOrder((hr == S_OK) ? &wf.Format : pwf,
fmt->i_physical_channels, sys->chans_table);
sys->chans_table);
sys->bits = fmt->i_bitspersample; sys->bits = fmt->i_bitspersample;
hr = IAudioClient_Initialize(sys->client, AUDCLNT_SHAREMODE_SHARED, 0, hr = IAudioClient_Initialize(sys->client, AUDCLNT_SHAREMODE_SHARED, 0,
......
Markdown is supported
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