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/macros.h"
29 #include "libavutil/mem.h"
30 
31 #define BPRINT_ARGS1(bp, ...) (bp), __VA_ARGS__
32 #define BPRINT_ARGS0(bp, ...) __VA_ARGS__, (bp)
33 #define ORD_ARGS1(str, size, ...) (str), (size), __VA_ARGS__
34 #define ORD_ARGS0(str, size, ...) __VA_ARGS__, (str), (size)
35 
36 // This macro presumes the AVBPrint to have been cleared before usage.
37 #define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...) do { \
38  char *str; \
39  int size; \
40  func_name ## _bprint(BPRINT_ARGS ## ARG_ORDER((bp), __VA_ARGS__)); \
41  if (strlen((bp)->str) != (bp)->len) { \
42  printf("strlen of AVBPrint-string returned by "#func_name"_bprint" \
43  " differs from AVBPrint.len: %zu vs. %u\n", \
44  strlen((bp)->str), (bp)->len); \
45  break; \
46  } \
47  size = func_name(ORD_ARGS ## ARG_ORDER(NULL, 0, __VA_ARGS__)); \
48  if (size <= 0) { \
49  printf(#func_name " returned %d\n", size); \
50  break; \
51  } \
52  if ((bp)->len != size - 1) { \
53  printf("Return value %d of " #func_name " inconsistent with length"\
54  " %u obtained from corresponding bprint version\n", \
55  size, (bp)->len); \
56  break; \
57  } \
58  str = av_malloc(size); \
59  if (!str) { \
60  printf("string of size %d could not be allocated.\n", size); \
61  break; \
62  } \
63  size = func_name(ORD_ARGS ## ARG_ORDER(str, size, __VA_ARGS__)); \
64  if (size <= 0 || (bp)->len != size - 1) { \
65  printf("Return value %d of " #func_name " inconsistent with length"\
66  " %d obtained in first pass.\n", size, (bp)->len); \
67  av_free(str); \
68  break; \
69  } \
70  if (strcmp(str, (bp)->str)) { \
71  printf("Ordinary and _bprint versions of "#func_name" disagree: " \
72  "'%s' vs. '%s'\n", str, (bp)->str); \
73  av_free(str); \
74  break; \
75  } \
76  av_free(str); \
77  } while (0)
78 
79 
80 static void channel_name(AVBPrint *bp, enum AVChannel channel)
81 {
82  av_bprint_clear(bp);
84 }
85 
86 static void channel_description(AVBPrint *bp, enum AVChannel channel)
87 {
88  av_bprint_clear(bp);
90 }
91 
93  AVBPrint *bp, uint64_t channel_layout)
94 {
96  av_bprint_clear(bp);
97  if (!av_channel_layout_from_mask(layout, channel_layout) &&
100  else
101  av_bprintf(bp, "fail");
102 }
103 
105  AVBPrint *bp, const char *channel_layout)
106 {
108  av_bprint_clear(bp);
109  if (!av_channel_layout_from_string(layout, channel_layout) &&
112  else
113  av_bprintf(bp, "fail");
114 }
115 
116 static const char* channel_order_names[] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI"};
117 
118 static void describe_type(AVBPrint *bp, AVChannelLayout *layout)
119 {
120  if ((unsigned)layout->order < FF_ARRAY_ELEMS(channel_order_names)) {
121  av_bprintf(bp, "%-6s (", channel_order_names[layout->order]);
123  av_bprintf(bp, ")");
124  } else {
125  av_bprintf(bp, "???");
126  }
127 }
128 
129 static const char *channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
130 {
132  av_bprint_clear(bp);
133  if (!av_channel_layout_from_string(layout, channel_layout) &&
135  describe_type(bp, layout);
136  for (int i = 0; i < FF_CHANNEL_ORDER_NB; i++) {
137  int ret;
138  AVChannelLayout copy = {0};
139  av_bprintf(bp, "\n ");
141  return "nomem";
143  if (ret < 0 && (copy.order != layout->order || av_channel_layout_compare(&copy, layout)))
144  av_bprintf(bp, "failed to keep existing layout on failure");
145  if (ret >= 0 && copy.order != i)
146  av_bprintf(bp, "returned success but did not change order");
147  if (ret == AVERROR(ENOSYS)) {
148  av_bprintf(bp, " != %s", channel_order_names[i]);
149  } else if (ret < 0) {
150  av_bprintf(bp, "FAIL");
151  } else {
152  av_bprintf(bp, " %s ", ret ? "~~" : "==");
153  describe_type(bp, &copy);
154  }
156  }
157  } else {
158  av_bprintf(bp, "fail");
159  }
160  return bp->str;
161 }
162 
163 #define CHANNEL_NAME(x) \
164  channel_name(&bp, (x)); \
165  printf("With %-32s %14s\n", AV_STRINGIFY(x)":", bp.str)
166 
167 #define CHANNEL_DESCRIPTION(x) \
168  channel_description(&bp, (x)); \
169  printf("With %-23s %23s\n", AV_STRINGIFY(x)":", bp.str);
170 
171 #define CHANNEL_FROM_STRING(x) \
172  printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))
173 
174 #define CHANNEL_LAYOUT_FROM_MASK(x) \
175  channel_layout_from_mask(&layout, &bp, (x));
176 
177 #define CHANNEL_LAYOUT_FROM_STRING(x) \
178  channel_layout_from_string(&layout, &bp, (x)); \
179  printf("With \"%s\":%*s %32s\n", x, strlen(x) > 32 ? 0 : 32 - (int)strlen(x), "", bp.str);
180 
181 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x) \
182  ret = av_channel_layout_channel_from_index(&layout, x); \
183  if (ret < 0) \
184  ret = -1; \
185  printf("On \"%s\" layout with %2d: %8d\n", l, x, ret)
186 
187 #define CHANNEL_LAYOUT_SUBSET(l, xstr, x) \
188  mask = av_channel_layout_subset(&layout, x); \
189  printf("On \"%s\" layout with %-22s 0x%"PRIx64"\n", l, xstr, mask)
190 
191 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x) \
192  ret = av_channel_layout_index_from_channel(&layout, x); \
193  if (ret < 0) \
194  ret = -1; \
195  printf("On \"%s\" layout with %-23s %3d\n", l, AV_STRINGIFY(x)":", ret)
196 
197 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x) \
198  ret = av_channel_layout_channel_from_string(&layout, x); \
199  if (ret < 0) \
200  ret = -1; \
201  printf("On \"%s\" layout with %-21s %3d\n", bp.str, AV_STRINGIFY(x)":", ret);
202 
203 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x) \
204  ret = av_channel_layout_index_from_string(&layout, x); \
205  if (ret < 0) \
206  ret = -1; \
207  printf("On \"%s\" layout with %-20s %3d\n", l, AV_STRINGIFY(x)":", ret);
208 
209 int main(void)
210 {
211  const AVChannelLayout *playout;
212  AVChannelLayout layout = { 0 }, layout2 = { 0 };
213  AVBPrint bp;
214  void *iter = NULL;
215  uint64_t mask;
216  int ret;
217 
219 
220  printf("Testing av_channel_layout_standard\n");
221  while (playout = av_channel_layout_standard(&iter)) {
222  av_channel_layout_describe_bprint(playout, &bp);
223  printf("%-14s ", bp.str);
224  av_bprint_clear(&bp);
225  for (int i = 0; i < 63; i++) {
226  int idx = av_channel_layout_index_from_channel(playout, i);
227  if (idx >= 0) {
228  if (idx)
229  av_bprintf(&bp, "+");
231  }
232  }
233  printf("%s\n", bp.str);
234  av_bprint_clear(&bp);
235  }
236 
237  printf("\nTesting av_channel_name\n");
240  CHANNEL_NAME(63);
243 
244  printf("Testing av_channel_description\n");
250 
251  printf("\nTesting av_channel_from_string\n");
252  CHANNEL_FROM_STRING("FL");
253  CHANNEL_FROM_STRING("FR");
254  CHANNEL_FROM_STRING("USR63");
255  CHANNEL_FROM_STRING("AMBI0");
256  CHANNEL_FROM_STRING("AMBI1023");
257  CHANNEL_FROM_STRING("AMBI1024");
258  CHANNEL_FROM_STRING("Dummy");
259  CHANNEL_FROM_STRING("FL@Foo");
260  CHANNEL_FROM_STRING("Foo@FL");
261  CHANNEL_FROM_STRING("@FL");
262 
263  printf("\n==Native layouts==\n");
264 
265  printf("\nTesting av_channel_layout_from_string\n");
270  CHANNEL_LAYOUT_FROM_STRING("6 channels");
271  CHANNEL_LAYOUT_FROM_STRING("6 channels (FL+FR+FC+LFE+BL+BR)");
272  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+BL+BR");
274  CHANNEL_LAYOUT_FROM_STRING("FL+FR+USR63");
275  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+LFE+SL+SR");
276  CHANNEL_LAYOUT_FROM_STRING("5.1(side)");
277 
278  printf("\nTesting av_channel_layout_from_mask\n");
280  printf("With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
281 
282  printf("\nTesting av_channel_layout_channel_from_index\n");
290 
291  printf("\nTesting av_channel_layout_index_from_channel\n");
299 
300  printf("\nTesting av_channel_layout_channel_from_string\n");
304  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "LFE");
309  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@Foo");
310  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FL@Foo");
311 
312  printf("\nTesting av_channel_layout_index_from_string\n");
313  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL");
314  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR");
315  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FC");
316  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "LFE");
317  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "SL");
318  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "SR");
319  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "BC");
320 
321  printf("\nTesting av_channel_layout_subset\n");
322  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
323  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_2POINT1:", AV_CH_LAYOUT_2POINT1);
324  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_4POINT1:", AV_CH_LAYOUT_4POINT1);
325 
326  printf("\n==Custom layouts==\n");
327 
328  printf("\nTesting av_channel_layout_from_string\n");
329  CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+BL+BR+LFE");
330  CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)");
331  CHANNEL_LAYOUT_FROM_STRING("2 channels (AMBI1023+FL)");
332  CHANNEL_LAYOUT_FROM_STRING("3 channels (FR+FL)");
333  CHANNEL_LAYOUT_FROM_STRING("-3 channels (FR+FL)");
334  CHANNEL_LAYOUT_FROM_STRING("0 channels ()");
335  CHANNEL_LAYOUT_FROM_STRING("2 channels (FL+FR");
336  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL");
337  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+FC@Foo");
338  CHANNEL_LAYOUT_FROM_STRING("FL@Foo+FR@Bar");
339  CHANNEL_LAYOUT_FROM_STRING("FL+stereo");
340  CHANNEL_LAYOUT_FROM_STRING("stereo+stereo");
341  CHANNEL_LAYOUT_FROM_STRING("stereo@Boo");
344  CHANNEL_LAYOUT_FROM_STRING("@Dummy");
347  CHANNEL_LAYOUT_FROM_STRING("Dummy@FL");
348  CHANNEL_LAYOUT_FROM_STRING("FR+Dummy");
349  CHANNEL_LAYOUT_FROM_STRING("FR+Dummy@FL");
350  CHANNEL_LAYOUT_FROM_STRING("UNK+UNSD");
352  CHANNEL_LAYOUT_FROM_STRING("FR+@FL");
354  CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo");
355 
356  ret = av_channel_layout_copy(&layout2, &layout);
357  if (ret < 0) {
358  printf("Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
359  "ret %d\n", ret);
360  }
361  ret = av_channel_layout_compare(&layout, &layout2);
362  if (ret)
363  printf("Channel layout and its copy compare unequal; ret: %d\n", ret);
364 
365  printf("\nTesting av_channel_layout_index_from_string\n");
366  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR");
367  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL");
368  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "USR63");
369  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "Foo");
370  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "@Foo");
371  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FR@Foo");
372  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL@Foo");
373  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "USR63@Foo");
374  CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "BC");
375 
376  printf("\nTesting av_channel_layout_channel_from_string\n");
379  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "USR63");
380  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "Foo");
381  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@Foo");
382  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FR@Foo");
383  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FL@Foo");
384  CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "USR63@Foo");
386 
387  printf("\nTesting av_channel_layout_index_from_channel\n");
392 
393  printf("\nTesting av_channel_layout_channel_from_index\n");
398 
399  printf("\nTesting av_channel_layout_subset\n");
400  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
401  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_QUAD:", AV_CH_LAYOUT_QUAD);
402 
403  printf("\n==Ambisonic layouts==\n");
404 
405  printf("\nTesting av_channel_layout_from_string\n");
406  CHANNEL_LAYOUT_FROM_STRING("ambisonic 1");
407  CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+stereo");
408 
409  printf("\nTesting av_channel_layout_index_from_channel\n");
414 
415  printf("\nTesting av_channel_layout_channel_from_index\n");
420 
421  printf("\nTesting av_channel_layout_subset\n");
422  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_STEREO:", AV_CH_LAYOUT_STEREO);
423  CHANNEL_LAYOUT_SUBSET(bp.str, "AV_CH_LAYOUT_QUAD:", AV_CH_LAYOUT_QUAD);
424 
426  av_channel_layout_uninit(&layout2);
427 
428  printf("\nTesting av_channel_layout_retype\n");
429  {
430  const char* layouts[] = {
431  "FL@Boo",
432  "stereo",
433  "FR+FL",
434  "ambisonic 2+stereo",
435  "2C",
436  NULL
437  };
438  for (int i = 0; layouts[i]; i++)
439  printf("With \"%s\": %s\n", layouts[i], channel_layout_retype(&layout, &bp, layouts[i]));
440  }
441  av_bprint_finalize(&bp, NULL);
442 
443  return 0;
444 }
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
printf
__device__ int printf(const char *,...)
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:171
mask
int mask
Definition: mediacodecdec_common.c:154
CHANNEL_LAYOUT_FROM_STRING
#define CHANNEL_LAYOUT_FROM_STRING(x)
Definition: channel_layout.c:177
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:599
CHANNEL_LAYOUT_CHANNEL_FROM_INDEX
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x)
Definition: channel_layout.c:181
macros.h
channel_order_names
static const char * channel_order_names[]
Definition: channel_layout.c:116
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:118
channel_name
static void channel_name(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:80
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:653
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:252
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:852
channel_description
static void channel_description(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:86
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:209
channel_layout_from_string
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:104
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:174
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:235
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
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
channel_layout_retype
static const char * channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:129
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:885
CHANNEL_LAYOUT_SUBSET
#define CHANNEL_LAYOUT_SUBSET(l, xstr, x)
Definition: channel_layout.c:187
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:809
CHANNEL_LAYOUT_INDEX_FROM_CHANNEL
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x)
Definition: channel_layout.c:191
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:312
bprint.h
CHANNEL_NAME
#define CHANNEL_NAME(x)
Definition: channel_layout.c:163
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:92
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:37
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:783
CHANNEL_LAYOUT_CHANNEL_FROM_STRING
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x)
Definition: channel_layout.c:197
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
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:713
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:227
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:442
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:449
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:203
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