FFmpeg
Macros | Enumerations | Functions
Audio channel layouts

Macros

#define AV_CH_LAYOUT_MONO   (AV_CH_FRONT_CENTER)
 
#define AV_CH_LAYOUT_STEREO   (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
 
#define AV_CH_LAYOUT_2POINT1   (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_2_1   (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_SURROUND   (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
 
#define AV_CH_LAYOUT_3POINT1   (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_4POINT0   (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_4POINT1   (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_2_2   (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
 
#define AV_CH_LAYOUT_QUAD   (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
 
#define AV_CH_LAYOUT_5POINT0   (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
 
#define AV_CH_LAYOUT_5POINT1   (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_5POINT0_BACK   (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
 
#define AV_CH_LAYOUT_5POINT1_BACK   (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_6POINT0   (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_6POINT0_FRONT   (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
 
#define AV_CH_LAYOUT_HEXAGONAL   (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_6POINT1   (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_6POINT1_BACK   (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
 
#define AV_CH_LAYOUT_6POINT1_FRONT   (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
 
#define AV_CH_LAYOUT_7POINT0   (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
 
#define AV_CH_LAYOUT_7POINT0_FRONT   (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
 
#define AV_CH_LAYOUT_7POINT1   (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
 
#define AV_CH_LAYOUT_7POINT1_WIDE   (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
 
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK   (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
 
#define AV_CH_LAYOUT_OCTAGONAL   (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
 
#define AV_CH_LAYOUT_HEXADECAGONAL   (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
 
#define AV_CH_LAYOUT_STEREO_DOWNMIX   (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
 

Enumerations

enum  AVMatrixEncoding {
  AV_MATRIX_ENCODING_NONE, AV_MATRIX_ENCODING_DOLBY, AV_MATRIX_ENCODING_DPLII, AV_MATRIX_ENCODING_DPLIIX,
  AV_MATRIX_ENCODING_DPLIIZ, AV_MATRIX_ENCODING_DOLBYEX, AV_MATRIX_ENCODING_DOLBYHEADPHONE, AV_MATRIX_ENCODING_NB
}
 

Functions

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...
 
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...
 
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...
 
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...
 
int av_get_channel_layout_nb_channels (uint64_t channel_layout)
 Return the number of channels in the channel layout. More...
 
int64_t av_get_default_channel_layout (int nb_channels)
 Return default channel layout for a given number of channels. More...
 
int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel)
 Get the index of a channel in channel_layout. More...
 
uint64_t av_channel_layout_extract_channel (uint64_t channel_layout, int index)
 Get the channel with the given index in channel_layout. More...
 
const char * av_get_channel_name (uint64_t channel)
 Get the name of a given channel. More...
 
const char * av_get_channel_description (uint64_t channel)
 Get the description of a given channel. More...
 
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...
 

Detailed Description

Macro Definition Documentation

◆ AV_CH_LAYOUT_MONO

#define AV_CH_LAYOUT_MONO   (AV_CH_FRONT_CENTER)
Examples
filtering_audio.c.

Definition at line 85 of file channel_layout.h.

◆ AV_CH_LAYOUT_STEREO

#define AV_CH_LAYOUT_STEREO   (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
Examples
encode_audio.c, filter_audio.c, muxing.c, and resampling_audio.c.

Definition at line 86 of file channel_layout.h.

◆ AV_CH_LAYOUT_2POINT1

#define AV_CH_LAYOUT_2POINT1   (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)

Definition at line 87 of file channel_layout.h.

◆ AV_CH_LAYOUT_2_1

#define AV_CH_LAYOUT_2_1   (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)

Definition at line 88 of file channel_layout.h.

◆ AV_CH_LAYOUT_SURROUND

#define AV_CH_LAYOUT_SURROUND   (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
Examples
resampling_audio.c.

Definition at line 89 of file channel_layout.h.

◆ AV_CH_LAYOUT_3POINT1

#define AV_CH_LAYOUT_3POINT1   (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)

Definition at line 90 of file channel_layout.h.

◆ AV_CH_LAYOUT_4POINT0

#define AV_CH_LAYOUT_4POINT0   (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)

Definition at line 91 of file channel_layout.h.

◆ AV_CH_LAYOUT_4POINT1

#define AV_CH_LAYOUT_4POINT1   (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)

Definition at line 92 of file channel_layout.h.

◆ AV_CH_LAYOUT_2_2

#define AV_CH_LAYOUT_2_2   (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)

Definition at line 93 of file channel_layout.h.

◆ AV_CH_LAYOUT_QUAD

#define AV_CH_LAYOUT_QUAD   (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)

Definition at line 94 of file channel_layout.h.

◆ AV_CH_LAYOUT_5POINT0

#define AV_CH_LAYOUT_5POINT0   (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)

Definition at line 95 of file channel_layout.h.

◆ AV_CH_LAYOUT_5POINT1

#define AV_CH_LAYOUT_5POINT1   (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)

Definition at line 96 of file channel_layout.h.

◆ AV_CH_LAYOUT_5POINT0_BACK

#define AV_CH_LAYOUT_5POINT0_BACK   (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)

Definition at line 97 of file channel_layout.h.

◆ AV_CH_LAYOUT_5POINT1_BACK

