PipeWire  0.3.66
audio/raw.h
Go to the documentation of this file.
1 /* Simple Plugin API */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef SPA_AUDIO_RAW_H
6 #define SPA_AUDIO_RAW_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <stdint.h>
13 
14 #if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
15 #include <endian.h>
16 #endif
17 
23 #define SPA_AUDIO_MAX_CHANNELS 64u
24 
25 enum spa_audio_format {
28 
29  /* interleaved formats */
61 
64 
65  /* planar formats */
75 
76  /* other formats start here */
78 
79  /* Aliases */
80 
81  /* DSP formats */
85 
86  /* native endian */
87 #if __BYTE_ORDER == __BIG_ENDIAN
116 #elif __BYTE_ORDER == __LITTLE_ENDIAN
145 #endif
146 };
147 
148 #define SPA_AUDIO_FORMAT_IS_INTERLEAVED(fmt) ((fmt) > SPA_AUDIO_FORMAT_START_Interleaved && (fmt) < SPA_AUDIO_FORMAT_START_Planar)
149 #define SPA_AUDIO_FORMAT_IS_PLANAR(fmt) ((fmt) > SPA_AUDIO_FORMAT_START_Planar && (fmt) < SPA_AUDIO_FORMAT_START_Other)
150 
151 enum spa_audio_channel {
258 
262 };
263 
265 #define SPA_AUDIO_FLAG_NONE (0) /*< no valid flag */
266 #define SPA_AUDIO_FLAG_UNPOSITIONED (1 << 0) /*< the position array explicitly
267  * contains unpositioned channels. */
270  enum spa_audio_format format; /*< format, one of enum spa_audio_format */
271  uint32_t flags; /*< extra flags */
272  uint32_t rate; /*< sample rate */
273  uint32_t channels; /*< number of channels */
274  uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
275 };
276 
277 #define SPA_AUDIO_INFO_RAW_INIT(...) ((struct spa_audio_info_raw) { __VA_ARGS__ })
278 
279 #define SPA_KEY_AUDIO_FORMAT "audio.format"
281 #define SPA_KEY_AUDIO_CHANNEL "audio.channel"
283 #define SPA_KEY_AUDIO_CHANNELS "audio.channels"
284 #define SPA_KEY_AUDIO_RATE "audio.rate"
285 #define SPA_KEY_AUDIO_POSITION "audio.position"
287 #define SPA_KEY_AUDIO_ALLOWED_RATES "audio.allowed-rates"
293 #ifdef __cplusplus
294 } /* extern "C" */
295 #endif
296 
297 #endif /* SPA_AUDIO_RAW_H */
spa_audio_channel
Definition: audio/raw.h:159
spa_audio_format
Definition: audio/raw.h:31
#define SPA_AUDIO_MAX_CHANNELS
Definition: audio/raw.h:29
@ SPA_AUDIO_CHANNEL_AUX5
Definition: audio/raw.h:207
@ SPA_AUDIO_CHANNEL_BC
bottom center
Definition: audio/raw.h:197
@ SPA_AUDIO_CHANNEL_FC
front center
Definition: audio/raw.h:167
@ SPA_AUDIO_CHANNEL_AUX62
Definition: audio/raw.h:264
@ SPA_AUDIO_CHANNEL_FLW
front left wide
Definition: audio/raw.h:185
@ SPA_AUDIO_CHANNEL_AUX17
Definition: audio/raw.h:219
@ SPA_AUDIO_CHANNEL_AUX31
Definition: audio/raw.h:233
@ SPA_AUDIO_CHANNEL_START_Custom
Definition: audio/raw.h:269
@ SPA_AUDIO_CHANNEL_FLC
front left center
Definition: audio/raw.h:171
@ SPA_AUDIO_CHANNEL_AUX42
Definition: audio/raw.h:244
@ SPA_AUDIO_CHANNEL_TFLC
top front left center
Definition: audio/raw.h:191
@ SPA_AUDIO_CHANNEL_TFRC
top front right center
Definition: audio/raw.h:192
@ SPA_AUDIO_CHANNEL_AUX0
Definition: audio/raw.h:202
@ SPA_AUDIO_CHANNEL_AUX25
Definition: audio/raw.h:227
@ SPA_AUDIO_CHANNEL_AUX27
Definition: audio/raw.h:229
@ SPA_AUDIO_CHANNEL_AUX60
Definition: audio/raw.h:262
@ SPA_AUDIO_CHANNEL_BRC
bottom right center
Definition: audio/raw.h:199
@ SPA_AUDIO_CHANNEL_AUX50
Definition: audio/raw.h:252
@ SPA_AUDIO_CHANNEL_AUX63
Definition: audio/raw.h:265
@ SPA_AUDIO_CHANNEL_AUX53
Definition: audio/raw.h:255
@ SPA_AUDIO_CHANNEL_AUX34
Definition: audio/raw.h:236
@ SPA_AUDIO_CHANNEL_AUX3
Definition: audio/raw.h:205
@ SPA_AUDIO_CHANNEL_FR
front right
Definition: audio/raw.h:166
@ SPA_AUDIO_CHANNEL_AUX43
Definition: audio/raw.h:245
@ SPA_AUDIO_CHANNEL_AUX46
Definition: audio/raw.h:248
@ SPA_AUDIO_CHANNEL_AUX57
Definition: audio/raw.h:259
@ SPA_AUDIO_CHANNEL_RLFE
right LFE
Definition: audio/raw.h:196
@ SPA_AUDIO_CHANNEL_AUX56
Definition: audio/raw.h:258
@ SPA_AUDIO_CHANNEL_AUX52
Definition: audio/raw.h:254
@ SPA_AUDIO_CHANNEL_AUX10
Definition: audio/raw.h:212
@ SPA_AUDIO_CHANNEL_AUX33
Definition: audio/raw.h:235
@ SPA_AUDIO_CHANNEL_AUX12
Definition: audio/raw.h:214
@ SPA_AUDIO_CHANNEL_BLC
bottom left center
Definition: audio/raw.h:198
@ SPA_AUDIO_CHANNEL_AUX6
Definition: audio/raw.h:208
@ SPA_AUDIO_CHANNEL_AUX23
Definition: audio/raw.h:225
@ SPA_AUDIO_CHANNEL_TRC
top rear center
Definition: audio/raw.h:181
@ SPA_AUDIO_CHANNEL_AUX48
Definition: audio/raw.h:250
@ SPA_AUDIO_CHANNEL_AUX13
Definition: audio/raw.h:215
@ SPA_AUDIO_CHANNEL_START_Aux
aux channels
Definition: audio/raw.h:201
@ SPA_AUDIO_CHANNEL_TFC
top front center
Definition: audio/raw.h:178
@ SPA_AUDIO_CHANNEL_TFR
top front right
Definition: audio/raw.h:179
@ SPA_AUDIO_CHANNEL_AUX61
Definition: audio/raw.h:263
@ SPA_AUDIO_CHANNEL_AUX28
Definition: audio/raw.h:230
@ SPA_AUDIO_CHANNEL_AUX30
Definition: audio/raw.h:232
@ SPA_AUDIO_CHANNEL_RLC
rear left center
Definition: audio/raw.h:183
@ SPA_AUDIO_CHANNEL_LFE2
LFE 2.
Definition: audio/raw.h:187
@ SPA_AUDIO_CHANNEL_AUX35
Definition: audio/raw.h:237
@ SPA_AUDIO_CHANNEL_AUX2
Definition: audio/raw.h:204
@ SPA_AUDIO_CHANNEL_RR
rear right
Definition: audio/raw.h:175
@ SPA_AUDIO_CHANNEL_TRL
top rear left
Definition: audio/raw.h:180
@ SPA_AUDIO_CHANNEL_AUX7
Definition: audio/raw.h:209
@ SPA_AUDIO_CHANNEL_AUX44
Definition: audio/raw.h:246
@ SPA_AUDIO_CHANNEL_LLFE
left LFE
Definition: audio/raw.h:195
@ SPA_AUDIO_CHANNEL_AUX41
Definition: audio/raw.h:243
@ SPA_AUDIO_CHANNEL_AUX8
Definition: audio/raw.h:210
@ SPA_AUDIO_CHANNEL_AUX39
Definition: audio/raw.h:241
@ SPA_AUDIO_CHANNEL_AUX54
Definition: audio/raw.h:256
@ SPA_AUDIO_CHANNEL_AUX19
Definition: audio/raw.h:221
@ SPA_AUDIO_CHANNEL_AUX59
Definition: audio/raw.h:261
@ SPA_AUDIO_CHANNEL_TRR
top rear right
Definition: audio/raw.h:182
@ SPA_AUDIO_CHANNEL_UNKNOWN
unspecified
Definition: audio/raw.h:160
@ SPA_AUDIO_CHANNEL_RL
rear left
Definition: audio/raw.h:174
@ SPA_AUDIO_CHANNEL_AUX37
Definition: audio/raw.h:239
@ SPA_AUDIO_CHANNEL_AUX21
Definition: audio/raw.h:223
@ SPA_AUDIO_CHANNEL_AUX38
Definition: audio/raw.h:240
@ SPA_AUDIO_CHANNEL_AUX58
Definition: audio/raw.h:260
@ SPA_AUDIO_CHANNEL_AUX4
Definition: audio/raw.h:206
@ SPA_AUDIO_CHANNEL_NA
N/A, silent.
Definition: audio/raw.h:161
@ SPA_AUDIO_CHANNEL_TSL
top side left
Definition: audio/raw.h:193
@ SPA_AUDIO_CHANNEL_LFE
LFE.
Definition: audio/raw.h:168
@ SPA_AUDIO_CHANNEL_SR
side right
Definition: audio/raw.h:170
@ SPA_AUDIO_CHANNEL_FCH
front center high
Definition: audio/raw.h:189
@ SPA_AUDIO_CHANNEL_AUX45
Definition: audio/raw.h:247
@ SPA_AUDIO_CHANNEL_LAST_Aux
aux channels
Definition: audio/raw.h:267
@ SPA_AUDIO_CHANNEL_TSR
top side right
Definition: audio/raw.h:194
@ SPA_AUDIO_CHANNEL_TFL
top front left
Definition: audio/raw.h:177
@ SPA_AUDIO_CHANNEL_AUX9
Definition: audio/raw.h:211
@ SPA_AUDIO_CHANNEL_AUX55
Definition: audio/raw.h:257
@ SPA_AUDIO_CHANNEL_AUX51
Definition: audio/raw.h:253
@ SPA_AUDIO_CHANNEL_TC
top center
Definition: audio/raw.h:176
@ SPA_AUDIO_CHANNEL_AUX16
Definition: audio/raw.h:218
@ SPA_AUDIO_CHANNEL_FRC
front right center
Definition: audio/raw.h:172
@ SPA_AUDIO_CHANNEL_RC
rear center
Definition: audio/raw.h:173
@ SPA_AUDIO_CHANNEL_AUX36
Definition: audio/raw.h:238
@ SPA_AUDIO_CHANNEL_AUX26
Definition: audio/raw.h:228
@ SPA_AUDIO_CHANNEL_AUX40
Definition: audio/raw.h:242
@ SPA_AUDIO_CHANNEL_FL
front left
Definition: audio/raw.h:165
@ SPA_AUDIO_CHANNEL_MONO
mono stream
Definition: audio/raw.h:163
@ SPA_AUDIO_CHANNEL_AUX49
Definition: audio/raw.h:251
@ SPA_AUDIO_CHANNEL_AUX18
Definition: audio/raw.h:220
@ SPA_AUDIO_CHANNEL_AUX1
Definition: audio/raw.h:203
@ SPA_AUDIO_CHANNEL_AUX47
Definition: audio/raw.h:249
@ SPA_AUDIO_CHANNEL_AUX11
Definition: audio/raw.h:213
@ SPA_AUDIO_CHANNEL_FLH
front left high
Definition: audio/raw.h:188
@ SPA_AUDIO_CHANNEL_AUX14
Definition: audio/raw.h:216
@ SPA_AUDIO_CHANNEL_AUX32
Definition: audio/raw.h:234
@ SPA_AUDIO_CHANNEL_FRW
front right wide
Definition: audio/raw.h:186
@ SPA_AUDIO_CHANNEL_AUX29
Definition: audio/raw.h:231
@ SPA_AUDIO_CHANNEL_RRC
rear right center
Definition: audio/raw.h:184
@ SPA_AUDIO_CHANNEL_SL
side left
Definition: audio/raw.h:169
@ SPA_AUDIO_CHANNEL_AUX15
Definition: audio/raw.h:217
@ SPA_AUDIO_CHANNEL_AUX24
Definition: audio/raw.h:226
@ SPA_AUDIO_CHANNEL_AUX20
Definition: audio/raw.h:222
@ SPA_AUDIO_CHANNEL_AUX22
Definition: audio/raw.h:224
@ SPA_AUDIO_CHANNEL_FRH
front right high
Definition: audio/raw.h:190
@ SPA_AUDIO_FORMAT_S32
Definition: audio/raw.h:98
@ SPA_AUDIO_FORMAT_F64_LE
Definition: audio/raw.h:65
@ SPA_AUDIO_FORMAT_U16_OE
Definition: audio/raw.h:109
@ SPA_AUDIO_FORMAT_F32_OE
Definition: audio/raw.h:120
@ SPA_AUDIO_FORMAT_U16_BE
Definition: audio/raw.h:42
@ SPA_AUDIO_FORMAT_S16P
Definition: audio/raw.h:74
@ SPA_AUDIO_FORMAT_U20_OE
Definition: audio/raw.h:117
@ SPA_AUDIO_FORMAT_U24_32_BE
Definition: audio/raw.h:46
@ SPA_AUDIO_FORMAT_U24_32
Definition: audio/raw.h:97
@ SPA_AUDIO_FORMAT_U24_OE
Definition: audio/raw.h:115
@ SPA_AUDIO_FORMAT_U18_LE
Definition: audio/raw.h:61
@ SPA_AUDIO_FORMAT_S18_LE
Definition: audio/raw.h:59
@ SPA_AUDIO_FORMAT_U32_BE
Definition: audio/raw.h:50
@ SPA_AUDIO_FORMAT_ULAW
Definition: audio/raw.h:68
@ SPA_AUDIO_FORMAT_U32_LE
Definition: audio/raw.h:49
@ SPA_AUDIO_FORMAT_S20
Definition: audio/raw.h:102
@ SPA_AUDIO_FORMAT_S32_BE
Definition: audio/raw.h:48
@ SPA_AUDIO_FORMAT_DSP_F64
Definition: audio/raw.h:90
@ SPA_AUDIO_FORMAT_F32P
Definition: audio/raw.h:78
@ SPA_AUDIO_FORMAT_S24_32_LE
Definition: audio/raw.h:43
@ SPA_AUDIO_FORMAT_S16_LE
Definition: audio/raw.h:39
@ SPA_AUDIO_FORMAT_S18_OE
Definition: audio/raw.h:118
@ SPA_AUDIO_FORMAT_F32_BE
Definition: audio/raw.h:64
@ SPA_AUDIO_FORMAT_F32_LE
Definition: audio/raw.h:63
@ SPA_AUDIO_FORMAT_U18_OE
Definition: audio/raw.h:119
@ SPA_AUDIO_FORMAT_START_Planar
Definition: audio/raw.h:72
@ SPA_AUDIO_FORMAT_START_Interleaved
Definition: audio/raw.h:36
@ SPA_AUDIO_FORMAT_U32
Definition: audio/raw.h:99
@ SPA_AUDIO_FORMAT_S16_OE
Definition: audio/raw.h:108
@ SPA_AUDIO_FORMAT_S32_OE
Definition: audio/raw.h:112
@ SPA_AUDIO_FORMAT_U24_BE
Definition: audio/raw.h:54
@ SPA_AUDIO_FORMAT_U24_LE
Definition: audio/raw.h:53
@ SPA_AUDIO_FORMAT_U18_BE
Definition: audio/raw.h:62
@ SPA_AUDIO_FORMAT_S20_BE
Definition: audio/raw.h:56
@ SPA_AUDIO_FORMAT_U24_32_LE
Definition: audio/raw.h:45
@ SPA_AUDIO_FORMAT_U20_LE
Definition: audio/raw.h:57
@ SPA_AUDIO_FORMAT_S24P
Definition: audio/raw.h:77
@ SPA_AUDIO_FORMAT_S32_LE
Definition: audio/raw.h:47
@ SPA_AUDIO_FORMAT_DSP_F32
Definition: audio/raw.h:89
@ SPA_AUDIO_FORMAT_S24_32P
Definition: audio/raw.h:75
@ SPA_AUDIO_FORMAT_S20_OE
Definition: audio/raw.h:116
@ SPA_AUDIO_FORMAT_S8P
Definition: audio/raw.h:80
@ SPA_AUDIO_FORMAT_U24
Definition: audio/raw.h:101
@ SPA_AUDIO_FORMAT_START_Other
Definition: audio/raw.h:83
@ SPA_AUDIO_FORMAT_UNKNOWN
Definition: audio/raw.h:32
@ SPA_AUDIO_FORMAT_F64_BE
Definition: audio/raw.h:66
@ SPA_AUDIO_FORMAT_F64P
Definition: audio/raw.h:79
@ SPA_AUDIO_FORMAT_U20
Definition: audio/raw.h:103
@ SPA_AUDIO_FORMAT_S8
Definition: audio/raw.h:37
@ SPA_AUDIO_FORMAT_U32_OE
Definition: audio/raw.h:113
@ SPA_AUDIO_FORMAT_U8
Definition: audio/raw.h:38
@ SPA_AUDIO_FORMAT_U16_LE
Definition: audio/raw.h:41
@ SPA_AUDIO_FORMAT_S24_LE
Definition: audio/raw.h:51
@ SPA_AUDIO_FORMAT_DSP_S32
Definition: audio/raw.h:88
@ SPA_AUDIO_FORMAT_U18
Definition: audio/raw.h:105
@ SPA_AUDIO_FORMAT_U20_BE
Definition: audio/raw.h:58
@ SPA_AUDIO_FORMAT_S24
Definition: audio/raw.h:100
@ SPA_AUDIO_FORMAT_ENCODED
Definition: audio/raw.h:33
@ SPA_AUDIO_FORMAT_S16_BE
Definition: audio/raw.h:40
@ SPA_AUDIO_FORMAT_S24_BE
Definition: audio/raw.h:52
@ SPA_AUDIO_FORMAT_U8P
Definition: audio/raw.h:73
@ SPA_AUDIO_FORMAT_ALAW
Definition: audio/raw.h:69
@ SPA_AUDIO_FORMAT_S32P
Definition: audio/raw.h:76
@ SPA_AUDIO_FORMAT_S24_32_OE
Definition: audio/raw.h:110
@ SPA_AUDIO_FORMAT_U24_32_OE
Definition: audio/raw.h:111
@ SPA_AUDIO_FORMAT_S24_32_BE
Definition: audio/raw.h:44
@ SPA_AUDIO_FORMAT_S16
Definition: audio/raw.h:94
@ SPA_AUDIO_FORMAT_S24_32
Definition: audio/raw.h:96
@ SPA_AUDIO_FORMAT_F64
Definition: audio/raw.h:107
@ SPA_AUDIO_FORMAT_F32
Definition: audio/raw.h:106
@ SPA_AUDIO_FORMAT_S20_LE
Definition: audio/raw.h:55
@ SPA_AUDIO_FORMAT_S18
Definition: audio/raw.h:104
@ SPA_AUDIO_FORMAT_F64_OE
Definition: audio/raw.h:121
@ SPA_AUDIO_FORMAT_S18_BE
Definition: audio/raw.h:60
@ SPA_AUDIO_FORMAT_S24_OE
Definition: audio/raw.h:114
@ SPA_AUDIO_FORMAT_U16
Definition: audio/raw.h:95
Audio information description.
Definition: audio/raw.h:278
enum spa_audio_format format
Definition: audio/raw.h:279
uint32_t channels
Definition: audio/raw.h:282
uint32_t flags
Definition: audio/raw.h:280
uint32_t position[SPA_AUDIO_MAX_CHANNELS]
Definition: audio/raw.h:283
uint32_t rate
Definition: audio/raw.h:281