FFmpeg
channel_layout.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 James Almer
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <inttypes.h>
22 #include <stdio.h>
23 #include <string.h>
24 
25 #include "libavutil/bprint.h"
27 #include "libavutil/internal.h"
28 #include "libavutil/mem.h"
29 
30 #define BPRINT_ARGS1(bp, ...) (bp), __VA_ARGS__
31 #define BPRINT_ARGS0(bp, ...) __VA_ARGS__, (bp)
32 #define ORD_ARGS1(str, size, ...) (str), (size), __VA_ARGS__
33 #define ORD_ARGS0(str, size, ...) __VA_ARGS__, (str), (size)
34 
35 // This macro presumes the AVBPrint to have been cleared before usage.
36 #define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...) do { \
37  char *str; \
38  int size; \
39  func_name ## _bprint(BPRINT_ARGS ## ARG_ORDER((bp), __VA_ARGS__)); \
40  if (strlen((bp)->str) != (bp)->len) { \
41  printf("strlen of AVBPrint-string returned by "#func_name"_bprint" \
42  " differs from AVBPrint.len: %"SIZE_SPECIFIER" vs. %u\n", \
43  strlen((bp)->str), (bp)->len); \
44  break; \
45  } \
46  size = func_name(ORD_ARGS ## ARG_ORDER(NULL, 0, __VA_ARGS__)); \
47  if (size <= 0) { \
48  printf(#func_name " returned %d\n", size); \
49  break; \
50  } \
51  if ((bp)->len != size - 1) { \
52  printf("Return value %d of " #func_name " inconsistent with length"\
53  " %u obtained from corresponding bprint version\n", \
54  size, (bp)->len); \
55  break; \
56  } \
57  str = av_malloc(size); \
58  if (!str) { \
59  printf("string of size %d could not be allocated.\n", size); \
60  break; \
61  } \
62  size = func_name(ORD_ARGS ## ARG_ORDER(str, size, __VA_ARGS__)); \
63  if (size <= 0 || (bp)->len != size - 1) { \
64  printf("Return value %d of " #func_name " inconsistent with length"\
65  " %d obtained in first pass.\n", size, (bp)->len); \
66  av_free(str); \
67  break; \
68  } \
69  if (strcmp(str, (bp)->str)) { \
70  printf("Ordinary and _bprint versions of "#func_name" disagree: " \
71  "'%s' vs. '%s'\n", str, (bp)->str); \
72  av_free(str); \
73  break; \
74  } \
75  av_free(str); \
76  } while (0)
77 
78 
79 static void channel_name(AVBPrint *bp, enum AVChannel channel)
80 {
81  av_bprint_clear(bp);
83 }
84 
85 static void channel_description(AVBPrint *bp, enum AVChannel channel)
86 {
87  av_bprint_clear(bp);
89 }
90 
92  AVBPrint *bp, uint64_t channel_layout)
93 {
95  av_bprint_clear(bp);
96  if (!av_channel_layout_from_mask(layout, channel_layout) &&
99  else
100  av_bprintf(bp, "fail");
101 }
102 
104  AVBPrint *bp, const char *channel_layout)
105 {
107  av_bprint_clear(bp);
108  if (!av_channel_layout_from_string(layout, channel_layout) &&
111  else
112  av_bprintf(bp, "fail");
113 }
114 
115 #define CHANNEL_NAME(x) \
116  channel_name(&bp, (x));
117 
118 #define CHANNEL_DESCRIPTION(x) \
119  channel_description(&bp, (x));
120 
121 #define CHANNEL_LAYOUT_FROM_MASK(x) \
122  channel_layout_from_mask(&layout, &bp, (x));
123 
124 #define CHANNEL_LAYOUT_FROM_STRING(x) \
125  channel_layout_from_string(&layout, &bp, (x));
126 
127 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x) \
128  ret = av_channel_layout_channel_from_index(&layout, x); \
129  if (ret < 0) \
130  ret = -1
131 
132 #define CHANNEL_LAYOUT_SUBSET(x) \
133  mask = av_channel_layout_subset(&layout, x)
134 
135 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x) \
136  ret = av_channel_layout_index_from_channel(&layout, x); \
137  if (ret < 0) \
138  ret = -1
139 
140 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x) \
141  ret = av_channel_layout_channel_from_string(&layout, x); \
142  if (ret < 0) \
143  ret = -1
144 
145 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(x) \
146  ret = av_channel_layout_index_from_string(&layout, x); \
147  if (ret < 0) \
148  ret = -1
149 
150 int main(void)
151 {
152  const AVChannelLayout *playout;
153  AVChannelLayout layout = { 0 }, layout2 = { 0 };
154  AVBPrint bp;
155  void *iter = NULL;
156  uint64_t mask;
157  int ret;
158 
160 
161  printf("Testing av_channel_layout_standard\n");
162  while (playout = av_channel_layout_standard(&iter)) {
163  av_channel_layout_describe_bprint(playout, &bp);
164  printf("%-14s ", bp.str);
165  av_bprint_clear(&bp);
166  for (int i = 0; i < 63; i++) {
167  int idx = av_channel_layout_index_from_channel(playout, i);
168  if (idx >= 0) {
169  if (idx)
170  av_bprintf(&bp, "+");
172  }
173  }
174  printf("%s\n", bp.str);
175  av_bprint_clear(&bp);
176  }
177 
178  printf("\nTesting av_channel_name\n");
180  printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
182  printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
183  CHANNEL_NAME(63);
184  printf("With 63: %43s\n", bp.str);
186  printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
188  printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
189 
190  printf("Testing av_channel_description\n");
192  printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
194  printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
196  printf("With 63: %43s\n", bp.str);
198  printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
200  printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
201 
202  printf("\nTesting av_channel_from_string\n");
203  printf("With \"FL\": %41d\n", av_channel_from_string("FL"));
204  printf("With \"FR\": %41d\n", av_channel_from_string("FR"));
205  printf("With \"USR63\": %38d\n", av_channel_from_string("USR63"));
206  printf("With \"AMBI0\": %38d\n", av_channel_from_string("AMBI0"));
207  printf("With \"AMBI1023\": %35d\n", av_channel_from_string("AMBI1023"));
208 
209  printf("\n==Native layouts==\n");
210 
211  printf("\nTesting av_channel_layout_from_string\n");
213  printf("With \"0x3f\": %39s\n", bp.str);
215  printf("With \"63\": %41s\n", bp.str);
217  printf("With \"6c\": %41s\n", bp.str);
219  printf("With \"6C\": %41s\n", bp.str);
220  CHANNEL_LAYOUT_FROM_STRING("6 channels");
221  printf("With \"6 channels\": %33s\n", bp.str);
222  CHANNEL_LAYOUT_FROM_STRING("6 channels (FL+FR+FC+LFE+BL+BR)");
223  printf("With \"6 channels (FL+FR+FC+LFE+BL+BR)\": %12s\n", bp.str);
224  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+BL+BR");
225  printf("With \"FL+FR+FC+LFE+BL+BR\": %25s\n", bp.str);
227  printf("With \"5.1\": %40s\n", bp.str);
228  CHANNEL_LAYOUT_FROM_STRING("FL+FR+USR63");
229  printf("With \"FL+FR+USR63\": %32s\n", bp.str);
230  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+SL+SR");
231  printf("With \"FL+FR+FC+LFE+SL+SR\": %25s\n", bp.str);
232  CHANNEL_LAYOUT_FROM_STRING("5.1(side)");
233  printf("With \"5.1(side)\": %34s\n", bp.str);
234 
235  printf("\nTesting av_channel_layout_from_mask\n");
237  printf("With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
238 
239  printf("\nTesting av_channel_layout_channel_from_index\n");
241  printf("On 5.1(side) layout with 0: %24d\n", ret);
243  printf("On 5.1(side) layout with 1: %24d\n", ret);
245  printf("On 5.1(side) layout with 2: %24d\n", ret);
247  printf("On 5.1(side) layout with 3: %24d\n", ret);
249  printf("On 5.1(side) layout with 4: %24d\n", ret);
251  printf("On 5.1(side) layout with 5: %24d\n", ret);
253  printf("On 5.1(side) layout with 6: %24d\n", ret);
254 
255  printf("\nTesting av_channel_layout_index_from_channel\n");
257  printf("On 5.1(side) layout with AV_CHAN_FRONT_LEFT: %7d\n", ret);
259  printf("On 5.1(side) layout with AV_CHAN_FRONT_RIGHT: %6d\n", ret);
261  printf("On 5.1(side) layout with AV_CHAN_FRONT_CENTER: %5d\n", ret);
263  printf("On 5.1(side) layout with AV_CHAN_LOW_FREQUENCY: %4d\n", ret);
265  printf("On 5.1(side) layout with AV_CHAN_SIDE_LEFT: %8d\n", ret);
267  printf("On 5.1(side) layout with AV_CHAN_SIDE_RIGHT: %7d\n", ret);
269  printf("On 5.1(side) layout with AV_CHAN_BACK_CENTER: %6d\n", ret);
270 
271  printf("\nTesting av_channel_layout_channel_from_string\n");
273  printf("On 5.1(side) layout with \"FL\": %21d\n", ret);
275  printf("On 5.1(side) layout with \"FR\": %21d\n", ret);
277  printf("On 5.1(side) layout with \"FC\": %21d\n", ret);
279  printf("On 5.1(side) layout with \"LFE\": %20d\n", ret);
281  printf("On 5.1(side) layout with \"SL\": %21d\n", ret);
283  printf("On 5.1(side) layout with \"SR\": %21d\n", ret);
285  printf("On 5.1(side) layout with \"BC\": %21d\n", ret);
286 
287  printf("\nTesting av_channel_layout_index_from_string\n");
289  printf("On 5.1(side) layout with \"FL\": %21d\n", ret);
291  printf("On 5.1(side) layout with \"FR\": %21d\n", ret);
293  printf("On 5.1(side) layout with \"FC\": %21d\n", ret);
295  printf("On 5.1(side) layout with \"LFE\": %20d\n", ret);
297  printf("On 5.1(side) layout with \"SL\": %21d\n", ret);
299  printf("On 5.1(side) layout with \"SR\": %21d\n", ret);
301  printf("On 5.1(side) layout with \"BC\": %21d\n", ret);
302 
303  printf("\nTesting av_channel_layout_subset\n");
305  printf("On 5.1(side) layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
307  printf("On 5.1(side) layout with AV_CH_LAYOUT_2POINT1: 0x%"PRIx64"\n", mask);
309  printf("On 5.1(side) layout with AV_CH_LAYOUT_4POINT1: 0x%"PRIx64"\n", mask);
310 
311  printf("\n==Custom layouts==\n");
312 
313  printf("\nTesting av_channel_layout_from_string\n");
314  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+BL+BR+LFE");
315  printf("With \"FL+FR+FC+BL+BR+LFE\": %34s\n", bp.str);
316  CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)");
317  printf("With \"2 channels (FR+FL)\": %34s\n", bp.str);
318  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL");
319  printf("With \"ambisonic 1+FR+FL\": %35s\n", bp.str);
320  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+FC@Foo");
321  printf("With \"ambisonic 2+FC@Foo\": %34s\n", bp.str);
322  CHANNEL_LAYOUT_FROM_STRING("FL@Foo+FR@Bar");
323  printf("With \"FL@Foo+FR@Bar\": %39s\n", bp.str);
324  CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo");
325  printf("With \"FR+FL@Foo+USR63@Foo\": %33s\n", bp.str);
326 
327  ret = av_channel_layout_copy(&layout2, &layout);
328  if (ret < 0) {
329  printf("Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
330  "ret %d\n", ret);
331  }
332  ret = av_channel_layout_compare(&layout, &layout2);
333  if (ret)
334  printf("Channel layout and its copy compare unequal; ret: %d\n", ret);
335 
336  printf("\nTesting av_channel_layout_index_from_string\n");
338  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n", ret);
340  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n", ret);
342  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n", ret);
344  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n", ret);
346  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n", ret);
348  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n", ret);
350  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n", ret);
352  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n", ret);
354  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n", ret);
355 
356  printf("\nTesting av_channel_layout_channel_from_string\n");
358  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n", ret);
360  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n", ret);
362  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n", ret);
364  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n", ret);
366  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n", ret);
368  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n", ret);
370  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n", ret);
372  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n", ret);
374  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n", ret);
375 
376  printf("\nTesting av_channel_layout_index_from_channel\n");
378  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_RIGHT: %3d\n", ret);
380  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_LEFT: %4d\n", ret);
382  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 63: %20d\n", ret);
384  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_BACK_CENTER: %3d\n", ret);
385 
386  printf("\nTesting av_channel_layout_channel_from_index\n");
388  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 0: %21d\n", ret);
390  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 1: %21d\n", ret);
392  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 2: %21d\n", ret);
394  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 3: %21d\n", ret);
395 
396  printf("\nTesting av_channel_layout_subset\n");
398  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
400  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64"\n", mask);
401 
402  printf("\n==Ambisonic layouts==\n");
403 
404  printf("\nTesting av_channel_layout_from_string\n");
405  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1");
406  printf("With \"ambisonic 1\": %41s\n", bp.str);
407  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+stereo");
408  printf("With \"ambisonic 2+stereo\": %34s\n", bp.str);
409 
410  printf("\nTesting av_channel_layout_index_from_channel\n");
412  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_AMBISONIC_BASE: %d\n", ret);
414  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_LEFT: %5d\n", ret);
416  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_RIGHT: %4d\n", ret);
418  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_BACK_CENTER: %4d\n", ret);
419 
420  printf("\nTesting av_channel_layout_channel_from_index\n");
422  printf("On \"ambisonic 2+stereo\" layout with 0: %22d\n", ret);
424  printf("On \"ambisonic 2+stereo\" layout with 9: %22d\n", ret);
426  printf("On \"ambisonic 2+stereo\" layout with 10: %21d\n", ret);
428  printf("On \"ambisonic 2+stereo\" layout with 11: %21d\n", ret);
429 
430  printf("\nTesting av_channel_layout_subset\n");
432  printf("On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
434  printf("On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64"\n", mask);
435 
437  av_channel_layout_uninit(&layout2);
438  av_bprint_finalize(&bp, NULL);
439 
440  return 0;
441 }
CHANNEL_DESCRIPTION
#define CHANNEL_DESCRIPTION(x)
Definition: channel_layout.c:118
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
CHANNEL_LAYOUT_FROM_STRING
#define CHANNEL_LAYOUT_FROM_STRING(x)
Definition: channel_layout.c:124
av_channel_layout_describe_bprint
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
Definition: channel_layout.c:740
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:211
channel_name
static void channel_name(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:79
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:219
mask
static const uint16_t mask[17]
Definition: lzw.c:38
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:786
CHANNEL_LAYOUT_CHANNEL_FROM_INDEX
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x)
Definition: channel_layout.c:127
CHANNEL_LAYOUT_CHANNEL_FROM_STRING
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x)
Definition: channel_layout.c:140
av_channel_layout_from_mask
FF_ENABLE_DEPRECATION_WARNINGS int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
Definition: channel_layout.c:399
AV_CHAN_SIDE_RIGHT
@ AV_CHAN_SIDE_RIGHT
Definition: channel_layout.h:60
av_channel_layout_standard
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
Definition: channel_layout.c:985
channel_description
static void channel_description(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:85
NULL
#define NULL
Definition: coverity.c:32
CHANNEL_LAYOUT_SUBSET
#define CHANNEL_LAYOUT_SUBSET(x)
Definition: channel_layout.c:132
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:221
main
int main(void)
Definition: channel_layout.c:150
channel_layout_from_string
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:103
AV_CHAN_FRONT_RIGHT
@ AV_CHAN_FRONT_RIGHT
Definition: channel_layout.h:51
AV_CHAN_FRONT_CENTER
@ AV_CHAN_FRONT_CENTER
Definition: channel_layout.h:52
CHANNEL_LAYOUT_FROM_MASK
#define CHANNEL_LAYOUT_FROM_MASK(x)
Definition: channel_layout.c:121
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:307
AV_CHAN_LOW_FREQUENCY
@ AV_CHAN_LOW_FREQUENCY
Definition: channel_layout.h:53
AV_CHAN_SIDE_LEFT
@ AV_CHAN_SIDE_LEFT
Definition: channel_layout.h:59
AV_CHAN_AMBISONIC_END
@ AV_CHAN_AMBISONIC_END
Definition: channel_layout.h:104
printf
printf("static const uint8_t my_array[100] = {\n")
av_channel_description
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
Definition: channel_layout.c:130
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:942
layout
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
Definition: filter_design.txt:18
AVChannel
AVChannel
Definition: channel_layout.h:47
av_channel_layout_from_string
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
Definition: channel_layout.c:412
bprint.h
CHANNEL_NAME
#define CHANNEL_NAME(x)
Definition: channel_layout.c:115
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_2POINT1
Definition: channel_layout.h:212
channel_layout_from_mask
static void channel_layout_from_mask(AVChannelLayout *layout, AVBPrint *bp, uint64_t channel_layout)
Definition: channel_layout.c:91
internal.h
av_channel_name
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string in an abbreviated form describing a given channel.
Definition: channel_layout.c:101
AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_4POINT1
Definition: channel_layout.h:217
ret
ret
Definition: filter_design.txt:187
CHANNEL_LAYOUT_INDEX_FROM_STRING
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(x)
Definition: channel_layout.c:145
CMP_BPRINT_AND_NONBPRINT
#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER,...)
Definition: channel_layout.c:36
av_channel_layout_check
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
Definition: channel_layout.c:916
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:99
AV_CHAN_BACK_CENTER
@ AV_CHAN_BACK_CENTER
Definition: channel_layout.h:58
av_channel_from_string
enum AVChannel av_channel_from_string(const char *str)
This is the inverse function of av_channel_name().
Definition: channel_layout.c:145
channel_layout.h
av_channel_layout_index_from_channel
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.
Definition: channel_layout.c:846
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:232
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:640
av_channel_layout_copy
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
Definition: channel_layout.c:647
mem.h
AV_CHAN_AMBISONIC_BASE
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
Definition: channel_layout.h:101
AV_CHAN_FRONT_LEFT
@ AV_CHAN_FRONT_LEFT
Definition: channel_layout.h:50
av_channel_name_bprint
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().
Definition: channel_layout.c:87
CHANNEL_LAYOUT_INDEX_FROM_CHANNEL
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x)
Definition: channel_layout.c:135
channel
channel
Definition: ebur128.h:39