FFmpeg 5.1.6
Modules | Data Structures | Macros | Enumerations | Functions
Audio related

Modules

 Audio FIFO Buffer
 
 Audio channel masks
 A channel layout is a 64-bits integer with a bit set for every channel.
 
 Audio channel layouts
 
 Audio downmix metadata
 
 Audio sample formats
 Audio sample format enumeration and related convenience functions.
 
 Samples manipulation
 Functions that manipulate audio samples.
 

Data Structures

struct  AVChannelCustom
 An AVChannelCustom defines a single channel within a custom order layout. More...
 
struct  AVChannelLayout
 An AVChannelLayout holds information about the channel layout of audio data. More...
 

Macros

#define AV_CHANNEL_LAYOUT_MASK(nb, m)    { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }}
 
#define AV_CHANNEL_LAYOUT_MONO   AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)
 
#define AV_CHANNEL_LAYOUT_STEREO   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
 
#define AV_CHANNEL_LAYOUT_2POINT1   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)
 
#define AV_CHANNEL_LAYOUT_2_1   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)
 
#define AV_CHANNEL_LAYOUT_SURROUND   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND)
 
#define AV_CHANNEL_LAYOUT_3POINT1   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1)
 
#define AV_CHANNEL_LAYOUT_4POINT0   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0)
 
#define AV_CHANNEL_LAYOUT_4POINT1   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1)
 
#define AV_CHANNEL_LAYOUT_2_2   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2)
 
#define AV_CHANNEL_LAYOUT_QUAD   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD)
 
#define AV_CHANNEL_LAYOUT_5POINT0   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0)
 
#define AV_CHANNEL_LAYOUT_5POINT1   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1)
 
#define AV_CHANNEL_LAYOUT_5POINT0_BACK   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK)
 
#define AV_CHANNEL_LAYOUT_5POINT1_BACK   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)
 
#define AV_CHANNEL_LAYOUT_6POINT0   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)
 
#define AV_CHANNEL_LAYOUT_6POINT0_FRONT   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)
 
#define AV_CHANNEL_LAYOUT_HEXAGONAL   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)
 
#define AV_CHANNEL_LAYOUT_6POINT1   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)
 
#define AV_CHANNEL_LAYOUT_6POINT1_BACK   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)
 
#define AV_CHANNEL_LAYOUT_6POINT1_FRONT   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT)
 
#define AV_CHANNEL_LAYOUT_7POINT0   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0)
 
#define AV_CHANNEL_LAYOUT_7POINT0_FRONT   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT)
 
#define AV_CHANNEL_LAYOUT_7POINT1   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
 
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
 
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
 
#define AV_CHANNEL_LAYOUT_OCTAGONAL   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
 
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL   AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
 
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
 
#define AV_CHANNEL_LAYOUT_22POINT2   AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
 
#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER    { .order = AV_CHANNEL_ORDER_AMBISONIC, .nb_channels = 4, .u = { .mask = 0 }}
 

Enumerations

enum  AVChannel {
  AV_CHAN_NONE = -1 , AV_CHAN_FRONT_LEFT , AV_CHAN_FRONT_RIGHT , AV_CHAN_FRONT_CENTER ,
  AV_CHAN_LOW_FREQUENCY , AV_CHAN_BACK_LEFT , AV_CHAN_BACK_RIGHT , AV_CHAN_FRONT_LEFT_OF_CENTER ,
  AV_CHAN_FRONT_RIGHT_OF_CENTER , AV_CHAN_BACK_CENTER , AV_CHAN_SIDE_LEFT , AV_CHAN_SIDE_RIGHT ,
  AV_CHAN_TOP_CENTER , AV_CHAN_TOP_FRONT_LEFT , AV_CHAN_TOP_FRONT_CENTER , AV_CHAN_TOP_FRONT_RIGHT ,
  AV_CHAN_TOP_BACK_LEFT , AV_CHAN_TOP_BACK_CENTER , AV_CHAN_TOP_BACK_RIGHT , AV_CHAN_STEREO_LEFT = 29 ,
  AV_CHAN_STEREO_RIGHT , AV_CHAN_WIDE_LEFT , AV_CHAN_WIDE_RIGHT , AV_CHAN_SURROUND_DIRECT_LEFT ,
  AV_CHAN_SURROUND_DIRECT_RIGHT , AV_CHAN_LOW_FREQUENCY_2 , AV_CHAN_TOP_SIDE_LEFT , AV_CHAN_TOP_SIDE_RIGHT ,
  AV_CHAN_BOTTOM_FRONT_CENTER , AV_CHAN_BOTTOM_FRONT_LEFT , AV_CHAN_BOTTOM_FRONT_RIGHT , AV_CHAN_UNUSED = 0x200 ,
  AV_CHAN_UNKNOWN = 0x300 , AV_CHAN_AMBISONIC_BASE = 0x400 , AV_CHAN_AMBISONIC_END = 0x7ff
}
 
