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/error.h"
28 #include "libavutil/internal.h"
29 #include "libavutil/macros.h"
30 #include "libavutil/mem.h"
31 
32 #define BPRINT_ARGS1(bp, ...) (bp), __VA_ARGS__
33 #define BPRINT_ARGS0(bp, ...) __VA_ARGS__, (bp)
34 #define ORD_ARGS1(str, size, ...) (str), (size), __VA_ARGS__
35 #define ORD_ARGS0(str, size, ...) __VA_ARGS__, (str), (size)
36 
37 // This macro presumes the AVBPrint to have been cleared before usage.
38 #define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...) do { \
39  char *str; \
40  int size; \
41  func_name ## _bprint(BPRINT_ARGS ## ARG_ORDER((bp), __VA_ARGS__)); \
42  if (strlen((bp)->str) != (bp)->len) { \
43  printf("strlen of AVBPrint-string returned by "#func_name"_bprint" \
44  " differs from AVBPrint.len: %"SIZE_SPECIFIER" vs. %u\n", \
45  strlen((bp)->str), (bp)->len); \
46  break; \
47  } \
48  size = func_name(ORD_ARGS ## ARG_ORDER(NULL, 0, __VA_ARGS__)); \
49  if (size <= 0) { \
50  printf(#func_name " returned %d\n", size); \
51  break; \
52  } \
53  if ((bp)->len != size - 1) { \
54  printf("Return value %d of " #func_name " inconsistent with length"\
55  " %u obtained from corresponding bprint version\n", \
56  size, (bp)->len); \
57  break; \
58  } \
59  str = av_malloc(size); \
60  if (!str) { \
61  printf("string of size %d could not be allocated.\n", size); \
62  break; \
63  } \
64  size = func_name(ORD_ARGS ## ARG_ORDER(str, size, __VA_ARGS__)); \
65  if (size <= 0 || (bp)->len != size - 1) { \
66  printf("Return value %d of " #func_name " inconsistent with length"\
67  " %d obtained in first pass.\n", size, (bp)->len); \
68  av_free(str); \
69  break; \
70  } \
71  if (strcmp(str, (bp)->str)) { \
72  printf("Ordinary and _bprint versions of "#func_name" disagree: " \
73  "'%s' vs. '%s'\n", str, (bp)->str); \
74  av_free(str); \
75  break; \
76  } \
77  av_free(str); \
78  } while (0)
79 
80 
81 static void channel_name(AVBPrint *bp, enum AVChannel channel)
82 {
83  av_bprint_clear(bp);
85 }
86 
87 static void channel_description(AVBPrint *bp, enum AVChannel channel)
88 {
89  av_bprint_clear(bp);
91 }
92 
94  AVBPrint *bp, uint64_t channel_layout)
95 {
97  av_bprint_clear(bp);
98  if (!av_channel_layout_from_mask(layout, channel_layout) &&
101  else
102  av_bprintf(bp, "fail");
103 }
104 
106  AVBPrint *bp, const char *channel_layout)
107 {
109  av_bprint_clear(bp);
110  if (!av_channel_layout_from_string(layout, channel_layout) &&
113  else
114  av_bprintf(bp, "fail");
115 }
116 
117 static const char* channel_order_names[] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI"};
118 
119 static void describe_type(AVBPrint *bp, AVChannelLayout *layout)
120 {
121  if (layout->order >= 0 && layout->order < FF_ARRAY_ELEMS(channel_order_names)) {
122  av_bprintf(bp, "%-6s (", channel_order_names[layout->order]);
124  av_bprintf(bp, ")");
125  } else {
126  av_bprintf(bp, "???");
127  }
128 }
129 
130 static const char *channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
131 {
133  av_bprint_clear(bp);
134  if (!av_channel_layout_from_string(layout, channel_layout) &&
136  describe_type(bp, layout);
137  for (int i = 0; i < FF_CHANNEL_ORDER_NB; i++) {
138  int ret;
139  AVChannelLayout copy = {0};
140  av_bprintf(bp, "\n ");
142  return "nomem";
144  if (ret < 0 && (copy.order != layout->order || av_channel_layout_compare(&copy, layout)))
145  av_bprintf(bp, "failed to keep existing layout on failure");
146  if (ret >= 0 && copy.order != i)
147  av_bprintf(bp, "returned success but did not change order");
148  if (ret == AVERROR(ENOSYS)) {
149  av_bprintf(bp, " != %s", channel_order_names[i]);
150  } else if (ret < 0) {
151  av_bprintf(bp, "FAIL");
152  } else {
153  av_bprintf(bp, " %s ", ret ? "~~" : "==");
154  describe_type(bp, &copy);
155  }
157  }
158  } else {
159  av_bprintf(bp, "fail");
160  }
161  return bp->str;
162 }
163 
164 #define CHANNEL_NAME(x) \
165  channel_name(&bp, (x));
166 
167 #define CHANNEL_DESCRIPTION(x) \
168  channel_description(&bp, (x));
169 
170 #define CHANNEL_LAYOUT_FROM_MASK(x) \
171  channel_layout_from_mask(&layout, &bp, (x));
172 
173 #define CHANNEL_LAYOUT_FROM_STRING(x) \
174  channel_layout_from_string(&layout, &bp, (x));
175 
176 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x) \
177  ret = av_channel_layout_channel_from_index(&layout, x); \
178  if (ret < 0) \
179  ret = -1
180 
181 #define CHANNEL_LAYOUT_SUBSET(x) \
182  mask = av_channel_layout_subset(&layout, x)
183 
184 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x) \
185  ret = av_channel_layout_index_from_channel(&layout, x); \
186  if (ret < 0) \
187  ret = -1
188 
189 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x) \
190  ret = av_channel_layout_channel_from_string(&layout, x); \
191  if (ret < 0) \
192  ret = -1
193 
194 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(x) \
195  ret = av_channel_layout_index_from_string(&layout, x); \
196  if (ret < 0) \
197  ret = -1
198 
199 int main(void)
200 {
201  const AVChannelLayout *playout;
202  AVChannelLayout layout = { 0 }, layout2 = { 0 };
203  AVBPrint bp;
204  void *iter = NULL;
205  uint64_t mask;
206  int ret;
207 
209 
210  printf("Testing av_channel_layout_standard\n");
211  while (playout = av_channel_layout_standard(&iter)) {
212  av_channel_layout_describe_bprint(playout, &bp);
213  printf("%-14s ", bp.str);
214  av_bprint_clear(&bp);
215  for (int i = 0; i < 63; i++) {
216  int idx = av_channel_layout_index_from_channel(playout, i);
217  if (idx >= 0) {
218  if (idx)
219  av_bprintf(&bp, "+");
221  }
222  }
223  printf("%s\n", bp.str);
224  av_bprint_clear(&bp);
225  }
226 
227  printf("\nTesting av_channel_name\n");
229  printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
231  printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
232  CHANNEL_NAME(63);
233  printf("With 63: %43s\n", bp.str);
235  printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
237  printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
238 
239  printf("Testing av_channel_description\n");
241  printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
243  printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str);
245  printf("With 63: %43s\n", bp.str);
247  printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str);
249  printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str);
250 
251  printf("\nTesting av_channel_from_string\n");
252  printf("With \"FL\": %41d\n", av_channel_from_string("FL"));
253  printf("With \"FR\": %41d\n", av_channel_from_string("FR"));
254  printf("With \"USR63\": %38d\n", av_channel_from_string("USR63"));
255  printf("With \"AMBI0\": %38d\n", av_channel_from_string("AMBI0"));
256  printf("With \"AMBI1023\": %35d\n", av_channel_from_string("AMBI1023"));
257 
258  printf("\n==Native layouts==\n");
259 
260  printf("\nTesting av_channel_layout_from_string\n");
262  printf("With \"0x3f\": %39s\n", bp.str);
264  printf("With \"63\": %41s\n", bp.str);
266  printf("With \"6c\": %41s\n", bp.str);
268  printf("With \"6C\": %41s\n", bp.str);
269  CHANNEL_LAYOUT_FROM_STRING("6 channels");
270  printf("With \"6 channels\": %33s\n", bp.str);
271  CHANNEL_LAYOUT_FROM_STRING("6 channels (FL+FR+FC+LFE+BL+BR)");
272  printf("With \"6 channels (FL+FR+FC+LFE+BL+BR)\": %12s\n", bp.str);
273  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+BL+BR");
274  printf("With \"FL+FR+FC+LFE+BL+BR\": %25s\n", bp.str);
276  printf("With \"5.1\": %40s\n", bp.str);
277  CHANNEL_LAYOUT_FROM_STRING("FL+FR+USR63");
278  printf("With \"FL+FR+USR63\": %32s\n", bp.str);
279  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+SL+SR");
280  printf("With \"FL+FR+FC+LFE+SL+SR\": %25s\n", bp.str);
281  CHANNEL_LAYOUT_FROM_STRING("5.1(side)");
282  printf("With \"5.1(side)\": %34s\n", bp.str);
283 
284  printf("\nTesting av_channel_layout_from_mask\n");
286  printf("With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
287 
288  printf("\nTesting av_channel_layout_channel_from_index\n");
290  printf("On 5.1(side) layout with 0: %24d\n", ret);
292  printf("On 5.1(side) layout with 1: %24d\n", ret);
294  printf("On 5.1(side) layout with 2: %24d\n", ret);
296  printf("On 5.1(side) layout with 3: %24d\n", ret);
298  printf("On 5.1(side) layout with 4: %24d\n", ret);
300  printf("On 5.1(side) layout with 5: %24d\n", ret);
302  printf("On 5.1(side) layout with 6: %24d\n", ret);
303 
304  printf("\nTesting av_channel_layout_index_from_channel\n");
306  printf("On 5.1(side) layout with AV_CHAN_FRONT_LEFT: %7d\n", ret);
308  printf("On 5.1(side) layout with AV_CHAN_FRONT_RIGHT: %6d\n", ret);
310  printf("On 5.1(side) layout with AV_CHAN_FRONT_CENTER: %5d\n", ret);
312  printf("On 5.1(side) layout with AV_CHAN_LOW_FREQUENCY: %4d\n", ret);
314  printf("On 5.1(side) layout with AV_CHAN_SIDE_LEFT: %8d\n", ret);
316  printf("On 5.1(side) layout with AV_CHAN_SIDE_RIGHT: %7d\n", ret);
318  printf("On 5.1(side) layout with AV_CHAN_BACK_CENTER: %6d\n", ret);
319 
320  printf("\nTesting av_channel_layout_channel_from_string\n");
322  printf("On 5.1(side) layout with \"FL\": %21d\n", ret);
324  printf("On 5.1(side) layout with \"FR\": %21d\n", ret);
326  printf("On 5.1(side) layout with \"FC\": %21d\n", ret);
328  printf("On 5.1(side) layout with \"LFE\": %20d\n", ret);
330  printf("On 5.1(side) layout with \"SL\": %21d\n", ret);
332  printf("On 5.1(side) layout with \"SR\": %21d\n", ret);
334  printf("On 5.1(side) layout with \"BC\": %21d\n", ret);
335 
336  printf("\nTesting av_channel_layout_index_from_string\n");
338  printf("On 5.1(side) layout with \"FL\": %21d\n", ret);
340  printf("On 5.1(side) layout with \"FR\": %21d\n", ret);
342  printf("On 5.1(side) layout with \"FC\": %21d\n", ret);
344  printf("On 5.1(side) layout with \"LFE\": %20d\n", ret);
346  printf("On 5.1(side) layout with \"SL\": %21d\n", ret);
348  printf("On 5.1(side) layout with \"SR\": %21d\n", ret);
350  printf("On 5.1(side) layout with \"BC\": %21d\n", ret);
351 
352  printf("\nTesting av_channel_layout_subset\n");
354  printf("On 5.1(side) layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
356  printf("On 5.1(side) layout with AV_CH_LAYOUT_2POINT1: 0x%"PRIx64"\n", mask);
358  printf("On 5.1(side) layout with AV_CH_LAYOUT_4POINT1: 0x%"PRIx64"\n", mask);
359 
360  printf("\n==Custom layouts==\n");
361 
362  printf("\nTesting av_channel_layout_from_string\n");
363  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+BL+BR+LFE");
364  printf("With \"FL+FR+FC+BL+BR+LFE\": %34s\n", bp.str);
365  CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)");
366  printf("With \"2 channels (FR+FL)\": %34s\n", bp.str);
367  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL");
368  printf("With \"ambisonic 1+FR+FL\": %35s\n", bp.str);
369  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+FC@Foo");
370  printf("With \"ambisonic 2+FC@Foo\": %34s\n", bp.str);
371  CHANNEL_LAYOUT_FROM_STRING("FL@Foo+FR@Bar");
372  printf("With \"FL@Foo+FR@Bar\": %39s\n", bp.str);
373  CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo");
374  printf("With \"FR+FL@Foo+USR63@Foo\": %33s\n", bp.str);
375 
376  ret = av_channel_layout_copy(&layout2, &layout);
377  if (ret < 0) {
378  printf("Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
379  "ret %d\n", ret);
380  }
381  ret = av_channel_layout_compare(&layout, &layout2);
382  if (ret)
383  printf("Channel layout and its copy compare unequal; ret: %d\n", ret);
384 
385  printf("\nTesting av_channel_layout_index_from_string\n");
387  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n", ret);
389  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n", ret);
391  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n", ret);
393  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n", ret);
395  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n", ret);
397  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n", ret);
399  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n", ret);
401  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n", ret);
403  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n", ret);
404 
405  printf("\nTesting av_channel_layout_channel_from_string\n");
407  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR\": %18d\n", ret);
409  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL\": %18d\n", ret);
411  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63\": %15d\n", ret);
413  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"Foo\": %17d\n", ret);
415  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"@Foo\": %16d\n", ret);
417  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FR@Foo\": %14d\n", ret);
419  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"FL@Foo\": %14d\n", ret);
421  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"USR63@Foo\": %11d\n", ret);
423  printf("On \"FR+FL@Foo+USR63@Foo\" layout with \"BC\": %18d\n", ret);
424 
425  printf("\nTesting av_channel_layout_index_from_channel\n");
427  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_RIGHT: %3d\n", ret);
429  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_FRONT_LEFT: %4d\n", ret);
431  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 63: %20d\n", ret);
433  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CHAN_BACK_CENTER: %3d\n", ret);
434 
435  printf("\nTesting av_channel_layout_channel_from_index\n");
437  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 0: %21d\n", ret);
439  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 1: %21d\n", ret);
441  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 2: %21d\n", ret);
443  printf("On \"FR+FL@Foo+USR63@Foo\" layout with 3: %21d\n", ret);
444 
445  printf("\nTesting av_channel_layout_subset\n");
447  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
449  printf("On \"FR+FL@Foo+USR63@Foo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64"\n", mask);
450 
451  printf("\n==Ambisonic layouts==\n");
452 
453  printf("\nTesting av_channel_layout_from_string\n");
454  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1");
455  printf("With \"ambisonic 1\": %41s\n", bp.str);
456  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+stereo");
457  printf("With \"ambisonic 2+stereo\": %34s\n", bp.str);
458 
459  printf("\nTesting av_channel_layout_index_from_channel\n");
461  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_AMBISONIC_BASE: %d\n", ret);
463  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_LEFT: %5d\n", ret);
465  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_RIGHT: %4d\n", ret);
467  printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_BACK_CENTER: %4d\n", ret);
468 
469  printf("\nTesting av_channel_layout_channel_from_index\n");
471  printf("On \"ambisonic 2+stereo\" layout with 0: %22d\n", ret);
473  printf("On \"ambisonic 2+stereo\" layout with 9: %22d\n", ret);
475  printf("On \"ambisonic 2+stereo\" layout with 10: %21d\n", ret);
477  printf("On \"ambisonic 2+stereo\" layout with 11: %21d\n", ret);
478 
479  printf("\nTesting av_channel_layout_subset\n");
481  printf("On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
483  printf("On \"ambisonic 2+stereo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64"\n", mask);
484 
486  av_channel_layout_uninit(&layout2);
487 
488  printf("\nTesting av_channel_layout_retype\n");
489  {
490  const char* layouts[] = {
491  "FL@Boo",
492  "stereo",
493  "FR+FL",
494  "ambisonic 2+stereo",
495  "2C",
496  NULL
497  };
498  for (int i = 0; layouts[i]; i++)
499  printf("With \"%s\": %s\n", layouts[i], channel_layout_retype(&layout, &bp, layouts[i]));
500  }
501  av_bprint_finalize(&bp, NULL);
502 
503  return 0;
504 }
CHANNEL_DESCRIPTION
#define CHANNEL_DESCRIPTION(x)
Definition: channel_layout.c:167
AVERROR
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 sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
FF_CHANNEL_ORDER_NB
@ FF_CHANNEL_ORDER_NB
Number of channel orders, not part of ABI/API.
Definition: channel_layout.h:152
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:326
CHANNEL_LAYOUT_FROM_STRING
#define CHANNEL_LAYOUT_FROM_STRING(x)
Definition: channel_layout.c:173
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:793
macros.h
channel_order_names
static const char * channel_order_names[]
Definition: channel_layout.c:117
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:215
describe_type
static void describe_type(AVBPrint *bp, AVChannelLayout *layout)
Definition: channel_layout.c:119
channel_name
static void channel_name(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:81
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:223
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
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:847
CHANNEL_LAYOUT_CHANNEL_FROM_INDEX
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(x)
Definition: channel_layout.c:176
CHANNEL_LAYOUT_CHANNEL_FROM_STRING
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(x)
Definition: channel_layout.c:189
av_channel_layout_from_mask
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:421
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:1046
channel_description
static void channel_description(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:87
NULL
#define NULL
Definition: coverity.c:32
CHANNEL_LAYOUT_SUBSET
#define CHANNEL_LAYOUT_SUBSET(x)
Definition: channel_layout.c:181
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:225
main
int main(void)
Definition: channel_layout.c:199
channel_layout_from_string
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:105
error.h
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:170
copy
static void copy(const float *p1, float *p2, const int length)
Definition: vf_vaguedenoiser.c:185
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:313
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")
channel_layout_retype
static const char * channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:130
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_retype
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
Definition: channel_layout.c:1079
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:1003
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:434
bprint.h
CHANNEL_NAME
#define CHANNEL_NAME(x)
Definition: channel_layout.c:164
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:245
AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_2POINT1
Definition: channel_layout.h:216
channel_layout_from_mask
static void channel_layout_from_mask(AVChannelLayout *layout, AVBPrint *bp, uint64_t channel_layout)
Definition: channel_layout.c:93
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:221
ret
ret
Definition: filter_design.txt:187
CHANNEL_LAYOUT_INDEX_FROM_STRING
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(x)
Definition: channel_layout.c:194
CMP_BPRINT_AND_NONBPRINT
#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER,...)
Definition: channel_layout.c:38
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:977
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:907
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:662
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:669
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:184
channel
channel
Definition: ebur128.h:39