Go to the documentation of this file.
23 #define CHANNEL_NAME(x) \
24 av_bprint_clear(&bp); \
25 av_channel_name_bprint(&bp, x);
27 #define CHANNEL_DESCRIPTION(x) \
28 av_bprint_clear(&bp); \
29 av_channel_description_bprint(&bp, x);
31 #define CHANNEL_LAYOUT_FROM_MASK(x) \
32 av_channel_layout_uninit(&layout); \
33 av_bprint_clear(&bp); \
34 if (!av_channel_layout_from_mask(&layout, x) && \
35 av_channel_layout_check(&layout)) \
36 av_channel_layout_describe_bprint(&layout, &bp); \
38 av_bprintf(&bp, "fail");
40 #define CHANNEL_LAYOUT_FROM_STRING(x) \
41 av_channel_layout_uninit(&layout); \
42 av_bprint_clear(&bp); \
43 if (!av_channel_layout_from_string(&layout, x) && \
44 av_channel_layout_check(&layout)) \
45 av_channel_layout_describe_bprint(&layout, &bp); \
47 av_bprintf(&bp, "fail");
49 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x) \
50 ret = av_channel_layout_channel_from_index(&layout, x); \
54 #define CHANNEL_LAYOUT_SUBSET(x) \
55 mask = av_channel_layout_subset(&layout, x)
57 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x) \
58 ret = av_channel_layout_index_from_channel(&layout, x); \
62 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x) \
63 ret = av_channel_layout_channel_from_string(&layout, x); \
67 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(x) \
68 ret = av_channel_layout_index_from_string(&layout, x); \
83 printf(
"Testing av_channel_layout_standard\n");
88 for (
int i = 0;
i < 63;
i++) {
100 printf(
"\nTesting av_channel_name\n");
102 printf(
"With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
104 printf(
"With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
106 printf(
"With 63: %43s\n", bp.str);
108 printf(
"With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
110 printf(
"With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
112 printf(
"Testing av_channel_description\n");
114 printf(
"With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
116 printf(
"With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
118 printf(
"With 63: %43s\n", bp.str);
120 printf(
"With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
122 printf(
"With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
124 printf(
"\nTesting av_channel_from_string\n");
131 printf(
"\n==Native layouts==\n");
133 printf(
"\nTesting av_channel_layout_from_string\n");
135 printf(
"With \"0x3f\": %39s\n", bp.str);
137 printf(
"With \"63\": %41s\n", bp.str);
139 printf(
"With \"6c\": %41s\n", bp.str);
141 printf(
"With \"6C\": %41s\n", bp.str);
143 printf(
"With \"6 channels\": %33s\n", bp.str);
145 printf(
"With \"6 channels (FL+FR+FC+LFE+BL+BR)\": %12s\n", bp.str);
147 printf(
"With \"FL+FR+FC+LFE+BL+BR\": %25s\n", bp.str);
149 printf(
"With \"5.1\": %40s\n", bp.str);
151 printf(
"With \"FL+FR+USR63\": %32s\n", bp.str);
153 printf(
"With \"FL+FR+FC+LFE+SL+SR\": %25s\n", bp.str);
155 printf(
"With \"5.1(side)\": %34s\n", bp.str);
157 printf(
"\nTesting av_channel_layout_from_mask\n");
159 printf(
"With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
161 printf(
"\nTesting av_channel_layout_channel_from_index\n");
163 printf(
"On 5.1(side) layout with 0: %24d\n",
ret);
165 printf(
"On 5.1(side) layout with 1: %24d\n",
ret);
167 printf(
"On 5.1(side) layout with 2: %24d\n",
ret);
169 printf(
"On 5.1(side) layout with 3: %24d\n",
ret);
171 printf(
"On 5.1(side) layout with 4: %24d\n",
ret);
173 printf(
"On 5.1(side) layout with 5: %24d\n",
ret);
175 printf(
"On 5.1(side) layout with 6: %24d\n",
ret);
177 printf(
"\nTesting av_channel_layout_index_from_channel\n");
179 printf(
"On 5.1(side) layout with AV_CHAN_FRONT_LEFT: %7d\n",
ret);
181 printf(
"On 5.1(side) layout with AV_CHAN_FRONT_RIGHT: %6d\n",
ret);
183 printf(
"On 5.1(side) layout with AV_CHAN_FRONT_CENTER: %5d\n",
ret);
185 printf(
"On 5.1(side) layout with AV_CHAN_LOW_FREQUENCY: %4d\n",
ret);
187 printf(
"On 5.1(side) layout with AV_CHAN_SIDE_LEFT: %8d\n",
ret);
189 printf(
"On 5.1(side) layout with AV_CHAN_SIDE_RIGHT: %7d\n",
ret);
191 printf(
"On 5.1(side) layout with AV_CHAN_BACK_CENTER: %6d\n",
ret);
193 printf(
"\nTesting av_channel_layout_channel_from_string\n");
195 printf(
"On 5.1(side) layout with \"FL\": %21d\n",
ret);
197 printf(
"On 5.1(side) layout with \"FR\": %21d\n",
ret);
199 printf(
"On 5.1(side) layout with \"FC\": %21d\n",
ret);
201 printf(
"On 5.1(side) layout with \"LFE\": %20d\n",
ret);
203 printf(
"On 5.1(side) layout with \"SL\": %21d\n",
ret);
205 printf(
"On 5.1(side) layout with \"SR\": %21d\n",
ret);
207 printf(
"On 5.1(side) layout with \"BC\": %21d\n",
ret);
209 printf(
"\nTesting av_channel_layout_index_from_string\n");
211 printf(
"On 5.1(side) layout with \"FL\": %21d\n",
ret);
213 printf(
"On 5.1(side) layout with \"FR\": %21d\n",
ret);
215 printf(
"On 5.1(side) layout with \"FC\": %21d\n",
ret);
217 printf(
"On 5.1(side) layout with \"LFE\": %20d\n",
ret);
219 printf(
"On 5.1(side) layout with \"SL\": %21d\n",
ret);
221 printf(
"On 5.1(side) layout with \"SR\": %21d\n",
ret);
223 printf(
"On 5.1(side) layout with \"BC\": %21d\n",
ret);
225 printf(
"\nTesting av_channel_layout_subset\n");
227 printf(
"On 5.1(side) layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64
"\n",
mask);
229 printf(
"On 5.1(side) layout with AV_CH_LAYOUT_2POINT1: 0x%"PRIx64
"\n",
mask);
231 printf(
"On 5.1(side) layout with AV_CH_LAYOUT_4POINT1: 0x%"PRIx64
"\n",
mask);
233 printf(
"\n==Custom layouts==\n");
235 printf(
"\nTesting av_channel_layout_from_string\n");
237 printf(
"With \"FL+FR+FC+BL+BR+LFE\": %34s\n", bp.str);
239 printf(
"With \"2 channels (FR+FL)\": %34s\n", bp.str);
241 printf(
"With \"ambisonic 1+FR+FL\": %35s\n", bp.str);
243 printf(
"With \"ambisonic 2+FC@Foo\": %34s\n", bp.str);
245 printf(
"With \"FL@Foo+FR@Bar\": %39s\n", bp.str);
247 printf(
"With \"FR+FL@Foo+USR63@Foo\": %33s\n", bp.str);
249 printf(
"\nTesting av_channel_layout_index_from_string\n");
251 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n",
ret);
253 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n",
ret);
255 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n",
ret);
257 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n",
ret);
259 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n",
ret);
261 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n",
ret);
263 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n",
ret);
265 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n",
ret);
267 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n",
ret);
269 printf(
"\nTesting av_channel_layout_channel_from_string\n");
271 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n",
ret);
273 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n",
ret);
275 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n",
ret);
277 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n",
ret);
279 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n",
ret);
281 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n",
ret);
283 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n",
ret);
285 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n",
ret);
287 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n",
ret);
289 printf(
"\nTesting av_channel_layout_index_from_channel\n");
291 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_RIGHT: %3d\n",
ret);
293 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_LEFT: %4d\n",
ret);
295 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with 63: %20d\n",
ret);
297 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_BACK_CENTER: %3d\n",
ret);
299 printf(
"\nTesting av_channel_layout_channel_from_index\n");
301 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with 0: %21d\n",
ret);
303 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with 1: %21d\n",
ret);
305 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with 2: %21d\n",
ret);
307 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with 3: %21d\n",
ret);
309 printf(
"\nTesting av_channel_layout_subset\n");
311 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64
"\n",
mask);
313 printf(
"On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64
"\n",
mask);
315 printf(
"\n==Ambisonic layouts==\n");
317 printf(
"\nTesting av_channel_layout_from_string\n");
319 printf(
"With \"ambisonic 1\": %41s\n", bp.str);
321 printf(
"With \"ambisonic 2+stereo\": %34s\n", bp.str);
323 printf(
"\nTesting av_channel_layout_index_from_channel\n");
325 printf(
"On \"ambisonic 2+stereo\" layout with AV_CHAN_AMBISONIC_BASE: %d\n",
ret);
327 printf(
"On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_LEFT: %5d\n",
ret);
329 printf(
"On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_RIGHT: %4d\n",
ret);
331 printf(
"On \"ambisonic 2+stereo\" layout with AV_CHAN_BACK_CENTER: %4d\n",
ret);
333 printf(
"\nTesting av_channel_layout_channel_from_index\n");
335 printf(
"On \"ambisonic 2+stereo\" layout with 0: %22d\n",
ret);
337 printf(
"On \"ambisonic 2+stereo\" layout with 9: %22d\n",
ret);
339 printf(
"On \"ambisonic 2+stereo\" layout with 10: %21d\n",
ret);
341 printf(
"On \"ambisonic 2+stereo\" layout with 11: %21d\n",
ret);
343 printf(
"\nTesting av_channel_layout_subset\n");
345 printf(
"On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64
"\n",
mask);
347 printf(
"On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64
"\n",
mask);
#define CHANNEL_DESCRIPTION(x)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define CHANNEL_LAYOUT_FROM_STRING(x)
#define AV_BPRINT_SIZE_AUTOMATIC
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_QUAD
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
static const uint16_t mask[17]
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x)
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x)
#define CHANNEL_LAYOUT_SUBSET(x)
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
#define AV_CH_LAYOUT_5POINT1
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define CHANNEL_LAYOUT_FROM_MASK(x)
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannel av_channel_from_string(const char *str)
This is the inverse function of av_channel_name().
printf("static const uint8_t my_array[100] = {\n")
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define i(width, name, range_min, range_max)
#define AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_4POINT1
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(x)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x)