enum  AVChannelOrder { AV_CHANNEL_ORDER_UNSPEC , AV_CHANNEL_ORDER_NATIVE , AV_CHANNEL_ORDER_CUSTOM , AV_CHANNEL_ORDER_AMBISONIC }
 

Functions

attribute_deprecated uint64_t av_get_channel_layout (const char *name)
 Return a channel layout id that matches name, or 0 if no match is found. More...
 
attribute_deprecated 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. More...
 
attribute_deprecated 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. More...
 
attribute_deprecated 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. More...
 
attribute_deprecated int av_get_channel_layout_nb_channels (uint64_t channel_layout)
 Return the number of channels in the channel layout. More...
 
attribute_deprecated int64_t av_get_default_channel_layout (int nb_channels)
 Return default channel layout for a given number of channels. More...
 
attribute_deprecated int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel)
 Get the index of a channel in channel_layout. More...
 
attribute_deprecated uint64_t av_channel_layout_extract_channel (uint64_t channel_layout, int index)
 Get the channel with the given index in channel_layout. More...
 
attribute_deprecated const char * av_get_channel_name (uint64_t channel)
 Get the name of a given channel. More...
 
attribute_deprecated const char * av_get_channel_description (uint64_t channel)
 Get the description of a given channel. More...
 
attribute_deprecated int av_get_standard_channel_layout (unsigned index, uint64_t *layout, const char **name)
 Get the value and name of a standard channel layout. More...
 
int av_channel_name (char *buf, size_t buf_size, enum AVChannel channel)
 Get a human readable string in an abbreviated form describing a given channel. More...
 
void av_channel_name_bprint (struct AVBPrint *bp, enum AVChannel channel_id)
 bprint variant of av_channel_name(). More...
 
int av_channel_description (char *buf, size_t buf_size, enum AVChannel channel)
 Get a human readable string describing a given channel. More...
 
void av_channel_description_bprint (struct AVBPrint *bp, enum AVChannel channel_id)
 bprint variant of av_channel_description(). More...
 
enum AVChannel av_channel_from_string (const char *name)
 This is the inverse function of av_channel_name(). More...
 
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. More...
 
int av_channel_layout_from_string (AVChannelLayout *channel_layout, const char *str)
 Initialize a channel layout from a given string description. More...
 
void av_channel_layout_default (AVChannelLayout *ch_layout, int nb_channels)
 Get the default channel layout for a given number of channels. More...
 
const AVChannelLayoutav_channel_layout_standard (void **opaque)
 Iterate over all standard channel layouts. More...
 
void av_channel_layout_uninit (AVChannelLayout *channel_layout)
 Free any allocated data in the channel layout and reset the channel count to 0. More...
 
int av_channel_layout_copy (AVChannelLayout *dst, const AVChannelLayout *src)
 Make a copy of a channel layout. More...
 
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. More...
 
int av_channel_layout_describe_bprint (const AVChannelLayout *channel_layout, struct AVBPrint *bp)
 bprint variant of av_channel_layout_describe(). More...
 
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. More...
 
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. More...
 
int av_channel_layout_index_from_string (const AVChannelLayout *channel_layout, const char *name)
 Get the index in a channel layout of a channel described by the given string. More...
 
enum AVChannel av_channel_layout_channel_from_string (const AVChannelLayout *channel_layout, const char *name)
 Get a channel described by the given string. More...
 
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 positions. More...
 
int av_channel_layout_check (const AVChannelLayout *channel_layout)
 Check whether a channel layout is valid, i.e. More...
 
int av_channel_layout_compare (const AVChannelLayout *chl, const AVChannelLayout *chl1)
 Check whether two channel layouts are semantically the same, i.e. More...
 

Detailed Description

Macro Definition Documentation

◆ AV_CHANNEL_LAYOUT_MASK

