PipeWire  0.3.61
layout.h
Go to the documentation of this file.
1 /* Simple Plugin API
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef SPA_AUDIO_LAYOUT_H
26 #define SPA_AUDIO_LAYOUT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
33 #include <endian.h>
34 #endif
35 
40 #include <spa/param/audio/raw.h>
41 
42 struct spa_audio_layout_info {
43  uint32_t n_channels;
45 };
46 
47 #define SPA_AUDIO_LAYOUT_Mono 1, { SPA_AUDIO_CHANNEL_MONO, }
48 #define SPA_AUDIO_LAYOUT_Stereo 2, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, }
49 #define SPA_AUDIO_LAYOUT_Quad 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
50  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
51 #define SPA_AUDIO_LAYOUT_Pentagonal 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
52  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
53  SPA_AUDIO_CHANNEL_FC, }
54 #define SPA_AUDIO_LAYOUT_Hexagonal 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
55  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
56  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
57 #define SPA_AUDIO_LAYOUT_Octagonal 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
58  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
59  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, \
60  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
61 #define SPA_AUDIO_LAYOUT_Cube 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR }, \
62  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
63  SPA_AUDIO_CHANNEL_TFL, SPA_AUDIO_CHANNEL_TFR, \
64  SPA_AUDIO_CHANNEL_TRL, SPA_AUDIO_CHANNEL_TRR, }
65 
66 
67 #define SPA_AUDIO_LAYOUT_MPEG_1_0 SPA_AUDIO_LAYOUT_Mono
68 #define SPA_AUDIO_LAYOUT_MPEG_2_0 SPA_AUDIO_LAYOUT_Stereo
69 #define SPA_AUDIO_LAYOUT_MPEG_3_0A 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
70  SPA_AUDIO_CHANNEL_FC, }
71 #define SPA_AUDIO_LAYOUT_MPEG_3_0B 3, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
72  SPA_AUDIO_CHANNEL_FR, }
73 #define SPA_AUDIO_LAYOUT_MPEG_4_0A 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
74  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
75 #define SPA_AUDIO_LAYOUT_MPEG_4_0B 4, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
76  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_RC, }
77 #define SPA_AUDIO_LAYOUT_MPEG_5_0A 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
78  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
79  SPA_AUDIO_CHANNEL_SR, }
80 #define SPA_AUDIO_LAYOUT_MPEG_5_0B 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
81  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
82  SPA_AUDIO_CHANNEL_FC, }
83 #define SPA_AUDIO_LAYOUT_MPEG_5_0C 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FC, \
84  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
85  SPA_AUDIO_CHANNEL_SR, }
86 #define SPA_AUDIO_LAYOUT_MPEG_5_0D 5, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
87  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
88  SPA_AUDIO_CHANNEL_SR, }
89 #define SPA_AUDIO_LAYOUT_MPEG_5_1A 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
90  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
91  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
92 #define SPA_AUDIO_LAYOUT_MPEG_5_1B 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
93  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
94  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, }
95 #define SPA_AUDIO_LAYOUT_MPEG_5_1C 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FC, \
96  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
97  SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_LFE, }
98 #define SPA_AUDIO_LAYOUT_MPEG_5_1D 6, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
99  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
100  SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_LFE, }
101 #define SPA_AUDIO_LAYOUT_MPEG_6_1A 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
102  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
103  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
104  SPA_AUDIO_CHANNEL_RC, }
105 #define SPA_AUDIO_LAYOUT_MPEG_7_1A 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
106  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
107  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
108  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
109 #define SPA_AUDIO_LAYOUT_MPEG_7_1B 8, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
110  SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_FL, \
111  SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_RL, \
112  SPA_AUDIO_CHANNEL_RR, SPA_AUDIO_CHANNEL_LFE, }
113 #define SPA_AUDIO_LAYOUT_MPEG_7_1C 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
114  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
115  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
116  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
117 
118 
119 #define SPA_AUDIO_LAYOUT_2_1 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
120  SPA_AUDIO_CHANNEL_LFE, }
121 
122 #define SPA_AUDIO_LAYOUT_2RC 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
123  SPA_AUDIO_CHANNEL_RC, }
124 #define SPA_AUDIO_LAYOUT_2FC 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
125  SPA_AUDIO_CHANNEL_FC, }
126 
127 #define SPA_AUDIO_LAYOUT_3_1 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
128  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, }
129 #define SPA_AUDIO_LAYOUT_4_0 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
130  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
131 #define SPA_AUDIO_LAYOUT_2_2 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
132  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
133 
134 #define SPA_AUDIO_LAYOUT_4_1 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
135  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
136  SPA_AUDIO_CHANNEL_RC, }
137 #define SPA_AUDIO_LAYOUT_5_0 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
138  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
139  SPA_AUDIO_CHANNEL_SR, }
140 #define SPA_AUDIO_LAYOUT_5_0R 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
141  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, \
142  SPA_AUDIO_CHANNEL_RR, }
143 #define SPA_AUDIO_LAYOUT_5_1 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
144  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
145  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
146 #define SPA_AUDIO_LAYOUT_5_1R 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
147  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
148  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
149 #define SPA_AUDIO_LAYOUT_6_0 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
150  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, \
151  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
152 #define SPA_AUDIO_LAYOUT_6_0F 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
153  SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, \
154  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
155 #define SPA_AUDIO_LAYOUT_6_1 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
156  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
157  SPA_AUDIO_CHANNEL_RC, SPA_AUDIO_CHANNEL_SL, \
158  SPA_AUDIO_CHANNEL_SR, }
159 #define SPA_AUDIO_LAYOUT_6_1F 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
160  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
161  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
162  SPA_AUDIO_CHANNEL_RC, }
163 #define SPA_AUDIO_LAYOUT_7_0 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
164  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, \
165  SPA_AUDIO_CHANNEL_RR, SPA_AUDIO_CHANNEL_SL, \
166  SPA_AUDIO_CHANNEL_SR, }
167 #define SPA_AUDIO_LAYOUT_7_0F 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
168  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FLC, \
169  SPA_AUDIO_CHANNEL_FRC, SPA_AUDIO_CHANNEL_SL, \
170  SPA_AUDIO_CHANNEL_SR, }
171 #define SPA_AUDIO_LAYOUT_7_1 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
172  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
173  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
174  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
175 #define SPA_AUDIO_LAYOUT_7_1W 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
176  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
177  SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, \
178  SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
179 #define SPA_AUDIO_LAYOUT_7_1WR 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
180  SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
181  SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
182  SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, }
183 
188 #ifdef __cplusplus
189 } /* extern "C" */
190 #endif
191 
192 #endif /* SPA_AUDIO_LAYOUT_H */
spa/param/audio/raw.h
#define SPA_AUDIO_MAX_CHANNELS
Definition: raw.h:49
Definition: layout.h:47
uint32_t position[SPA_AUDIO_MAX_CHANNELS]
Definition: layout.h:49
uint32_t n_channels
Definition: layout.h:48