[vlc-commits] wasapi: fix channel order mask
Rémi Denis-Courmont
git at videolan.org
Thu Nov 29 23:07:14 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 29 23:20:43 2012 +0200| [807a6c9a69ee4515b549f08b63459a1a72f422a2] | committer: Rémi Denis-Courmont
wasapi: fix channel order mask
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=807a6c9a69ee4515b549f08b63459a1a72f422a2
---
modules/audio_output/wasapi.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 41fe00b..1d1e46b 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -635,12 +635,12 @@ static int vlc_FromWave(const 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;
- 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];
@@ -654,6 +654,20 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
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)
{
char *v8 = var_InheritString(obj, name);
@@ -811,9 +825,8 @@ retry:
else
assert(pwf == NULL);
- sys->chans_to_reorder = aout_CheckChannelReorder(chans_in, chans_out,
- fmt->i_physical_channels,
- sys->chans_table);
+ sys->chans_to_reorder = vlc_CheckWaveOrder((hr == S_OK) ? &wf.Format : pwf,
+ sys->chans_table);
sys->bits = fmt->i_bitspersample;
hr = IAudioClient_Initialize(sys->client, AUDCLNT_SHAREMODE_SHARED, 0,
More information about the vlc-commits
mailing list