#define AV_CH_LAYOUT_5POINT1_BACK   (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)

Definition at line 98 of file channel_layout.h.

◆ AV_CH_LAYOUT_6POINT0

#define AV_CH_LAYOUT_6POINT0   (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)

Definition at line 99 of file channel_layout.h.

◆ AV_CH_LAYOUT_6POINT0_FRONT

#define AV_CH_LAYOUT_6POINT0_FRONT   (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)

Definition at line 100 of file channel_layout.h.

◆ AV_CH_LAYOUT_HEXAGONAL

#define AV_CH_LAYOUT_HEXAGONAL   (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)

Definition at line 101 of file channel_layout.h.

◆ AV_CH_LAYOUT_6POINT1

#define AV_CH_LAYOUT_6POINT1   (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)

Definition at line 102 of file channel_layout.h.

◆ AV_CH_LAYOUT_6POINT1_BACK

#define AV_CH_LAYOUT_6POINT1_BACK   (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)

Definition at line 103 of file channel_layout.h.

◆ AV_CH_LAYOUT_6POINT1_FRONT

#define AV_CH_LAYOUT_6POINT1_FRONT   (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)

Definition at line 104 of file channel_layout.h.

◆ AV_CH_LAYOUT_7POINT0

#define AV_CH_LAYOUT_7POINT0   (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)

Definition at line 105 of file channel_layout.h.

◆ AV_CH_LAYOUT_7POINT0_FRONT

Definition at line 106 of file channel_layout.h.

◆ AV_CH_LAYOUT_7POINT1

#define AV_CH_LAYOUT_7POINT1   (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)

Definition at line 107 of file channel_layout.h.

◆ AV_CH_LAYOUT_7POINT1_WIDE

Definition at line 108 of file channel_layout.h.

◆ AV_CH_LAYOUT_7POINT1_WIDE_BACK

Definition at line 109 of file channel_layout.h.

◆ AV_CH_LAYOUT_OCTAGONAL

Definition at line 110 of file channel_layout.h.

◆ AV_CH_LAYOUT_HEXADECAGONAL

Definition at line 111 of file channel_layout.h.

◆ AV_CH_LAYOUT_STEREO_DOWNMIX

#define AV_CH_LAYOUT_STEREO_DOWNMIX   (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)

Definition at line 112 of file channel_layout.h.

Enumeration Type Documentation

◆ AVMatrixEncoding

Enumerator
AV_MATRIX_ENCODING_NONE 
AV_MATRIX_ENCODING_DOLBY 
AV_MATRIX_ENCODING_DPLII 
AV_MATRIX_ENCODING_DPLIIX 
AV_MATRIX_ENCODING_DPLIIZ 
AV_MATRIX_ENCODING_DOLBYEX 
AV_MATRIX_ENCODING_DOLBYHEADPHONE 
AV_MATRIX_ENCODING_NB 

Definition at line 114 of file channel_layout.h.

Function Documentation

◆ av_get_channel_layout()

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"

Definition at line 139 of file channel_layout.c.

Referenced by av_get_extended_channel_layout(), av_opt_set(), channelmap_init(), get_channel(), init(), init_audio(), join_init(), opt_channel_layout(), and parse_channel_name().

◆ av_get_extended_channel_layout()

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.

Definition at line 155 of file channel_layout.c.

Referenced by ff_parse_channel_layout(), and init().

◆ av_get_channel_layout_string()

void av_get_channel_layout_string ( char *  buf,
int  buf_size,
int  nb_channels,
uint64_t  channel_layout 
)

◆ av_bprint_channel_layout()

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.

Definition at line 177 of file channel_layout.c.

Referenced by av_get_channel_layout_string(), config_output(), show_frame(), and show_stream().

◆ av_get_channel_layout_nb_channels()

int av_get_channel_layout_nb_channels ( uint64_t  channel_layout)

◆ av_get_default_channel_layout()

int64_t av_get_default_channel_layout ( int  nb_channels)

◆ av_get_channel_layout_channel_index()

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.

Definition at line 233 of file channel_layout.c.

Referenced by ac3_decode_frame(), channelmap_config_input(), channelmap_init(), config_input(), config_output(), init(), join_config_output(), parse_maps(), and read_restart_header().

◆ av_channel_layout_extract_channel()

uint64_t av_channel_layout_extract_channel ( uint64_t  channel_layout,
int  index 
)

Get the channel with the given index in channel_layout.

Definition at line 265 of file channel_layout.c.

Referenced by config_audio_output(), convert_coeffs(), filter_channel(), filter_frame(), generate_kernel(), guess_map_any(), init(), join_config_output(), join_init(), query_formats(), and swr_build_matrix().

◆ av_get_channel_name()

const char* av_get_channel_name ( uint64_t  channel)

Get the name of a given channel.

Returns
channel name on success, NULL on error.

Definition at line 243 of file channel_layout.c.

Referenced by channelmap_config_input(), dump_paramchange(), filter_frame(), init(), join_config_output(), show_layouts(), and swr_build_matrix().

◆ av_get_channel_description()

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

Definition at line 254 of file channel_layout.c.

Referenced by show_layouts().

◆ av_get_standard_channel_layout()

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

Definition at line 279 of file channel_layout.c.

Referenced by show_layouts().