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)
37#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...) do { \
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); \
47 size = func_name(ORD_ARGS ## ARG_ORDER(NULL, 0, __VA_ARGS__)); \
49 printf(#func_name " returned %d\n", size); \
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", \
58 str = av_malloc(size); \
60 printf("string of size %d could not be allocated.\n", size); \
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); \
70 if (strcmp(str, (bp)->str)) { \
71 printf("Ordinary and _bprint versions of "#func_name" disagree: " \
72 "'%s' vs. '%s'\n", str, (bp)->str); \
93 AVBPrint *bp, uint64_t channel_layout)
105 AVBPrint *bp,
const char *channel_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");
149 }
else if (ret < 0) {
163#define CHANNEL_NAME(x) \
164 channel_name(&bp, (x)); \
165 printf("With %-32s %14s\n", AV_STRINGIFY(x)":", bp.str)
167#define CHANNEL_DESCRIPTION(x) \
168 channel_description(&bp, (x)); \
169 printf("With %-23s %23s\n", AV_STRINGIFY(x)":", bp.str);
171#define CHANNEL_FROM_STRING(x) \
172 printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))
174#define CHANNEL_LAYOUT_FROM_MASK(x) \
175 channel_layout_from_mask(&layout, &bp, (x));
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);
181#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x) \
182 ret = av_channel_layout_channel_from_index(&layout, x); \
185 printf("On \"%s\" layout with %2d: %8d\n", l, x, ret)
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)
191#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x) \
192 ret = av_channel_layout_index_from_channel(&layout, x); \
195 printf("On \"%s\" layout with %-23s %3d\n", l, AV_STRINGIFY(x)":", ret)
197#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x) \
198 ret = av_channel_layout_channel_from_string(&layout, x); \
201 printf("On \"%s\" layout with %-21s %3d\n", bp.str, AV_STRINGIFY(x)":", ret);
203#define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x) \
204 ret = av_channel_layout_index_from_string(&layout, x); \
207 printf("On \"%s\" layout with %-20s %3d\n", l, AV_STRINGIFY(x)":", ret);
220 printf(
"Testing av_channel_layout_standard\n");
225 for (
int i = 0;
i < 63;
i++) {
237 printf(
"\nTesting av_channel_name\n");
244 printf(
"Testing av_channel_description\n");
251 printf(
"\nTesting av_channel_from_string\n");
263 printf(
"\n==Native layouts==\n");
265 printf(
"\nTesting av_channel_layout_from_string\n");
278 printf(
"\nTesting av_channel_layout_from_mask\n");
280 printf(
"With AV_CH_LAYOUT_5POINT1: %25s\n", bp.str);
282 printf(
"\nTesting av_channel_layout_channel_from_index\n");
291 printf(
"\nTesting av_channel_layout_index_from_channel\n");
300 printf(
"\nTesting av_channel_layout_channel_from_string\n");
312 printf(
"\nTesting av_channel_layout_index_from_string\n");
321 printf(
"\nTesting av_channel_layout_subset\n");
326 printf(
"\n==Custom layouts==\n");
328 printf(
"\nTesting av_channel_layout_from_string\n");
358 printf(
"Copying channel layout \"FR+FL@Foo+USR63@Foo\" failed; "
363 printf(
"Channel layout and its copy compare unequal; ret: %d\n", ret);
365 printf(
"\nTesting av_channel_layout_index_from_string\n");
376 printf(
"\nTesting av_channel_layout_channel_from_string\n");
387 printf(
"\nTesting av_channel_layout_index_from_channel\n");
393 printf(
"\nTesting av_channel_layout_channel_from_index\n");
399 printf(
"\nTesting av_channel_layout_subset\n");
403 printf(
"\n==Ambisonic layouts==\n");
405 printf(
"\nTesting av_channel_layout_from_string\n");
409 printf(
"\nTesting av_channel_layout_index_from_channel\n");
415 printf(
"\nTesting av_channel_layout_channel_from_index\n");
421 printf(
"\nTesting av_channel_layout_subset\n");
428 printf(
"\nTesting av_channel_layout_retype\n");
434 "ambisonic 2+stereo",
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_AUTOMATIC
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
__device__ int printf(const char *,...)
channel
Use these values when setting the channel map with ebur128_set_channel().
#define AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_4POINT1
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
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.
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
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.
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().
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.
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_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
@ FF_CHANNEL_ORDER_NB
Number of channel orders, not part of ABI/API.
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static const uint16_t mask[17]
Utility Preprocessor macros.
Memory handling functions.
enum MovChannelLayoutTag * layouts
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
static void describe_type(AVBPrint *bp, AVChannelLayout *layout)
#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER,...)
static void channel_layout_from_mask(AVChannelLayout *layout, AVBPrint *bp, uint64_t channel_layout)
#define CHANNEL_LAYOUT_SUBSET(l, xstr, x)
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x)
#define CHANNEL_FROM_STRING(x)
static const char * channel_order_names[]
#define CHANNEL_DESCRIPTION(x)
#define CHANNEL_LAYOUT_FROM_MASK(x)
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x)
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
#define CHANNEL_LAYOUT_FROM_STRING(x)
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x)
static const char * channel_layout_retype(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
static void channel_description(AVBPrint *bp, enum AVChannel channel)
static void channel_name(AVBPrint *bp, enum AVChannel channel)
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x)
static void copy(const float *p1, float *p2, const int length)