PulseAudio  6.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 
71 PA_C_DECL_BEGIN
72 
74 typedef enum pa_channel_position {
77 
83  PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT,
84  PA_CHANNEL_POSITION_RIGHT = PA_CHANNEL_POSITION_FRONT_RIGHT,
85  PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER,
94  PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
135 
148 
150 #define PA_CHANNEL_POSITION_INVALID PA_CHANNEL_POSITION_INVALID
151 #define PA_CHANNEL_POSITION_MONO PA_CHANNEL_POSITION_MONO
152 #define PA_CHANNEL_POSITION_LEFT PA_CHANNEL_POSITION_LEFT
153 #define PA_CHANNEL_POSITION_RIGHT PA_CHANNEL_POSITION_RIGHT
154 #define PA_CHANNEL_POSITION_CENTER PA_CHANNEL_POSITION_CENTER
155 #define PA_CHANNEL_POSITION_FRONT_LEFT PA_CHANNEL_POSITION_FRONT_LEFT
156 #define PA_CHANNEL_POSITION_FRONT_RIGHT PA_CHANNEL_POSITION_FRONT_RIGHT
157 #define PA_CHANNEL_POSITION_FRONT_CENTER PA_CHANNEL_POSITION_FRONT_CENTER
158 #define PA_CHANNEL_POSITION_REAR_CENTER PA_CHANNEL_POSITION_REAR_CENTER
159 #define PA_CHANNEL_POSITION_REAR_LEFT PA_CHANNEL_POSITION_REAR_LEFT
160 #define PA_CHANNEL_POSITION_REAR_RIGHT PA_CHANNEL_POSITION_REAR_RIGHT
161 #define PA_CHANNEL_POSITION_LFE PA_CHANNEL_POSITION_LFE
162 #define PA_CHANNEL_POSITION_SUBWOOFER PA_CHANNEL_POSITION_SUBWOOFER
163 #define PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
164 #define PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
165 #define PA_CHANNEL_POSITION_SIDE_LEFT PA_CHANNEL_POSITION_SIDE_LEFT
166 #define PA_CHANNEL_POSITION_SIDE_RIGHT PA_CHANNEL_POSITION_SIDE_RIGHT
167 #define PA_CHANNEL_POSITION_AUX0 PA_CHANNEL_POSITION_AUX0
168 #define PA_CHANNEL_POSITION_AUX1 PA_CHANNEL_POSITION_AUX1
169 #define PA_CHANNEL_POSITION_AUX2 PA_CHANNEL_POSITION_AUX2
170 #define PA_CHANNEL_POSITION_AUX3 PA_CHANNEL_POSITION_AUX3
171 #define PA_CHANNEL_POSITION_AUX4 PA_CHANNEL_POSITION_AUX4
172 #define PA_CHANNEL_POSITION_AUX5 PA_CHANNEL_POSITION_AUX5
173 #define PA_CHANNEL_POSITION_AUX6 PA_CHANNEL_POSITION_AUX6
174 #define PA_CHANNEL_POSITION_AUX7 PA_CHANNEL_POSITION_AUX7
175 #define PA_CHANNEL_POSITION_AUX8 PA_CHANNEL_POSITION_AUX8
176 #define PA_CHANNEL_POSITION_AUX9 PA_CHANNEL_POSITION_AUX9
177 #define PA_CHANNEL_POSITION_AUX10 PA_CHANNEL_POSITION_AUX10
178 #define PA_CHANNEL_POSITION_AUX11 PA_CHANNEL_POSITION_AUX11
179 #define PA_CHANNEL_POSITION_AUX12 PA_CHANNEL_POSITION_AUX12
180 #define PA_CHANNEL_POSITION_AUX13 PA_CHANNEL_POSITION_AUX13
181 #define PA_CHANNEL_POSITION_AUX14 PA_CHANNEL_POSITION_AUX14
182 #define PA_CHANNEL_POSITION_AUX15 PA_CHANNEL_POSITION_AUX15
183 #define PA_CHANNEL_POSITION_AUX16 PA_CHANNEL_POSITION_AUX16
184 #define PA_CHANNEL_POSITION_AUX17 PA_CHANNEL_POSITION_AUX17
185 #define PA_CHANNEL_POSITION_AUX18 PA_CHANNEL_POSITION_AUX18
186 #define PA_CHANNEL_POSITION_AUX19 PA_CHANNEL_POSITION_AUX19
187 #define PA_CHANNEL_POSITION_AUX20 PA_CHANNEL_POSITION_AUX20
188 #define PA_CHANNEL_POSITION_AUX21 PA_CHANNEL_POSITION_AUX21
189 #define PA_CHANNEL_POSITION_AUX22 PA_CHANNEL_POSITION_AUX22
190 #define PA_CHANNEL_POSITION_AUX23 PA_CHANNEL_POSITION_AUX23
191 #define PA_CHANNEL_POSITION_AUX24 PA_CHANNEL_POSITION_AUX24
192 #define PA_CHANNEL_POSITION_AUX25 PA_CHANNEL_POSITION_AUX25
193 #define PA_CHANNEL_POSITION_AUX26 PA_CHANNEL_POSITION_AUX26
194 #define PA_CHANNEL_POSITION_AUX27 PA_CHANNEL_POSITION_AUX27
195 #define PA_CHANNEL_POSITION_AUX28 PA_CHANNEL_POSITION_AUX28
196 #define PA_CHANNEL_POSITION_AUX29 PA_CHANNEL_POSITION_AUX29
197 #define PA_CHANNEL_POSITION_AUX30 PA_CHANNEL_POSITION_AUX30
198 #define PA_CHANNEL_POSITION_AUX31 PA_CHANNEL_POSITION_AUX31
199 #define PA_CHANNEL_POSITION_TOP_CENTER PA_CHANNEL_POSITION_TOP_CENTER
200 #define PA_CHANNEL_POSITION_TOP_FRONT_LEFT PA_CHANNEL_POSITION_TOP_FRONT_LEFT
201 #define PA_CHANNEL_POSITION_TOP_FRONT_RIGHT PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
202 #define PA_CHANNEL_POSITION_TOP_FRONT_CENTER PA_CHANNEL_POSITION_TOP_FRONT_CENTER
203 #define PA_CHANNEL_POSITION_TOP_REAR_LEFT PA_CHANNEL_POSITION_TOP_REAR_LEFT
204 #define PA_CHANNEL_POSITION_TOP_REAR_RIGHT PA_CHANNEL_POSITION_TOP_REAR_RIGHT
205 #define PA_CHANNEL_POSITION_TOP_REAR_CENTER PA_CHANNEL_POSITION_TOP_REAR_CENTER
206 #define PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
207 
210 typedef uint64_t pa_channel_position_mask_t;
211 
213 #define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1ULL << (f)))
214 
216 typedef enum pa_channel_map_def {
221  PA_CHANNEL_MAP_ALSA,
235  PA_CHANNEL_MAP_OSS,
244 
248 
250 #define PA_CHANNEL_MAP_AIFF PA_CHANNEL_MAP_AIFF
251 #define PA_CHANNEL_MAP_ALSA PA_CHANNEL_MAP_ALSA
252 #define PA_CHANNEL_MAP_AUX PA_CHANNEL_MAP_AUX
253 #define PA_CHANNEL_MAP_WAVEEX PA_CHANNEL_MAP_WAVEEX
254 #define PA_CHANNEL_MAP_OSS PA_CHANNEL_MAP_OSS
255 #define PA_CHANNEL_MAP_DEF_MAX PA_CHANNEL_MAP_DEF_MAX
256 #define PA_CHANNEL_MAP_DEFAULT PA_CHANNEL_MAP_DEFAULT
257 
262 typedef struct pa_channel_map {
263  uint8_t channels;
269 
274 
277 
280 
286 
292 
295 
298 
301 
307 #define PA_CHANNEL_MAP_SNPRINT_MAX 336
308 
310 char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map);
311 
317 
320 
323 
327 
330 
335 
340 
345 const char* pa_channel_map_to_name(const pa_channel_map *map) PA_GCC_PURE;
346 
351 
355 
358 
359 PA_C_DECL_END
360 
361 #endif
The mapping from RFC3551, which is based on AIFF-C.
Definition: channelmap.h:217
Definition: channelmap.h:130
pa_channel_map * pa_channel_map_init(pa_channel_map *m)
Initialize the specified channel map and return a pointer to it.
A sample format and attribute specification.
Definition: sample.h:248
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...
Definition: channelmap.h:116
Definition: channelmap.h:108
Definition: channelmap.h:121
Definition: channelmap.h:122
Definition: channelmap.h:109
The default channel map.
Definition: channelmap.h:245
Definition: channelmap.h:125
Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Re...
Definition: channelmap.h:89
Definition: channelmap.h:128
Definition: channelmap.h:117
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...
Apple, Dolby call this 'Right'.
Definition: channelmap.h:79
Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!)
Definition: channelmap.h:101
uint64_t pa_channel_position_mask_t
A mask of channel positions.
Definition: channelmap.h:210
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...
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 ...
Microsoft and Apple call this 'Top Back Left'.
Definition: channelmap.h:142
#define PA_CHANNELS_MAX
Maximum number of allowed channels.
Definition: sample.h:128
pa_channel_position
A list of channel labels.
Definition: channelmap.h:74
Definition: channelmap.h:115
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", "surround-71" and so on.
Definition: channelmap.h:103
Definition: channelmap.h:123
enum pa_channel_position pa_channel_position_t
A list of channel labels.
Apple calls this 'Vertical Height Right'.
Definition: channelmap.h:139
pa_channel_map_def
A list of channel mapping definitions for pa_channel_map_init_auto()
Definition: channelmap.h:216
Definition: channelmap.h:76
Apple calls this 'Vertical Height Center'.
Definition: channelmap.h:140
Microsoft and Apple call this 'Top Back Center'.
Definition: channelmap.h:144
Apple, Dolby call this 'Left'.
Definition: channelmap.h:78
int pa_channel_map_valid(const pa_channel_map *map) PA_GCC_PURE
Return non-zero if the specified channel map is considered valid.
Definition: channelmap.h:110
Apple calls this 'Vertical Height Left'.
Definition: channelmap.h:138
#define PA_GCC_PURE
This function's return value depends only the arguments list and global state.
Definition: gccmacro.h:73
Definition: channelmap.h:124
Definition: channelmap.h:126
Definition: channelmap.h:107
Definition: channelmap.h:120
uint8_t channels
Number of channels.
Definition: channelmap.h:263
enum pa_channel_map_def pa_channel_map_def_t
A list of channel mapping definitions for pa_channel_map_init_auto()
Apple, Dolby call this 'Center'.
Definition: channelmap.h:80
Definition: channelmap.h:134
Definition: channelmap.h:127
Definition: channelmap.h:119
Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen'.
Definition: channelmap.h:92
GCC attribute macros.
Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!)
Definition: channelmap.h:100
Microsoft and Apple call this 'Top Back Right'.
Definition: channelmap.h:143
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.
Definition: channelmap.h:133
Definition: channelmap.h:105
Definition: channelmap.h:132
Definition: channelmap.h:112
pa_channel_position_t pa_channel_position_from_string(const char *s) PA_GCC_PURE
The inverse of pa_channel_position_to_string().
Define header version.
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...
Apple, Dolby call this 'Left Center'.
Definition: channelmap.h:97
Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Re...
Definition: channelmap.h:88
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.
Microsoft's WAVEFORMATEXTENSIBLE mapping.
Definition: channelmap.h:230
Constants and routines for sample type handling.
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...
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.
Definition: channelmap.h:75
Definition: channelmap.h:146
Definition: channelmap.h:104
struct pa_channel_map pa_channel_map
A channel map which can be used to attach labels to specific channels of a stream.
Apple calls this 'Top Center Surround'.
Definition: channelmap.h:136
Apple, Dolby call this 'Right Center.
Definition: channelmap.h:98
int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE
Compare two channel maps.
Definition: channelmap.h:106
Only aux channels.
Definition: channelmap.h:227
Definition: channelmap.h:129
pa_channel_position_t map[PA_CHANNELS_MAX]
Channel labels.
Definition: channelmap.h:266
const char * pa_channel_position_to_string(pa_channel_position_t pos) PA_GCC_PURE
Return a text label for the specified channel position.
Definition: channelmap.h:113
Definition: channelmap.h:111
A channel map which can be used to attach labels to specific channels of a stream.
Definition: channelmap.h:262
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.
Definition: channelmap.h:114
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.
const char * pa_channel_position_to_pretty_string(pa_channel_position_t pos)
Return a human readable text label for the specified channel position.
Definition: channelmap.h:131
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...
Definition: channelmap.h:118
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", "Surround 7.1" and so on.
Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround ...
Definition: channelmap.h:90
Upper limit of valid channel mapping definitions.
Definition: channelmap.h:243