PulseAudio  16.0
channelmap.h
Go to the documentation of this file.
1 #ifndef foochannelmaphfoo
2 #define foochannelmaphfoo
3 
4 /***
5  This file is part of PulseAudio.
6 
7  Copyright 2005-2006 Lennart Poettering
8  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 
10  PulseAudio is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published
12  by the Free Software Foundation; either version 2.1 of the License,
13  or (at your option) any later version.
14 
15  PulseAudio is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
22 ***/
23 
24 #include <pulse/sample.h>
25 #include <pulse/cdecl.h>
26 #include <pulse/gccmacro.h>
27 #include <pulse/version.h>
28 
73 PA_C_DECL_BEGIN
74 
76 typedef enum pa_channel_position {
79 
85  PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT,
86  PA_CHANNEL_POSITION_RIGHT = PA_CHANNEL_POSITION_FRONT_RIGHT,
87  PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER,
96  PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
137 
150 
152 #define PA_CHANNEL_POSITION_INVALID PA_CHANNEL_POSITION_INVALID
153 #define PA_CHANNEL_POSITION_MONO PA_CHANNEL_POSITION_MONO
154 #define PA_CHANNEL_POSITION_LEFT PA_CHANNEL_POSITION_LEFT
155 #define PA_CHANNEL_POSITION_RIGHT PA_CHANNEL_POSITION_RIGHT
156 #define PA_CHANNEL_POSITION_CENTER PA_CHANNEL_POSITION_CENTER
157 #define PA_CHANNEL_POSITION_FRONT_LEFT PA_CHANNEL_POSITION_FRONT_LEFT
158 #define PA_CHANNEL_POSITION_FRONT_RIGHT PA_CHANNEL_POSITION_FRONT_RIGHT
159 #define PA_CHANNEL_POSITION_FRONT_CENTER PA_CHANNEL_POSITION_FRONT_CENTER
160 #define PA_CHANNEL_POSITION_REAR_CENTER PA_CHANNEL_POSITION_REAR_CENTER
161 #define PA_CHANNEL_POSITION_REAR_LEFT PA_CHANNEL_POSITION_REAR_LEFT
162 #define PA_CHANNEL_POSITION_REAR_RIGHT PA_CHANNEL_POSITION_REAR_RIGHT
163 #define PA_CHANNEL_POSITION_LFE PA_CHANNEL_POSITION_LFE
164 #define PA_CHANNEL_POSITION_SUBWOOFER PA_CHANNEL_POSITION_SUBWOOFER
165 #define PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
166 #define PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
167 #define PA_CHANNEL_POSITION_SIDE_LEFT PA_CHANNEL_POSITION_SIDE_LEFT
168 #define PA_CHANNEL_POSITION_SIDE_RIGHT PA_CHANNEL_POSITION_SIDE_RIGHT
169 #define PA_CHANNEL_POSITION_AUX0 PA_CHANNEL_POSITION_AUX0
170 #define PA_CHANNEL_POSITION_AUX1 PA_CHANNEL_POSITION_AUX1
171 #define PA_CHANNEL_POSITION_AUX2 PA_CHANNEL_POSITION_AUX2
172 #define PA_CHANNEL_POSITION_AUX3 PA_CHANNEL_POSITION_AUX3
173 #define PA_CHANNEL_POSITION_AUX4 PA_CHANNEL_POSITION_AUX4
174 #define PA_CHANNEL_POSITION_AUX5 PA_CHANNEL_POSITION_AUX5
175 #define PA_CHANNEL_POSITION_AUX6 PA_CHANNEL_POSITION_AUX6
176 #define PA_CHANNEL_POSITION_AUX7 PA_CHANNEL_POSITION_AUX7
177 #define PA_CHANNEL_POSITION_AUX8 PA_CHANNEL_POSITION_AUX8
178 #define PA_CHANNEL_POSITION_AUX9 PA_CHANNEL_POSITION_AUX9
179 #define PA_CHANNEL_POSITION_AUX10 PA_CHANNEL_POSITION_AUX10
180 #define PA_CHANNEL_POSITION_AUX11 PA_CHANNEL_POSITION_AUX11
181 #define PA_CHANNEL_POSITION_AUX12 PA_CHANNEL_POSITION_AUX12
182 #define PA_CHANNEL_POSITION_AUX13 PA_CHANNEL_POSITION_AUX13
183 #define PA_CHANNEL_POSITION_AUX14 PA_CHANNEL_POSITION_AUX14
184 #define PA_CHANNEL_POSITION_AUX15 PA_CHANNEL_POSITION_AUX15
185 #define PA_CHANNEL_POSITION_AUX16 PA_CHANNEL_POSITION_AUX16
186 #define PA_CHANNEL_POSITION_AUX17 PA_CHANNEL_POSITION_AUX17
187 #define PA_CHANNEL_POSITION_AUX18 PA_CHANNEL_POSITION_AUX18
188 #define PA_CHANNEL_POSITION_AUX19 PA_CHANNEL_POSITION_AUX19
189 #define PA_CHANNEL_POSITION_AUX20 PA_CHANNEL_POSITION_AUX20
190 #define PA_CHANNEL_POSITION_AUX21 PA_CHANNEL_POSITION_AUX21
191 #define PA_CHANNEL_POSITION_AUX22 PA_CHANNEL_POSITION_AUX22
192 #define PA_CHANNEL_POSITION_AUX23 PA_CHANNEL_POSITION_AUX23
193 #define PA_CHANNEL_POSITION_AUX24 PA_CHANNEL_POSITION_AUX24
194 #define PA_CHANNEL_POSITION_AUX25 PA_CHANNEL_POSITION_AUX25
195 #define PA_CHANNEL_POSITION_AUX26 PA_CHANNEL_POSITION_AUX26
196 #define PA_CHANNEL_POSITION_AUX27 PA_CHANNEL_POSITION_AUX27
197 #define PA_CHANNEL_POSITION_AUX28 PA_CHANNEL_POSITION_AUX28
198 #define PA_CHANNEL_POSITION_AUX29 PA_CHANNEL_POSITION_AUX29
199 #define PA_CHANNEL_POSITION_AUX30 PA_CHANNEL_POSITION_AUX30
200 #define PA_CHANNEL_POSITION_AUX31 PA_CHANNEL_POSITION_AUX31
201 #define PA_CHANNEL_POSITION_TOP_CENTER PA_CHANNEL_POSITION_TOP_CENTER
202 #define PA_CHANNEL_POSITION_TOP_FRONT_LEFT PA_CHANNEL_POSITION_TOP_FRONT_LEFT
203 #define PA_CHANNEL_POSITION_TOP_FRONT_RIGHT PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
204 #define PA_CHANNEL_POSITION_TOP_FRONT_CENTER PA_CHANNEL_POSITION_TOP_FRONT_CENTER
205 #define PA_CHANNEL_POSITION_TOP_REAR_LEFT PA_CHANNEL_POSITION_TOP_REAR_LEFT
206 #define PA_CHANNEL_POSITION_TOP_REAR_RIGHT PA_CHANNEL_POSITION_TOP_REAR_RIGHT
207 #define PA_CHANNEL_POSITION_TOP_REAR_CENTER PA_CHANNEL_POSITION_TOP_REAR_CENTER
208 #define PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
212 typedef uint64_t pa_channel_position_mask_t;
213 
215 #define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1ULL << (f)))
216 
218 typedef enum pa_channel_map_def {
223  PA_CHANNEL_MAP_ALSA,
237  PA_CHANNEL_MAP_OSS,
246 
250 
252 #define PA_CHANNEL_MAP_AIFF PA_CHANNEL_MAP_AIFF
253 #define PA_CHANNEL_MAP_ALSA PA_CHANNEL_MAP_ALSA
254 #define PA_CHANNEL_MAP_AUX PA_CHANNEL_MAP_AUX
255 #define PA_CHANNEL_MAP_WAVEEX PA_CHANNEL_MAP_WAVEEX
256 #define PA_CHANNEL_MAP_OSS PA_CHANNEL_MAP_OSS
257 #define PA_CHANNEL_MAP_DEF_MAX PA_CHANNEL_MAP_DEF_MAX
258 #define PA_CHANNEL_MAP_DEFAULT PA_CHANNEL_MAP_DEFAULT
264 typedef struct pa_channel_map {
265  uint8_t channels;
271 
276 
279 
282 
288 
294 
297 
300 
303 
309 #define PA_CHANNEL_MAP_SNPRINT_MAX 336
310 
312 char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map);
313 
319 
322 
325 
329 
332 
337 
342 
347 
353 
358 
362 
365 
366 PA_C_DECL_END
367 
368 #endif
int pa_channel_map_can_balance(const pa_channel_map *map) PA_GCC_PURE
Returns non-zero if it makes sense to apply a volume 'balance' with this mapping, i....
pa_channel_map * pa_channel_map_init_stereo(pa_channel_map *m)
Initialize the specified channel map for stereophonic audio and return a pointer to it.
const char * pa_channel_position_to_string(pa_channel_position_t pos) PA_GCC_PURE
Return a text label for the specified channel position.
pa_channel_map * pa_channel_map_init_extend(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def)
Similar to pa_channel_map_init_auto() but instead of failing if no default mapping is known with the ...
int pa_channel_map_can_fade(const pa_channel_map *map) PA_GCC_PURE
Returns non-zero if it makes sense to apply a volume 'fade' (i.e. 'balance' between front and rear) w...
int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE
Returns non-zero if every channel defined in b is also defined in a.
int pa_channel_map_compatible(const pa_channel_map *map, const pa_sample_spec *ss) PA_GCC_PURE
Return non-zero if the specified channel map is compatible with the specified sample spec.
struct pa_channel_map pa_channel_map
A channel map which can be used to attach labels to specific channels of a stream.
enum pa_channel_position pa_channel_position_t
A list of channel labels.
char * pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map)
Make a human readable string from the specified channel map.
int pa_channel_map_valid(const pa_channel_map *map) PA_GCC_PURE
Return non-zero if the specified channel map is considered valid.
int pa_channel_map_can_lfe_balance(const pa_channel_map *map) PA_GCC_PURE
Returns non-zero if it makes sense to apply a volume 'lfe balance' (i.e. 'balance' between LFE and no...
pa_channel_map_def
A list of channel mapping definitions for pa_channel_map_init_auto()
Definition: channelmap.h:218
@ PA_CHANNEL_MAP_DEFAULT
The default channel map.
Definition: channelmap.h:247
@ PA_CHANNEL_MAP_DEF_MAX
Upper limit of valid channel mapping definitions.
Definition: channelmap.h:245
@ PA_CHANNEL_MAP_AIFF
The mapping from RFC3551, which is based on AIFF-C.
Definition: channelmap.h:219
@ PA_CHANNEL_MAP_AUX
Only aux channels.
Definition: channelmap.h:229
@ PA_CHANNEL_MAP_WAVEEX
Microsoft's WAVEFORMATEXTENSIBLE mapping.
Definition: channelmap.h:232
pa_channel_map * pa_channel_map_parse(pa_channel_map *map, const char *s)
Parse a channel position list or well-known mapping name into a channel map structure.
uint64_t pa_channel_position_mask_t
A mask of channel positions.
Definition: channelmap.h:212
enum pa_channel_map_def pa_channel_map_def_t
A list of channel mapping definitions for pa_channel_map_init_auto()
int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE
Compare two channel maps.
pa_channel_position_mask_t pa_channel_map_mask(const pa_channel_map *map) PA_GCC_PURE
Generates a bit mask from a channel map.
int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE
Returns non-zero if the specified channel position is available at least once in the channel map.
const char * pa_channel_position_to_pretty_string(pa_channel_position_t pos)
Return a human readable text label for the specified channel position.
pa_channel_map * pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def)
Initialize the specified channel map for the specified number of channels using default labels and re...
pa_channel_map * pa_channel_map_init(pa_channel_map *m)
Initialize the specified channel map and return a pointer to it.
pa_channel_position_t pa_channel_position_from_string(const char *s) PA_GCC_PURE
The inverse of pa_channel_position_to_string().
const char * pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE
Tries to find a human readable text label for this channel mapping, i.e. "Stereo",...
const char * pa_channel_map_to_name(const pa_channel_map *map) PA_GCC_PURE
Tries to find a well-known channel mapping name for this channel mapping, i.e. "stereo",...
pa_channel_position
A list of channel labels.
Definition: channelmap.h:76
@ PA_CHANNEL_POSITION_AUX12
Definition: channelmap.h:117
@ PA_CHANNEL_POSITION_TOP_REAR_CENTER
Microsoft and Apple call this 'Top Back Center'.
Definition: channelmap.h:146
@ PA_CHANNEL_POSITION_AUX2
Definition: channelmap.h:107
@ PA_CHANNEL_POSITION_TOP_FRONT_CENTER
Apple calls this 'Vertical Height Center'.
Definition: channelmap.h:142
@ PA_CHANNEL_POSITION_AUX22
Definition: channelmap.h:127
@ PA_CHANNEL_POSITION_FRONT_LEFT
Apple, Dolby call this 'Left'.
Definition: channelmap.h:80
@ PA_CHANNEL_POSITION_AUX28
Definition: channelmap.h:133
@ PA_CHANNEL_POSITION_REAR_RIGHT
Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround ...
Definition: channelmap.h:92
@ PA_CHANNEL_POSITION_AUX30
Definition: channelmap.h:135
@ PA_CHANNEL_POSITION_AUX8
Definition: channelmap.h:113
@ PA_CHANNEL_POSITION_FRONT_RIGHT
Apple, Dolby call this 'Right'.
Definition: channelmap.h:81
@ PA_CHANNEL_POSITION_AUX20
Definition: channelmap.h:125
@ PA_CHANNEL_POSITION_AUX11
Definition: channelmap.h:116
@ PA_CHANNEL_POSITION_AUX7
Definition: channelmap.h:112
@ PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
Apple, Dolby call this 'Right Center.
Definition: channelmap.h:100
@ PA_CHANNEL_POSITION_INVALID
Definition: channelmap.h:77
@ PA_CHANNEL_POSITION_MAX
Definition: channelmap.h:148
@ PA_CHANNEL_POSITION_AUX27
Definition: channelmap.h:132
@ PA_CHANNEL_POSITION_AUX31
Definition: channelmap.h:136
@ PA_CHANNEL_POSITION_AUX17
Definition: channelmap.h:122
@ PA_CHANNEL_POSITION_AUX6
Definition: channelmap.h:111
@ PA_CHANNEL_POSITION_AUX25
Definition: channelmap.h:130
@ PA_CHANNEL_POSITION_SIDE_LEFT
Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!)
Definition: channelmap.h:102
@ PA_CHANNEL_POSITION_AUX23
Definition: channelmap.h:128
@ PA_CHANNEL_POSITION_TOP_REAR_RIGHT
Microsoft and Apple call this 'Top Back Right'.
Definition: channelmap.h:145
@ PA_CHANNEL_POSITION_TOP_REAR_LEFT
Microsoft and Apple call this 'Top Back Left'.
Definition: channelmap.h:144
@ PA_CHANNEL_POSITION_AUX19
Definition: channelmap.h:124
@ PA_CHANNEL_POSITION_FRONT_CENTER
Apple, Dolby call this 'Center'.
Definition: channelmap.h:82
@ PA_CHANNEL_POSITION_AUX21
Definition: channelmap.h:126
@ PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
Apple, Dolby call this 'Left Center'.
Definition: channelmap.h:99
@ PA_CHANNEL_POSITION_REAR_LEFT
Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Re...
Definition: channelmap.h:91
@ PA_CHANNEL_POSITION_SIDE_RIGHT
Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!)
Definition: channelmap.h:103
@ PA_CHANNEL_POSITION_AUX16
Definition: channelmap.h:121
@ PA_CHANNEL_POSITION_TOP_CENTER
Apple calls this 'Top Center Surround'.
Definition: channelmap.h:138
@ PA_CHANNEL_POSITION_AUX26
Definition: channelmap.h:131
@ PA_CHANNEL_POSITION_AUX4
Definition: channelmap.h:109
@ PA_CHANNEL_POSITION_AUX3
Definition: channelmap.h:108
@ PA_CHANNEL_POSITION_AUX29
Definition: channelmap.h:134
@ PA_CHANNEL_POSITION_MONO
Definition: channelmap.h:78
@ PA_CHANNEL_POSITION_LFE
Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen'.
Definition: channelmap.h:94
@ PA_CHANNEL_POSITION_REAR_CENTER
Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Re...
Definition: channelmap.h:90
@ PA_CHANNEL_POSITION_AUX0
Definition: channelmap.h:105
@ PA_CHANNEL_POSITION_AUX14
Definition: channelmap.h:119
@ PA_CHANNEL_POSITION_AUX1
Definition: channelmap.h:106
@ PA_CHANNEL_POSITION_TOP_FRONT_LEFT
Apple calls this 'Vertical Height Left'.
Definition: channelmap.h:140
@ PA_CHANNEL_POSITION_AUX18
Definition: channelmap.h:123
@ PA_CHANNEL_POSITION_AUX5
Definition: channelmap.h:110
@ PA_CHANNEL_POSITION_AUX10
Definition: channelmap.h:115
@ PA_CHANNEL_POSITION_AUX9
Definition: channelmap.h:114
@ PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
Apple calls this 'Vertical Height Right'.
Definition: channelmap.h:141
@ PA_CHANNEL_POSITION_AUX24
Definition: channelmap.h:129
@ PA_CHANNEL_POSITION_AUX13
Definition: channelmap.h:118
@ PA_CHANNEL_POSITION_AUX15
Definition: channelmap.h:120
pa_channel_map * pa_channel_map_init_mono(pa_channel_map *m)
Initialize the specified channel map for monaural audio and return a pointer to it.
GCC attribute macros.
#define PA_GCC_PURE
This function's return value depends only the arguments list and global state.
Definition: gccmacro.h:71
Constants and routines for sample type handling.
#define PA_CHANNELS_MAX
Maximum number of allowed channels.
Definition: sample.h:128
A channel map which can be used to attach labels to specific channels of a stream.
Definition: channelmap.h:264
pa_channel_position_t map[PA_CHANNELS_MAX]
Channel labels.
Definition: channelmap.h:268
uint8_t channels
Number of channels mapped.
Definition: channelmap.h:265
A sample format and attribute specification.
Definition: sample.h:252