#define AV_CHANNEL_LAYOUT_MASK (   nb,
 
)     { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }}

Definition at line 350 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_MONO

#define AV_CHANNEL_LAYOUT_MONO   AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)

Definition at line 353 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_STEREO

#define AV_CHANNEL_LAYOUT_STEREO   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
Examples
encode_audio.c, muxing.c, and resampling_audio.c.

Definition at line 354 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_2POINT1

#define AV_CHANNEL_LAYOUT_2POINT1   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)

Definition at line 355 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_2_1

#define AV_CHANNEL_LAYOUT_2_1   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)

Definition at line 356 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_SURROUND

#define AV_CHANNEL_LAYOUT_SURROUND   AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND)
Examples
resampling_audio.c.

Definition at line 357 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_3POINT1

#define AV_CHANNEL_LAYOUT_3POINT1   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1)

Definition at line 358 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_4POINT0

#define AV_CHANNEL_LAYOUT_4POINT0   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0)

Definition at line 359 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_4POINT1

#define AV_CHANNEL_LAYOUT_4POINT1   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1)

Definition at line 360 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_2_2

#define AV_CHANNEL_LAYOUT_2_2   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2)

Definition at line 361 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_QUAD

#define AV_CHANNEL_LAYOUT_QUAD   AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD)

Definition at line 362 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT0

#define AV_CHANNEL_LAYOUT_5POINT0   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0)

Definition at line 363 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT1

#define AV_CHANNEL_LAYOUT_5POINT1   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1)

Definition at line 364 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT0_BACK

#define AV_CHANNEL_LAYOUT_5POINT0_BACK   AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK)

Definition at line 365 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT1_BACK

#define AV_CHANNEL_LAYOUT_5POINT1_BACK   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)

Definition at line 366 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_6POINT0

#define AV_CHANNEL_LAYOUT_6POINT0   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)

Definition at line 367 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_6POINT0_FRONT

#define AV_CHANNEL_LAYOUT_6POINT0_FRONT   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)

Definition at line 368 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_HEXAGONAL

#define AV_CHANNEL_LAYOUT_HEXAGONAL   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)

Definition at line 369 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_6POINT1

#define AV_CHANNEL_LAYOUT_6POINT1   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)

Definition at line 370 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_6POINT1_BACK

#define AV_CHANNEL_LAYOUT_6POINT1_BACK   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)

Definition at line 371 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_6POINT1_FRONT

#define AV_CHANNEL_LAYOUT_6POINT1_FRONT   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT)

Definition at line 372 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT0

#define AV_CHANNEL_LAYOUT_7POINT0   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0)

Definition at line 373 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT0_FRONT

#define AV_CHANNEL_LAYOUT_7POINT0_FRONT   AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT)

Definition at line 374 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1

#define AV_CHANNEL_LAYOUT_7POINT1   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)

Definition at line 375 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1_WIDE

#define AV_CHANNEL_LAYOUT_7POINT1_WIDE   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)

Definition at line 376 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK

#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)

Definition at line 377 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_OCTAGONAL

#define AV_CHANNEL_LAYOUT_OCTAGONAL   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)

Definition at line 378 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_HEXADECAGONAL

#define AV_CHANNEL_LAYOUT_HEXADECAGONAL   AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)

Definition at line 379 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_STEREO_DOWNMIX

#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)

Definition at line 380 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_22POINT2

#define AV_CHANNEL_LAYOUT_22POINT2   AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)

Definition at line 381 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER

#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER    { .order = AV_CHANNEL_ORDER_AMBISONIC, .nb_channels = 4, .u = { .mask = 0 }}

Definition at line 382 of file channel_layout.h.

Enumeration Type Documentation

◆ AVChannel

enum AVChannel
Enumerator
AV_CHAN_NONE 

Invalid channel index.

AV_CHAN_FRONT_LEFT 
AV_CHAN_FRONT_RIGHT 
AV_CHAN_FRONT_CENTER 
AV_CHAN_LOW_FREQUENCY 
AV_CHAN_BACK_LEFT 
AV_CHAN_BACK_RIGHT 
AV_CHAN_FRONT_LEFT_OF_CENTER 
AV_CHAN_FRONT_RIGHT_OF_CENTER 
AV_CHAN_BACK_CENTER 
AV_CHAN_SIDE_LEFT 
AV_CHAN_SIDE_RIGHT 
AV_CHAN_TOP_CENTER 
AV_CHAN_TOP_FRONT_LEFT 
AV_CHAN_TOP_FRONT_CENTER 
AV_CHAN_TOP_FRONT_RIGHT 
AV_CHAN_TOP_BACK_LEFT 
AV_CHAN_TOP_BACK_CENTER 
AV_CHAN_TOP_BACK_RIGHT 
AV_CHAN_STEREO_LEFT 

