Go to the documentation of this file.
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)
38 #define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...) do { \
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); \
48 size = func_name(ORD_ARGS ## ARG_ORDER(NULL, 0, __VA_ARGS__)); \
50 printf(#func_name " returned %d\n", size); \
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", \
59 str = av_malloc(size); \
61 printf("string of size %d could not be allocated.\n", size); \
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); \
71 if (strcmp(str, (bp)->str)) { \
72 printf("Ordinary and _bprint versions of "#func_name" disagree: " \
73 "'%s' vs. '%s'\n", str, (bp)->str); \
94 AVBPrint *bp, uint64_t channel_layout)
106 AVBPrint *bp,
const char *channel_layout)
145 av_bprintf(bp,
"failed to keep existing layout on failure");
147 av_bprintf(bp,
"returned success but did not change order");
150 }
else if (
ret < 0) {
164 #define CHANNEL_NAME(x) \
165 channel_name(&bp, (x)); \
166 printf("With %-32s %14s\n", AV_STRINGIFY(x)":", bp.str)
168 #define CHANNEL_DESCRIPTION(x) \
169 channel_description(&bp, (x)); \
170 printf("With %-23s %23s\n", AV_STRINGIFY(x)":", bp.str);
172 #define CHANNEL_FROM_STRING(x) \
173 printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))
175 #define CHANNEL_LAYOUT_FROM_MASK(x) \
176 channel_layout_from_mask(&layout, &bp, (x));
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);
182 #define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x) \
183 ret = av_channel_layout_channel_from_index(&layout, x); \
186 printf("On \"%s\" layout with %2d: %8d\n", l, x, ret)
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)
192 #define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x) \
193 ret = av_channel_layout_index_from_channel(&layout, x); \
196 printf("On \"%s\" layout with %-23s %3d\n", l, AV_STRINGIFY(x)":", ret)
198 #define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x) \
199 ret = av_channel_layout_channel_from_string(&layout, x); \
202 printf("On \"%s\" layout with %-21s %3d\n", bp.str, AV_STRINGIFY(x)":", ret);
204 #define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x) \
205 ret = av_channel_layout_index_from_string(&layout, x); \
208 printf("On \"%s\" layout with %-20s %3d\n", l, AV_STRINGIFY(x)":", ret);
221 printf(
"Testing av_channel_layout_standard\n");
226 for (
int i = 0;
i < 63;
i++) {
238 printf(
"\nTesting av_channel_name\n");
245 printf(
"Testing av_channel_description\n");
252 printf(
"\nTesting av_channel_from_string\n");
264 printf(
"\n==Native layouts==\n");
266 printf(
"\nTesting av_channel_layout_from_string\n");
279 printf(
"\nTesting av_channel_layout_from_mask\n");
281 printf(
"With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
283 printf(
"\nTesting av_channel_layout_channel_from_index\n");
292 printf(
"\nTesting av_channel_layout_index_from_channel\n");
301 printf(
"\nTesting av_channel_layout_channel_from_string\n");
313 printf(
"\nTesting av_channel_layout_index_from_string\n");
322 printf(
"\nTesting av_channel_layout_subset\n");
327 printf(
"\n==Custom layouts==\n");
329 printf(
"\nTesting av_channel_layout_from_string\n");
359 printf(
"Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
364 printf(
"Channel layout and its copy compare unequal; ret: %d\n",
ret);
366 printf(
"\nTesting av_channel_layout_index_from_string\n");
377 printf(
"\nTesting av_channel_layout_channel_from_string\n");
388 printf(
"\nTesting av_channel_layout_index_from_channel\n");
394 printf(
"\nTesting av_channel_layout_channel_from_index\n");
400 printf(
"\nTesting av_channel_layout_subset\n");
404 printf(
"\n==Ambisonic layouts==\n");
406 printf(
"\nTesting av_channel_layout_from_string\n");
410 printf(
"\nTesting av_channel_layout_index_from_channel\n");
416 printf(
"\nTesting av_channel_layout_channel_from_index\n");
422 printf(
"\nTesting av_channel_layout_subset\n");
429 printf(
"\nTesting av_channel_layout_retype\n");
435 "ambisonic 2+stereo",
#define CHANNEL_DESCRIPTION(x)
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
Number of channel orders, not part of ABI/API.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
enum MovChannelLayoutTag * layouts
#define CHANNEL_FROM_STRING(x)
#define CHANNEL_LAYOUT_FROM_STRING(x)
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x)
static const char * channel_order_names[]
#define AV_BPRINT_SIZE_AUTOMATIC
#define AV_CH_LAYOUT_STEREO
static void describe_type(AVBPrint *bp, AVChannelLayout *layout)
static void channel_name(AVBPrint *bp, enum AVChannel channel)
#define AV_CH_LAYOUT_QUAD
#define FF_ARRAY_ELEMS(a)
static const uint16_t mask[17]
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.
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.
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
static void channel_description(AVBPrint *bp, enum AVChannel channel)
#define AV_CH_LAYOUT_5POINT1
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
#define CHANNEL_LAYOUT_FROM_MASK(x)
static void copy(const float *p1, float *p2, const int length)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
An AVChannelLayout holds information about the channel layout of audio data.
printf("static const uint8_t my_array[100] = {\n")
static const char * channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
#define CHANNEL_LAYOUT_SUBSET(l, xstr, x)
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x)
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
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
#define i(width, name, range_min, range_max)
#define AV_CH_LAYOUT_2POINT1
static void channel_layout_from_mask(AVChannelLayout *layout, AVBPrint *bp, uint64_t channel_layout)
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.
#define AV_CH_LAYOUT_4POINT1
#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER,...)
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
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.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x)
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().