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  printf("With %-32s %14s\n", AV_STRINGIFY(x)":", bp.str)
167 
168 #define CHANNEL_DESCRIPTION(x) \
169  channel_description(&bp, (x)); \
170  printf("With %-23s %23s\n", AV_STRINGIFY(x)":", bp.str);
171 
172 #define CHANNEL_FROM_STRING(x) \
173  printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))
174 
175 #define CHANNEL_LAYOUT_FROM_MASK(x) \
176  channel_layout_from_mask(&layout, &bp, (x));
177 
178 #define CHANNEL_LAYOUT_FROM_STRING(x) \
179  channel_layout_from_string(&layout, &bp, (x)); \
180  printf("With \"%s\":%*s %32s\n", x, strlen(x) > 32 ? 0 : 32 - (int)strlen(x), "", bp.str);
181 
182 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x) \
183  ret = av_channel_layout_channel_from_index(&layout, x); \
184  if (ret < 0) \
185  ret = -1; \
186  printf("On \"%s\" layout with %2d: %8d\n", l, x, ret)
187 
188 #define CHANNEL_LAYOUT_SUBSET(l, xstr, x) \
189  mask = av_channel_layout_subset(&layout, x); \
190  printf("On \"%s\" layout with %-22s 0x%"PRIx64"\n", l, xstr, mask)
191 
192 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x) \
193  ret = av_channel_layout_index_from_channel(&layout, x); \
194  if (ret < 0) \
195  ret = -1; \
196  printf("On \"%s\" layout with %-23s %3d\n", l, AV_STRINGIFY(x)":", ret)
197 
198 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x) \
199  ret = av_channel_layout_channel_from_string(&layout, x); \
200  if (ret < 0) \
201  ret = -1; \
202  printf("On \"%s\" layout with %-21s %3d\n", bp.str, AV_STRINGIFY(x)":", ret);
203 
204 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x) \
205  ret = av_channel_layout_index_from_string(&layout, x); \
206  if (ret < 0) \
207  ret = -1; \
208  printf("On \"%s\" layout with %-20s %3d\n", l, AV_STRINGIFY(x)":", ret);
209 
210 int main(void)
211 {
212  const AVChannelLayout *playout;
213  AVChannelLayout layout = { 0 }, layout2 = { 0 };
214  AVBPrint bp;
215  void *iter = NULL;
216  uint64_t mask;
217  int ret;
218 
220 
221  printf("Testing av_channel_layout_standard\n");
222  while (playout = av_channel_layout_standard(&iter)) {
223  av_channel_layout_describe_bprint(playout, &bp);
224  printf("%-14s ", bp.str);
225  av_bprint_clear(&bp);
226  for (int i = 0; i < 63; i++) {
227  int idx = av_channel_layout_index_from_channel(playout, i);
228  if (idx >= 0) {
229  if (idx)
230  av_bprintf(&bp, "+");
232  }
233  }
234  printf("%s\n", bp.str);
235  av_bprint_clear(&bp);
236  }
237 
238  printf("\nTesting av_channel_name\n");
241  CHANNEL_NAME(63);
244 
245  printf("Testing av_channel_description\n");
251 
252  printf("\nTesting av_channel_from_string\n");
253  CHANNEL_FROM_STRING("FL");
254  CHANNEL_FROM_STRING("FR");
255  CHANNEL_FROM_STRING("USR63");
256  CHANNEL_FROM_STRING("AMBI0");
257  CHANNEL_FROM_STRING("AMBI1023");
258  CHANNEL_FROM_STRING("AMBI1024");
259  CHANNEL_FROM_STRING("Dummy");
260  CHANNEL_FROM_STRING("FL@Foo");
261  CHANNEL_FROM_STRING("Foo@FL");
262  CHANNEL_FROM_STRING("@FL");
263 
264  printf("\n==Native layouts==\n");
265 
266  printf("\nTesting av_channel_layout_from_string\n");
271  CHANNEL_LAYOUT_FROM_STRING("6 channels");
272  CHANNEL_LAYOUT_FROM_STRING("6 channels (FL+FR+FC+LFE+BL+BR)");
273  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+BL+BR");
275  CHANNEL_LAYOUT_FROM_STRING("FL+FR+USR63");
276  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+SL+SR");
277  CHANNEL_LAYOUT_FROM_STRING("5.1(side)");
278 
279  printf("\nTesting av_channel_layout_from_mask\n");
281  printf("With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
282 
283  printf("\nTesting av_channel_layout_channel_from_index\n");
291 
292  printf("\nTesting av_channel_layout_index_from_channel\n");
300 
301  printf("\nTesting av_channel_layout_channel_from_string\n");
305  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "LFE");
310  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@Foo");
311  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FL@Foo");
312 
313  printf("\nTesting av_channel_layout_index_from_string\n");
314  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL");
315  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR");
316  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FC");
317  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "LFE");
318  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "SL");
319  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "SR");
320  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "BC");
321 
322  printf("\nTesting av_channel_layout_subset\n");
323  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
324  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_2POINT1:", AV_CH_LAYOUT_2POINT1);
325  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_4POINT1:", AV_CH_LAYOUT_4POINT1);
326 
327  printf("\n==Custom layouts==\n");
328 
329  printf("\nTesting av_channel_layout_from_string\n");
330  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+BL+BR+LFE");
331  CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)");
332  CHANNEL_LAYOUT_FROM_STRING("2 channels (AMBI1023+FL)");
333  CHANNEL_LAYOUT_FROM_STRING("3 channels (FR+FL)");
334  CHANNEL_LAYOUT_FROM_STRING("-3 channels (FR+FL)");
335  CHANNEL_LAYOUT_FROM_STRING("0 channels ()");
336  CHANNEL_LAYOUT_FROM_STRING("2 channels (FL+FR");
337  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL");
338  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+FC@Foo");
339  CHANNEL_LAYOUT_FROM_STRING("FL@Foo+FR@Bar");
340  CHANNEL_LAYOUT_FROM_STRING("FL+stereo");
341  CHANNEL_LAYOUT_FROM_STRING("stereo+stereo");
342  CHANNEL_LAYOUT_FROM_STRING("stereo@Boo");
345  CHANNEL_LAYOUT_FROM_STRING("@Dummy");
348  CHANNEL_LAYOUT_FROM_STRING("Dummy@FL");
349  CHANNEL_LAYOUT_FROM_STRING("FR+Dummy");
350  CHANNEL_LAYOUT_FROM_STRING("FR+Dummy@FL");
351  CHANNEL_LAYOUT_FROM_STRING("UNK+UNSD");
353  CHANNEL_LAYOUT_FROM_STRING("FR+@FL");
355  CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo");
356 
357  ret = av_channel_layout_copy(&layout2, &layout);
358  if (ret < 0) {
359  printf("Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
360  "ret %d\n", ret);
361  }
362  ret = av_channel_layout_compare(&layout, &layout2);
363  if (ret)
364  printf("Channel layout and its copy compare unequal; ret: %d\n", ret);
365 
366  printf("\nTesting av_channel_layout_index_from_string\n");
367  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR");
368  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL");
369  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "USR63");
370  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "Foo");
371  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "@Foo");
372  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR@Foo");
373  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL@Foo");
374  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "USR63@Foo");
375  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "BC");
376 
377  printf("\nTesting av_channel_layout_channel_from_string\n");
380  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "USR63");
381  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "Foo");
382  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@Foo");
383  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FR@Foo");
384  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FL@Foo");
385  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "USR63@Foo");
387 
388  printf("\nTesting av_channel_layout_index_from_channel\n");
393 
394  printf("\nTesting av_channel_layout_channel_from_index\n");
399 
400  printf("\nTesting av_channel_layout_subset\n");
401  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
402  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_QUAD:", AV_CH_LAYOUT_QUAD);
403 
404  printf("\n==Ambisonic layouts==\n");
405 
406  printf("\nTesting av_channel_layout_from_string\n");
407  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1");
408  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+stereo");
409 
410  printf("\nTesting av_channel_layout_index_from_channel\n");
415 
416  printf("\nTesting av_channel_layout_channel_from_index\n");
421 
422  printf("\nTesting av_channel_layout_subset\n");
423  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
424  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_QUAD:", AV_CH_LAYOUT_QUAD);
425 
427  av_channel_layout_uninit(&layout2);
428 
429  printf("\nTesting av_channel_layout_retype\n");
430  {
431  const char* layouts[] = {
432  "FL@Boo",
433  "stereo",
434  "FR+FL",
435  "ambisonic 2+stereo",
436  "2C",
437  NULL
438  };
439  for (int i = 0; layouts[i]; i++)
440  printf("With \"%s\": %s\n", layouts[i], channel_layout_retype(&layout, &bp, layouts[i]));
441  }
442  av_bprint_finalize(&bp, NULL);
443 
444  return 0;
445 }
CHANNEL_DESCRIPTION
#define CHANNEL_DESCRIPTION(x)
Definition: channel_layout.c:168
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:159
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:335
CHANNEL_FROM_STRING
#define CHANNEL_FROM_STRING(x)
Definition: channel_layout.c:172
mask
int mask
Definition: mediacodecdec_common.c:154
CHANNEL_LAYOUT_FROM_STRING
#define CHANNEL_LAYOUT_FROM_STRING(x)
Definition: channel_layout.c:178
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:597
CHANNEL_LAYOUT_CHANNEL_FROM_INDEX
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x)
Definition: channel_layout.c:182
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:218
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:226
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
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:651
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:250
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:850
channel_description
static void channel_description(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:87
NULL
#define NULL
Definition: coverity.c:32
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:228
main
int main(void)
Definition: channel_layout.c:210
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:175
copy
static void copy(const float *p1, float *p2, const int length)
Definition: vf_vaguedenoiser.c:186
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:317
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:111
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:137
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:883
CHANNEL_LAYOUT_SUBSET
#define CHANNEL_LAYOUT_SUBSET(l, xstr, x)
Definition: channel_layout.c:188
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:807
CHANNEL_LAYOUT_INDEX_FROM_CHANNEL
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x)
Definition: channel_layout.c:192
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:310
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:256
AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_2POINT1
Definition: channel_layout.h:219
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:104
AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_4POINT1
Definition: channel_layout.h:224
ret
ret
Definition: filter_design.txt:187
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:781
CHANNEL_LAYOUT_CHANNEL_FROM_STRING
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x)
Definition: channel_layout.c:198
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
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:711
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:440
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:447
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:108
CHANNEL_LAYOUT_INDEX_FROM_STRING
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x)
Definition: channel_layout.c:204
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:86
channel
channel
Definition: ebur128.h:39