Stereo downmix.

AV_CHAN_STEREO_RIGHT 

See above.

AV_CHAN_WIDE_LEFT 
AV_CHAN_WIDE_RIGHT 
AV_CHAN_SURROUND_DIRECT_LEFT 
AV_CHAN_SURROUND_DIRECT_RIGHT 
AV_CHAN_LOW_FREQUENCY_2 
AV_CHAN_TOP_SIDE_LEFT 
AV_CHAN_TOP_SIDE_RIGHT 
AV_CHAN_BOTTOM_FRONT_CENTER 
AV_CHAN_BOTTOM_FRONT_LEFT 
AV_CHAN_BOTTOM_FRONT_RIGHT 
AV_CHAN_UNUSED 

Channel is empty can be safely skipped.

AV_CHAN_UNKNOWN 

Channel contains data, but its position is unknown.

AV_CHAN_AMBISONIC_BASE 

Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic components using the ACN system.

Given a channel id between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel <n> is <n> = - AV_CHAN_AMBISONIC_BASE.

Note
these values are only used for AV_CHANNEL_ORDER_CUSTOM channel orderings, the AV_CHANNEL_ORDER_AMBISONIC ordering orders the channels implicitly by their position in the stream.

AV_CHAN_AMBISONIC_END 

Definition at line 41 of file channel_layout.h.

◆ AVChannelOrder

Enumerator
AV_CHANNEL_ORDER_UNSPEC 

Only the channel count is specified, without any further information about the channel order.

AV_CHANNEL_ORDER_NATIVE 

The native channel order, i.e.

the channels are in the same order in which they are defined in the AVChannel enum. This supports up to 63 different channels.

AV_CHANNEL_ORDER_CUSTOM 

The channel order does not correspond to any other predefined order and is stored as an explicit map.

For example, this could be used to support layouts with 64 or more channels, or with empty/skipped (AV_CHAN_SILENCE) channels at arbitrary positions.

AV_CHANNEL_ORDER_AMBISONIC 

The audio is represented as the decomposition of the sound field into spherical harmonics.

Each channel corresponds to a single expansion component. Channels are ordered according to ACN (Ambisonic Channel Number).

The channel with the index n in the stream contains the spherical harmonic of degree l and order m given by

l = floor(sqrt(n)),
m = n - l * (l + 1).

Conversely given a spherical harmonic of degree l and order m, the corresponding channel index n is given by

n = l * (l + 1) + m.

Normalization is assumed to be SN3D (Schmidt Semi-Normalization) as defined in AmbiX format $ 2.1.

Definition at line 101 of file channel_layout.h.

Function Documentation

◆ av_get_channel_layout()

attribute_deprecated uint64_t av_get_channel_layout ( const char *  name)

Return a channel layout id that matches name, or 0 if no match is found.

name can be one or several of the following notations, separated by '+' or '|':

  • the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
  • the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
  • a number of channels, in decimal, followed by 'c', yielding the default channel layout for that number of channels (
    See also
    av_get_default_channel_layout);
  • a channel layout mask, in hexadecimal starting with "0x" (see the AV_CH_* macros).

Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"

Deprecated:
use av_channel_layout_from_string()

◆ av_get_extended_channel_layout()

attribute_deprecated 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.

This function is similar to (

See also
av_get_channel_layout), but can also parse unknown channel layout specifications.
Parameters
[in]namechannel layout specification string
[out]channel_layoutparsed channel layout (0 if unknown)
[out]nb_channelsnumber of channels
Returns
0 on success, AVERROR(EINVAL) if the parsing fails.
Deprecated:
use av_channel_layout_from_string()

◆ av_get_channel_layout_string()

attribute_deprecated 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.

If nb_channels is <= 0, it is guessed from the channel_layout.

Parameters
bufput here the string containing the channel layout
buf_sizesize in bytes of the buffer
Deprecated:
use av_channel_layout_describe()

◆ av_bprint_channel_layout()

