Commit 003af6b8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

wasapi: parse returned sample format (fixes #11174)

parent 84b23f96
...@@ -287,10 +287,44 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf, ...@@ -287,10 +287,44 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
{ {
const WAVEFORMATEXTENSIBLE *wfe = (void *)wf; const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
{
switch (wf->wBitsPerSample)
{
case 64:
audio->i_format = VLC_CODEC_FL64;
break;
case 32:
audio->i_format = VLC_CODEC_FL32;
break;
default:
return -1;
}
}
else if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
{
switch (wf->wBitsPerSample)
{
case 32:
audio->i_format = VLC_CODEC_S32N;
break;
case 16:
audio->i_format = VLC_CODEC_S16N;
break;
default:
return -1;
}
}
if (wfe->Samples.wValidBitsPerSample != wf->wBitsPerSample)
return -1;
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];
} }
else
return -1;
audio->i_original_channels = audio->i_physical_channels; audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio); aout_FormatPrepare (audio);
......
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