Go to the documentation of this file.
38 #define CHAN_IS_AMBI(x) ((x) >= AV_CHAN_AMBISONIC_BASE &&\
39 (x) <= AV_CHAN_AMBISONIC_END)
105 if (!buf && buf_size)
132 if (!buf && buf_size)
144 char *endptr = (
char *)
str;
147 if (!strncmp(
str,
"AMBI", 4)) {
158 if (!strncmp(
str,
"USR", 3)) {
159 const char *p =
str + 3;
160 id = strtol(p, &endptr, 0);
162 if (
id >= 0 && !*endptr)
205 #if FF_API_OLD_CHANNEL_LAYOUT
222 return (int64_t)1 <<
i;
225 i = strtol(
name, &end, 10);
227 if (!errno && (end + 1 -
name == name_len && *end ==
'c'))
232 if (!errno && end -
name == name_len)
240 const char *name_end =
name + strlen(
name);
241 int64_t
layout = 0, layout_single;
243 for (n =
name; n < name_end; n = e + 1) {
244 for (e = n; e < name_end && *e !=
'+' && *e !=
'|'; e++);
265 nb = strtol(
name, &end, 10);
266 if (!errno && *end ==
'C' && *(end + 1) ==
'\0' && nb > 0 && nb < 64) {
276 int nb_channels, uint64_t channel_layout)
280 if (nb_channels <= 0)
291 if (channel_layout) {
294 for (
i = 0, ch = 0;
i < 64;
i++) {
295 if ((channel_layout & (UINT64_C(1) <<
i))) {
310 int nb_channels, uint64_t channel_layout)
334 if (!(channel_layout &
channel) ||
346 for (
i = 0;
i < 64;
i++)
370 for (
i = 0;
i < 64;
i++) {
371 if ((1ULL <<
i) & channel_layout && !
index--)
406 int channels = 0, nb_channels = 0, native = 1;
421 if (!strncmp(
str,
"ambisonic ", 10)) {
422 const char *p =
str + 10;
427 order = strtol(p, &endptr, 0);
428 if (order < 0 || order + 1 > INT_MAX / (order + 1) ||
429 (*endptr && *endptr !=
'+'))
433 channel_layout->
nb_channels = (order + 1) * (order + 1);
448 channel_layout->
u.
map =
450 sizeof(*channel_layout->
u.
map));
451 if (!channel_layout->
u.
map) {
484 av_sscanf(
str,
"%d channels (%[^)]", &nb_channels, chlist);
485 end = strchr(
str,
')');
510 char *endptr = chname;
513 if (!strncmp(chname,
"USR", 3)) {
514 const char *p = chname + 3;
515 id = strtol(p, &endptr, 0);
517 if (
id < 0 || *endptr) {
527 if (
id < highest_channel ||
mask & (1ULL <<
id))
529 highest_channel =
id;
538 if (
mask && native) {
540 if (nb_channels && ((nb_channels !=
channels) || (!end || *++end)))
550 if (nb_channels && ((nb_channels !=
channels) || (!end || *++end))) {
556 if (!channel_layout->
u.
map) {
577 channel_layout->
u.
map[idx].
id =
i;
586 channel_layout->
u.
map[idx].
id = strtol(p,
NULL, 0);
604 if (!errno && !*end && !strchr(
str,
'-') &&
mask) {
613 if (!errno && !strcmp(end,
"c") &&
channels > 0) {
620 if (!errno && (!strcmp(end,
"C") || !strcmp(end,
" channels"))
634 memset(channel_layout, 0,
sizeof(*channel_layout));
645 memcpy(dst->
u.
map,
src->u.map,
src->nb_channels *
sizeof(*
src->u.map));
657 int i, highest_ambi, order;
682 if (highest_ambi < 0)
685 order =
floor(sqrt(highest_ambi));
687 if ((order + 1) * (order + 1) != highest_ambi + 1)
700 int nb_ambi_channels;
708 nb_ambi_channels = (order + 1) * (order + 1);
709 if (nb_ambi_channels < channel_layout->nb_channels) {
719 extra.
u.
map = channel_layout->
u.
map + nb_ambi_channels;
735 switch (channel_layout->
order) {
777 char *buf,
size_t buf_size)
782 if (!buf && buf_size)
802 switch (channel_layout->
order) {
804 return channel_layout->
u.
map[idx].
id;
807 if (idx < ambi_channels)
809 idx -= ambi_channels;
813 for (
i = 0;
i < 64;
i++) {
814 if ((1ULL <<
i) & channel_layout->
u.
mask && !idx--)
842 switch (channel_layout->
order) {
874 switch (channel_layout->
order) {
876 chname = strstr(
str,
"@");
888 if (!strcmp(chname, channel_layout->
u.
map[
i].
name) &&
909 switch (channel_layout->
order) {
913 if (!channel_layout->
u.
map)
975 uintptr_t
i = (uintptr_t)*opaque;
980 *opaque = (
void*)(
i + 1);
992 switch (channel_layout->
order) {
997 for (
i = 0;
i < 64;
i++)
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
#define FF_ENABLE_DEPRECATION_WARNINGS
enum AVChannel av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout, const char *str)
Get a channel described by the given string.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
@ AV_CHAN_STEREO_RIGHT
See above.
#define AV_CHANNEL_LAYOUT_2POINT1
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
@ AV_CHAN_LOW_FREQUENCY_2
#define AV_CHANNEL_LAYOUT_5POINT1
#define AVERROR_EOF
End of file.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
#define AV_CHANNEL_LAYOUT_4POINT1
@ AV_CHAN_NONE
Invalid channel index.
#define AV_CHANNEL_LAYOUT_6POINT1
AVChannelCustom * map
This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.
static int ambisonic_order(const AVChannelLayout *channel_layout)
If the layout is n-th order standard-order ambisonic, with optional extra non-diegetic channels at th...
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
#define AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
#define AV_CHANNEL_LAYOUT_STEREO
enum AVChannelOrder order
Channel order used in this layout.
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
int nb_channels
Number of channels in this layout.
@ AV_CHAN_BOTTOM_FRONT_LEFT
#define AV_CHANNEL_LAYOUT_6POINT0
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
#define AV_CHANNEL_LAYOUT_5POINT0
int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel)
Get the index of a channel in channel_layout.
#define AV_CHANNEL_LAYOUT_7POINT0
#define AV_CHANNEL_LAYOUT_HEXAGONAL
@ AV_CHAN_STEREO_LEFT
Stereo downmix.
@ AV_CHAN_FRONT_RIGHT_OF_CENTER
@ AV_CHAN_TOP_FRONT_RIGHT
#define AV_CHANNEL_LAYOUT_SURROUND
static int try_describe_ambisonic(AVBPrint *bp, const AVChannelLayout *channel_layout)
If the custom layout is n-th order standard-order ambisonic, with optional extra non-diegetic channel...
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
#define FF_ARRAY_ELEMS(a)
#define AV_CHANNEL_LAYOUT_2_2
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
static const uint16_t mask[17]
@ AV_CHANNEL_ORDER_AMBISONIC
The audio is represented as the decomposition of the sound field into spherical harmonics.
An AVChannelCustom defines a single channel within a custom order layout.
static __device__ float floor(float a)
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AV_CHANNEL_LAYOUT_6POINT0_FRONT
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const char * get_channel_name(enum AVChannel channel_id)
@ AV_CHAN_TOP_BACK_CENTER
@ AV_CHAN_BOTTOM_FRONT_CENTER
@ AV_CHAN_TOP_FRONT_CENTER
int av_sscanf(const char *string, const char *format,...)
See libc sscanf manual for more information.
union AVChannelLayout::@296 u
Details about which channels are present in this layout.
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
#define AV_CHANNEL_LAYOUT_6POINT1_FRONT
@ AV_CHANNEL_ORDER_CUSTOM
The channel order does not correspond to any other predefined order and is stored as an explicit map.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
static const struct channel_name channel_names[]
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define AV_CHANNEL_LAYOUT_7POINT1
@ AV_CHAN_FRONT_LEFT_OF_CENTER
const char * av_get_channel_name(uint64_t channel)
Get the name of 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_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout)
Append a description of a channel layout to a bprint buffer.
static const struct channel_layout_name channel_layout_map[]
An AVChannelLayout holds information about the channel layout of audio data.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
#define AV_CHANNEL_LAYOUT_2_1
enum AVChannel av_channel_from_string(const char *str)
This is the inverse function of av_channel_name().
#define AV_CHANNEL_LAYOUT_OCTAGONAL
int av_get_extended_channel_layout(const char *name, uint64_t *channel_layout, int *nb_channels)
Return a channel layout and the number of channels based on the specified name.
const char * av_get_channel_description(uint64_t channel)
Get the description of a given channel.
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size)
Init a print buffer using a pre-existing buffer.
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_CHANNEL_LAYOUT_3POINT1
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
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK
#define i(width, name, range_min, range_max)
static FF_DISABLE_DEPRECATION_WARNINGS uint64_t get_channel_layout_single(const char *name, int name_len)
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
#define av_malloc_array(a, b)
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.
#define AV_CHANNEL_LAYOUT_7POINT0_FRONT
void * av_calloc(size_t nmemb, size_t size)
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
FF_ENABLE_DEPRECATION_WARNINGS 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.
@ AV_CHAN_SURROUND_DIRECT_RIGHT
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
Extract a key-value pair from the beginning of a string.
#define AV_CHANNEL_LAYOUT_6POINT1_BACK
void av_bprintf(AVBPrint *buf, const char *fmt,...)
#define AV_CHANNEL_LAYOUT_5POINT0_BACK
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_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
@ AV_CHAN_SURROUND_DIRECT_LEFT
#define FF_DISABLE_DEPRECATION_WARNINGS
char * av_strdup(const char *s)
Duplicate a string.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
const VDPAUPixFmtMap * map
@ AV_CHAN_BOTTOM_FRONT_RIGHT
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
int av_get_standard_channel_layout(unsigned index, uint64_t *layout, const char **name)
Get the value and name of a standard channel layout.
#define AV_CHANNEL_LAYOUT_QUAD
#define AV_CHANNEL_LAYOUT_5POINT1_BACK
#define AV_CHANNEL_LAYOUT_22POINT2
void av_channel_description_bprint(AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_description().
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
Get the channel with the given index in channel_layout.
int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout, const char *str)
Get the index in a channel layout of a channel described by the given string.