attribute_deprecated 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.

Deprecated:
use av_channel_layout_describe()

◆ av_get_channel_layout_nb_channels()

attribute_deprecated int av_get_channel_layout_nb_channels ( uint64_t  channel_layout)

Return the number of channels in the channel layout.

Deprecated:
use AVChannelLayout.nb_channels

◆ av_get_default_channel_layout()

attribute_deprecated int64_t av_get_default_channel_layout ( int  nb_channels)

Return default channel layout for a given number of channels.

Deprecated:
use av_channel_layout_default()

◆ av_get_channel_layout_channel_index()

attribute_deprecated int av_get_channel_layout_channel_index ( uint64_t  channel_layout,
uint64_t  channel 
)

Get the index of a channel in channel_layout.

Parameters
channela channel layout describing exactly one channel which must be present in channel_layout.
Returns
index of channel in channel_layout on success, a negative AVERROR on error.
Deprecated:
use av_channel_layout_index_from_channel()

◆ av_channel_layout_extract_channel()

attribute_deprecated uint64_t av_channel_layout_extract_channel ( uint64_t  channel_layout,
int  index 
)

Get the channel with the given index in channel_layout.

Deprecated:
use av_channel_layout_channel_from_index()

◆ av_get_channel_name()

attribute_deprecated const char * av_get_channel_name ( uint64_t  channel)

Get the name of a given channel.

Returns
channel name on success, NULL on error.
Deprecated:
use av_channel_name()

◆ av_get_channel_description()

attribute_deprecated const char * av_get_channel_description ( uint64_t  channel)

Get the description of a given channel.

Parameters
channela channel layout with a single channel
Returns
channel description on success, NULL on error
Deprecated:
use av_channel_description()

◆ av_get_standard_channel_layout()

attribute_deprecated int av_get_standard_channel_layout ( unsigned  index,
uint64_t *  layout,
const char **  name 
)

Get the value and name of a standard channel layout.

Parameters
[in]indexindex in an internal list, starting at 0
[out]layoutchannel layout mask
[out]namename of the layout
Returns
0 if the layout exists, <0 if index is beyond the limits
Deprecated:
use av_channel_layout_standard()

◆ av_channel_name()

int av_channel_name ( char *  buf,
size_t  buf_size,
enum AVChannel  channel 
)

Get a human readable string in an abbreviated form describing a given channel.

This is the inverse function of av_channel_from_string().

Parameters
bufpre-allocated buffer where to put the generated string
buf_sizesize in bytes of the buffer.
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.

◆ av_channel_name_bprint()

void av_channel_name_bprint ( struct AVBPrint *  bp,
enum AVChannel  channel_id 
)

bprint variant of av_channel_name().

Note
the string will be appended to the bprint buffer.

◆ av_channel_description()

int av_channel_description ( char *  buf,
size_t  buf_size,
enum AVChannel  channel 
)

Get a human readable string describing a given channel.

Parameters
bufpre-allocated buffer where to put the generated string
buf_sizesize in bytes of the buffer.
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.

◆ av_channel_description_bprint()

void av_channel_description_bprint ( struct AVBPrint *  bp,
enum AVChannel  channel_id 
)

bprint variant of av_channel_description().

Note
the string will be appended to the bprint buffer.

◆ av_channel_from_string()

enum AVChannel av_channel_from_string ( const char *  name)

This is the inverse function of av_channel_name().

Returns
the channel with the given name AV_CHAN_NONE when name does not identify a known channel

◆ 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.

Parameters
channel_layoutthe layout structure to be initialized
maskbitmask describing the channel layout
Returns
0 on success AVERROR(EINVAL) for invalid mask values

◆ 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.

The input string can be represented by:

  • the formal channel layout name (returned by av_channel_layout_describe())
  • single or multiple channel names (returned by av_channel_name(), eg. "FL", or concatenated with "+", each optionally containing a custom name after a "@", eg. "FL@Left+FR@Right+LFE")
  • a decimal or hexadecimal value of a native channel layout (eg. "4" or "0x4")
  • the number of channels with default layout (eg. "4c")
  • the number of unordered channels (eg. "4C" or "4 channels")
  • the ambisonic order followed by optional non-diegetic channels (eg. "ambisonic 2+stereo")
Parameters
channel_layoutinput channel layout
strstring describing the channel layout
Returns
0 channel layout was detected, AVERROR_INVALIDATATA otherwise

