1 /*****************************************************************************
2 * windows_audio_common.h: Windows Audio common code
3 *****************************************************************************
4 * Copyright (C) 2001-2013 VideoLAN
6 * Authors: Denis Charmet <typx@videolan.org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22 #ifndef DMX_WINDOWS_AUDIO_COMMONS_H
23 #define DMX_WINDOWS_AUDIO_COMMONS_H
26 #include <vlc_codecs.h>
28 static const uint32_t pi_channels_src
[] = { WAVE_SPEAKER_FRONT_LEFT
,
29 WAVE_SPEAKER_FRONT_RIGHT
, WAVE_SPEAKER_FRONT_CENTER
,
30 WAVE_SPEAKER_LOW_FREQUENCY
, WAVE_SPEAKER_BACK_LEFT
, WAVE_SPEAKER_BACK_RIGHT
,
31 WAVE_SPEAKER_BACK_CENTER
, WAVE_SPEAKER_SIDE_LEFT
, WAVE_SPEAKER_SIDE_RIGHT
, 0 };
33 static const uint32_t pi_channels_aout
[] = { AOUT_CHAN_LEFT
, AOUT_CHAN_RIGHT
,
34 AOUT_CHAN_CENTER
, AOUT_CHAN_LFE
, AOUT_CHAN_REARLEFT
, AOUT_CHAN_REARRIGHT
,
35 AOUT_CHAN_REARCENTER
, AOUT_CHAN_MIDDLELEFT
, AOUT_CHAN_MIDDLERIGHT
, 0 };
37 static inline unsigned getChannelMask( uint32_t * wvfextChannelMask
, int i_channels
, int * i_match
)
39 unsigned i_channel_mask
= 0;
42 i
< sizeof(pi_channels_src
)/sizeof(*pi_channels_src
) &&
43 *i_match
< i_channels
; i
++ )
45 if( *wvfextChannelMask
& pi_channels_src
[i
] )
47 if( !( i_channel_mask
& pi_channels_aout
[i
] ) )
50 *wvfextChannelMask
&= ~pi_channels_src
[i
];
51 i_channel_mask
|= pi_channels_aout
[i
];
54 return i_channel_mask
;
57 #endif /*DMX_WINDOWS_AUDIO_COMMONS_H*/