[vlc-commits] wasapi: parse returned sample format (fixes #11174)
Rémi Denis-Courmont
git at videolan.org
Sat Jun 7 22:03:48 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 7 23:02:22 2014 +0300| [003af6b82000d46117581d87780c8be3dc87cf29] | committer: Rémi Denis-Courmont
wasapi: parse returned sample format (fixes #11174)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=003af6b82000d46117581d87780c8be3dc87cf29
---
modules/audio_output/wasapi.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 6b419c6..73e8160 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -287,10 +287,44 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict 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++)
if (wfe->dwChannelMask & chans_in[i])
audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
}
+ else
+ return -1;
audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio);
More information about the vlc-commits
mailing list