◆ av_channel_layout_default()

void av_channel_layout_default ( AVChannelLayout ch_layout,
int  nb_channels 
)

Get the default channel layout for a given number of channels.

Parameters
channel_layoutthe layout structure to be initialized
nb_channelsnumber of channels
Examples
filtering_audio.c, transcode_aac.c, and transcoding.c.

Referenced by init_filter(), init_filters(), and open_output_file().

◆ av_channel_layout_standard()

const AVChannelLayout * av_channel_layout_standard ( void **  opaque)

Iterate over all standard channel layouts.

Parameters
opaquea pointer where libavutil will store the iteration state. Must point to NULL to start the iteration.
Returns
the standard channel layout or NULL when the iteration is finished

◆ 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.

Parameters
channel_layoutthe layout structure to be uninitialized

◆ av_channel_layout_copy()

int av_channel_layout_copy ( AVChannelLayout dst,
const AVChannelLayout src 
)

Make a copy of a channel layout.

This differs from just assigning src to dst in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.

Note
the destination channel_layout will be always uninitialized before copy.
Parameters
dstdestination channel layout
srcsource channel layout
Returns
0 on success, a negative AVERROR on error.
Examples
encode_audio.c, filter_audio.c, muxing.c, transcode_aac.c, and transcoding.c.

Referenced by add_stream(), alloc_audio_frame(), get_input(), init_output_frame(), main(), open_output_file(), and select_channel_layout().

◆ 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.

The string will be in the same format that is accepted by av_channel_layout_from_string(), allowing to rebuild the same channel layout, except for opaque pointers.

Parameters
channel_layoutchannel layout to be described
bufpre-allocated buffer where to put the generated string
buf_sizesize in bytes of the buffer.
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.
Examples
filter_audio.c, filtering_audio.c, resampling_audio.c, and transcoding.c.

Referenced by init_filter(), init_filter_graph(), init_filters(), and main().

◆ av_channel_layout_describe_bprint()

int av_channel_layout_describe_bprint ( const AVChannelLayout channel_layout,
struct AVBPrint *  bp 
)

bprint variant of av_channel_layout_describe().

Note
the string will be appended to the bprint buffer.
Returns
0 on success, or a negative AVERROR value on failure.

◆ av_channel_layout_channel_from_index()

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.

Parameters
channel_layoutinput channel layout
Returns
channel with the index idx in channel_layout on success or AV_CHAN_NONE on failure (if idx is not valid or the channel order is unspecified)

◆ 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.

In case multiple channels are found, only the first match will be returned.

Parameters
channel_layoutinput channel layout
Returns
index of channel in channel_layout on success or a negative number if channel is not present in channel_layout.

◆ av_channel_layout_index_from_string()

int av_channel_layout_index_from_string ( const AVChannelLayout channel_layout,
const char *  name 
)

Get the index in a channel layout of a channel described by the given string.

In case multiple channels are found, only the first match will be returned.

This function accepts channel names in the same format as av_channel_from_string().

Parameters
channel_layoutinput channel layout
Returns
a channel index described by the given string, or a negative AVERROR value.

◆ av_channel_layout_channel_from_string()

enum AVChannel av_channel_layout_channel_from_string ( const AVChannelLayout channel_layout,
const char *  name 
)

Get a channel described by the given string.

This function accepts channel names in the same format as av_channel_from_string().

Parameters
channel_layoutinput channel layout
Returns
a channel described by the given string in channel_layout on success or AV_CHAN_NONE on failure (if the string is not valid or the channel order is unspecified)

◆ av_channel_layout_subset()

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 positions.

Parameters
channel_layoutinput channel layout
maska combination of AV_CH_* representing a set of channels
Returns
a bitfield representing all the channels from mask that are present in channel_layout

◆ av_channel_layout_check()

int av_channel_layout_check ( const AVChannelLayout channel_layout)

Check whether a channel layout is valid, i.e.

can possibly describe audio data.

Parameters
channel_layoutinput channel layout
Returns
1 if channel_layout is valid, 0 otherwise.

◆ 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.

the same channels are present on the same positions in both.

If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC, they are considered equal iff the channel counts are the same in both.

Parameters
chlinput channel layout
chl1input channel layout
Returns
0 if chl and chl1 are equal, 1 if they are not equal. A negative AVERROR code if one or both are invalid.