PulseAudio  5.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, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  USA.
24 ***/
25 
26 #include <pulse/sample.h>
27 #include <pulse/cdecl.h>
28 #include <pulse/gccmacro.h>
29 #include <pulse/version.h>
30 
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
209 
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
259 
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 const char* pa_channel_map_to_name(const pa_channel_map *map) PA_GCC_PURE;
348 
353 
357 
360 
361 PA_C_DECL_END
362 
363 #endif
The mapping from RFC3551, which is based on AIFF-C.
Definition: channelmap.h:219
Definition: channelmap.h:132
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:250
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:118
Definition: channelmap.h:110
Definition: channelmap.h:123
Definition: channelmap.h:124
Definition: channelmap.h:111
The default channel map.
Definition: channelmap.h:247
Definition: channelmap.h:127
Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Re...
Definition: channelmap.h:91
Definition: channelmap.h:130
Definition: channelmap.h:119
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:81
Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!)
Definition: channelmap.h:103
uint64_t pa_channel_position_mask_t
A mask of channel positions.
Definition: channelmap.h:212
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:144
#define PA_CHANNELS_MAX
Maximum number of allowed channels.
Definition: sample.h:130
pa_channel_position
A list of channel labels.
Definition: channelmap.h:76
Definition: channelmap.h:117
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:105
Definition: channelmap.h:125
enum pa_channel_position pa_channel_position_t
A list of channel labels.
Apple calls this 'Vertical Height Right'.
Definition: channelmap.h:141
pa_channel_map_def
A list of channel mapping definitions for pa_channel_map_init_auto()
Definition: channelmap.h:218
Definition: channelmap.h:78
Apple calls this 'Vertical Height Center'.
Definition: channelmap.h:142
Microsoft and Apple call this 'Top Back Center'.
Definition: channelmap.h:146
Apple, Dolby call this 'Left'.
Definition: channelmap.h:80
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:112
Apple calls this 'Vertical Height Left'.
Definition: channelmap.h:140
#define PA_GCC_PURE
This function's return value depends only the arguments list and global state.
Definition: gccmacro.h:75
Definition: channelmap.h:126
Definition: channelmap.h:128
Definition: channelmap.h:109
Definition: channelmap.h:122
uint8_t channels
Number of channels.
Definition: channelmap.h:265
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:82
Definition: channelmap.h:136
Definition: channelmap.h:129
Definition: channelmap.h:121
Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen'.
Definition: channelmap.h:94
GCC attribute macros.
Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!)
Definition: channelmap.h:102
Microsoft and Apple call this 'Top Back Right'.
Definition: channelmap.h:145
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:135
Definition: channelmap.h:107
Definition: channelmap.h:134
Definition: channelmap.h:114
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:99
Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Re...
Definition: channelmap.h:90
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:232
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:77
Definition: channelmap.h:148
Definition: channelmap.h:106
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:138
Apple, Dolby call this 'Right Center.
Definition: channelmap.h:100
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:108
Only aux channels.
Definition: channelmap.h:229
Definition: channelmap.h:131
pa_channel_position_t map[PA_CHANNELS_MAX]
Channel labels.
Definition: channelmap.h:268
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:115
Definition: channelmap.h:113
A channel map which can be used to attach labels to specific channels of a stream.
Definition: channelmap.h:264
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:116
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:133
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:120
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:92
Upper limit of valid channel mapping definitions.
Definition: channelmap.h:245