FFmpeg
Modules | Files | Data Structures | Macros | Enumerations | Functions
Audio channels

Modules

 Audio channel masks
 A channel layout is a 64-bits integer with a bit set for every channel. The number of bits set must be equal to the number of channels. The value 0 means that the channel layout is not known.
 
 Audio channel layouts
 

Files

file  channel_layout.h
 

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)
 Macro to define native channel layouts. More...
 
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS   (1 << 0)
 The conversion must be lossless. More...
 
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL   (1 << 1)
 The specified retype target order is ignored and the simplest possible (canonical) order is used for which the input layout can be losslessy represented. More...
 

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_SIDE_SURROUND_LEFT,
  AV_CHAN_SIDE_SURROUND_RIGHT, AV_CHAN_TOP_SURROUND_LEFT, AV_CHAN_TOP_SURROUND_RIGHT, AV_CHAN_BINAURAL_LEFT = 61,
  AV_CHAN_BINAURAL_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,
  FF_CHANNEL_ORDER_NB
}
 

Functions

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_custom_init (AVChannelLayout *channel_layout, int nb_channels)
 Initialize a custom channel layout with the specified number of channels. 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...
 
int av_channel_layout_ambisonic_order (const AVChannelLayout *channel_layout)
 Return the order if the layout is n-th order standard-order ambisonic. More...
 
int av_channel_layout_retype (AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
 Change the AVChannelOrder of a channel layout. More...
 

Common pre-defined channel layouts

#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_3POINT1POINT2   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_3POINT1POINT2)
 
#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_5POINT1POINT2_BACK   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2_BACK)
 
#define AV_CHANNEL_LAYOUT_OCTAGONAL   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
 
#define AV_CHANNEL_LAYOUT_CUBE   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
 
#define AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_5POINT1POINT4_BACK)
 
#define AV_CHANNEL_LAYOUT_7POINT1POINT2   AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_7POINT1POINT2)
 
#define AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT1POINT4_BACK)
 
#define AV_CHANNEL_LAYOUT_7POINT2POINT3   AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT2POINT3)
 
#define AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(14, AV_CH_LAYOUT_9POINT1POINT4_BACK)
 
#define AV_CHANNEL_LAYOUT_9POINT1POINT6   AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_9POINT1POINT6)
 
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL   AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
 
#define AV_CHANNEL_LAYOUT_BINAURAL   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_BINAURAL)
 
#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_7POINT1_TOP_BACK   AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK
 
#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER
 

Detailed Description

Audio channel layout utility functions

Macro Definition Documentation

◆ AV_CHANNEL_LAYOUT_MASK

#define AV_CHANNEL_LAYOUT_MASK (   nb,
 
)
Value:
{ /* .order */ AV_CHANNEL_ORDER_NATIVE, \
/* .nb_channels */ (nb), \
/* .u.mask */ { m }, \
/* .opaque */ NULL }

Macro to define native channel layouts.

Note
This doesn't use designated initializers for compatibility with C++ 17 and older.

Definition at line 383 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 393 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, mux.c, and resample_audio.c.

Definition at line 394 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 395 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 396 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_SURROUND

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

Definition at line 397 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 398 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 399 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 400 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 401 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 402 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 403 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 404 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 405 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 406 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 407 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 408 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_3POINT1POINT2

#define AV_CHANNEL_LAYOUT_3POINT1POINT2   AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_3POINT1POINT2)

Definition at line 409 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 410 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 411 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 412 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 413 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 414 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 415 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 416 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 417 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 418 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK

#define AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2_BACK)

Definition at line 419 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 420 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_CUBE

#define AV_CHANNEL_LAYOUT_CUBE   AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)

Definition at line 421 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK

#define AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_5POINT1POINT4_BACK)

Definition at line 422 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1POINT2

#define AV_CHANNEL_LAYOUT_7POINT1POINT2   AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_7POINT1POINT2)

Definition at line 423 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK

#define AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT1POINT4_BACK)

Definition at line 424 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT2POINT3

#define AV_CHANNEL_LAYOUT_7POINT2POINT3   AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT2POINT3)

Definition at line 425 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK

#define AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK   AV_CHANNEL_LAYOUT_MASK(14, AV_CH_LAYOUT_9POINT1POINT4_BACK)

Definition at line 426 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_9POINT1POINT6

#define AV_CHANNEL_LAYOUT_9POINT1POINT6   AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_9POINT1POINT6)

Definition at line 427 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 428 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_BINAURAL

#define AV_CHANNEL_LAYOUT_BINAURAL   AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_BINAURAL)

Definition at line 429 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 430 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 431 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK

#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK   AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK

Definition at line 433 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER

#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER
Value:
{ /* .order */ AV_CHANNEL_ORDER_AMBISONIC, \
/* .nb_channels */ 4, \
/* .u.mask */ { 0 }, \
/* .opaque */ NULL }

Definition at line 435 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS

#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS   (1 << 0)

The conversion must be lossless.

Definition at line 712 of file channel_layout.h.

◆ AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL

#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL   (1 << 1)

The specified retype target order is ignored and the simplest possible (canonical) order is used for which the input layout can be losslessy represented.

Definition at line 719 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_SIDE_SURROUND_LEFT 

+90 degrees, Lss, SiL

AV_CHAN_SIDE_SURROUND_RIGHT 

-90 degrees, Rss, SiR

AV_CHAN_TOP_SURROUND_LEFT 

+110 degrees, Lvs, TpLS

AV_CHAN_TOP_SURROUND_RIGHT 

-110 degrees, Rvs, TpRS

AV_CHAN_BINAURAL_LEFT 
AV_CHAN_BINAURAL_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 <i> between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel <n> is <n> = <i> - 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 47 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_UNUSED) 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.

FF_CHANNEL_ORDER_NB 

Number of channel orders, not part of ABI/API.

Definition at line 114 of file channel_layout.h.

Function Documentation

◆ 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.
channelthe AVChannel whose name to get
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.

Definition at line 104 of file channel_layout.c.

Referenced by channel_name(), check_idx_and_id(), filter_frame(), init(), join_config_output(), show_layouts(), and swr_build_matrix2().

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

Definition at line 86 of file channel_layout.c.

Referenced by av_channel_layout_describe_bprint(), av_channel_name(), and main().

◆ 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.
channelthe AVChannel whose description to get
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.

Definition at line 137 of file channel_layout.c.

Referenced by channel_description(), and show_layouts().

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

Definition at line 119 of file channel_layout.c.

Referenced by av_channel_description().

◆ 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

Definition at line 152 of file channel_layout.c.

Referenced by av_channel_layout_index_from_string(), get_channel(), parse_channel_list(), parse_channel_name(), and parse_maps().

◆ av_channel_layout_custom_init()

int av_channel_layout_custom_init ( AVChannelLayout channel_layout,
int  nb_channels 
)

Initialize a custom channel layout with the specified number of channels.

The channel map will be allocated and the designation of all channels will be set to AV_CHAN_UNKNOWN.

This is only a convenience helper function, a custom channel layout can also be constructed without using this.

Parameters
channel_layoutthe layout structure to be initialized
nb_channelsthe number of channels
Returns
0 on success AVERROR(EINVAL) if the number of channels <= 0 AVERROR(ENOMEM) if the channel map could not be allocated

Definition at line 231 of file channel_layout.c.

Referenced by av_channel_layout_retype(), ff_aac_usac_config_decode(), ff_mov_read_chan(), ff_mov_read_chnl(), flv_read_packet(), mov_get_channel_layout(), mov_read_SA3D(), and parse_mca_labels().

◆ av_channel_layout_from_mask()

int av_channel_layout_from_mask ( AVChannelLayout channel_layout,
uint64_t  mask 
)

◆ 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") On error, the channel layout will remain uninitialized, but not necessarily untouched.
Parameters
channel_layoutuninitialized channel layout for the result
strstring describing the channel layout
Returns
0 on success parsing the channel layout AVERROR(EINVAL) if an invalid channel layout string was provided AVERROR(ENOMEM) if there was not enough memory

Definition at line 311 of file channel_layout.c.

Referenced by activate(), av_channel_layout_from_string(), av_opt_is_set_to_default(), channel_layout_from_string(), channel_layout_retype(), common_init(), config_output(), ff_parse_channel_layout(), filter_frame(), init(), init_audio(), ist_add(), mov_write_SA3D_tag(), new_stream_audio(), and set_string_channel_layout().

◆ av_channel_layout_default()

void av_channel_layout_default ( AVChannelLayout ch_layout,
int  nb_channels 
)

◆ 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

Definition at line 851 of file channel_layout.c.

Referenced by main(), and show_layouts().

◆ 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

Definition at line 441 of file channel_layout.c.

Referenced by ac3_decode_frame(), ac3_downmix(), adx_decode_header(), alac_decode_init(), amr_parse(), amrnb_decode_init(), amrwb_decode_init(), ape_decode_init(), atrac9_decode_init(), audio_open(), av_channel_layout_copy(), av_channel_layout_from_string(), av_channel_layout_retype(), av_frame_unref(), av_opt_is_set_to_default(), avcodec_free_context(), bmv_aud_decode_init(), channel_layout_from_mask(), channel_layout_from_string(), channel_layout_retype(), cinaudio_decode_init(), clear_context(), cng_decode_init(), codec_parameters_reset(), config_changed(), config_output(), configure_filtergraph(), cook_decode_init(), dcadec_init(), decode_frame(), decode_init(), dolby_e_decode_frame(), dss_sp_decode_init(), evrc_decode_init(), ff_aac_ac3_parse(), ff_aac_output_configure(), ff_aac_usac_config_decode(), ff_codec_close(), ff_dca_lbr_filter_frame(), ff_dca_set_channel_layout(), ff_flac_set_channel_layout(), ff_get_wav_header(), ff_hls_senc_parse_audio_setup_info(), ff_make_channel_layout_list(), ff_mov_read_chan(), ff_mov_read_chnl(), ff_mp4_read_dec_config_descr(), ff_opus_parse_extradata(), ff_rtp_get_codec_info(), ffat_create_decoder(), ffat_update_ctx(), fg_free(), filter_frame(), flv_read_packet(), g722_decode_init(), get_codec_data(), get_stream_info(), gsm_init(), ilbc_decode_init(), imc_decode_init(), init(), init_context_defaults(), ist_add(), libcodec2_init_decoder(), libgsm_decode_init(), libopus_decode_init(), libspeex_decode_init(), link_free(), main(), merge_channel_layouts_internal(), metasound_decode_init(), mlp_decode_init(), mlp_parse(), mov_finalize_stsd_codec(), mov_get_channel_layout(), mov_read_dac3(), mov_read_ddts(), mov_read_dec3(), mov_read_dmlp(), mov_read_SA3D(), mov_write_SA3D_tag(), mpc7_decode_init(), mpc8_decode_init(), mpegaudio_parse(), oggvorbis_decode_init(), on2avc_decode_init(), opt_free_elem(), osq_init(), paf_audio_init(), parse_mca_labels(), pcm_bluray_parse_header(), pcm_dvd_parse_header(), pcm_read_header(), qcelp_decode_init(), qdm2_decode_init(), qdmc_decode_init(), qoa_decode_frame(), query_formats(), ra144_decode_init(), ra288_decode_init(), read_header(), read_restart_header(), read_specific_config(), rka_decode_init(), s302m_parse_frame_header(), sbc_decode_frame(), sbc_parse_header(), set_channel_params(), set_string_channel_layout(), sipr_decoder_init(), siren_init(), smka_decode_init(), speex_decode_init(), stream_component_open(), swap_channel_layouts_on_filter(), swr_build_matrix2(), swr_config_frame(), swr_free(), swr_init(), tak_decode_frame(), tak_read_header(), truespeech_decode_init(), tta_decode_init(), twinvq_decode_init(), uninit(), vmdaudio_decode_init(), vorbis_decode_frame(), vorbis_decode_init(), wavarc_init(), wmavoice_decode_init(), ws_snd_decode_init(), and xma_decode_init().

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

Definition at line 448 of file channel_layout.c.

Referenced by activate(), add_stream(), aeval_config_output(), alloc_audio_frame(), audio_decode_frame(), audio_open(), audio_thread(), av_buffersink_get_ch_layout(), av_buffersrc_add_frame_flags(), av_buffersrc_parameters_set(), av_frame_make_writable(), av_frame_ref(), av_frame_replace(), av_opt_get_chlayout(), av_opt_set_chlayout(), avcodec_parameters_copy(), avcodec_parameters_from_context(), avcodec_parameters_to_context(), channel_layout_retype(), channelmap_filter_frame(), clean_layout(), close_output(), config_changed(), config_output(), config_props(), dec_open(), dfpwm_read_header(), enc_open(), ff_aac_output_configure(), ff_aac_usac_config_decode(), ff_decode_receive_frame(), ff_default_get_audio_buffer(), ff_encode_alloc_frame(), ff_make_channel_layout_list(), ff_opus_parse_extradata(), fill_frame_props(), filter_frame(), get_input(), guess_channel_layout(), ifilter_parameters_from_frame(), init(), init_decoder(), init_encoder(), init_output_frame(), ist_filter_add(), libopus_decode_init(), LLVMFuzzerTestOneInput(), main(), mediacodec_wrap_sw_audio_buffer(), merge_channel_layouts_internal(), mix_presentation_obu(), oma_read_header(), open_output_file(), opt_copy_elem(), pad_last_frame(), pcm_read_header(), pick_format(), qoa_decode_frame(), read_frame_internal(), read_header_openmpt(), receive_samples(), reduce_formats_on_filter(), run_test(), scalable_channel_layout_config(), select_channel_layout(), send_eof(), set_channel_layout(), spawn_empty_frame(), stream_component_open(), swap_channel_layouts_on_filter(), swr_config_frame(), swr_init(), try_push_frame(), update_context_from_thread(), vorbis_decode_frame(), vorbis_decode_init(), and wavpack_decode_block().

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

Definition at line 652 of file channel_layout.c.

Referenced by aac_encode_init(), audio_thread(), channel_layout_from_mask(), channel_layout_from_string(), channelmap_init(), check_idx_and_id(), clean_layout(), config_output(), config_props(), dprint_options(), draw_legend(), dump_stream_group(), encode_preinit_audio(), ff_alsa_open(), ff_framehash_write_header(), filter_frame(), guess_channel_layout(), guess_input_channel_layout(), init(), init_audio(), init_encoder(), init_filter(), init_filter_graph(), init_filters(), libopus_check_vorbis_layout(), libvorbis_setup(), LLVMFuzzerTestOneInput(), main(), mov_write_chnl_tag(), opt_get_elem(), print_digraph(), print_formats_internal(), print_iamf_audio_element_params(), print_iamf_submix_params(), query_formats(), show_frame(), show_layouts(), show_stream(), swr_build_matrix2(), and swr_init().

◆ av_channel_layout_describe_bprint()

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

◆ av_channel_layout_channel_from_index()

enum AVChannel av_channel_layout_channel_from_index ( const AVChannelLayout channel_layout,
unsigned int  idx 
)

◆ 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
channelthe channel whose index to obtain
Returns
index of channel in channel_layout on success or a negative number if channel is not present in channel_layout.

Definition at line 712 of file channel_layout.c.

Referenced by ac3_decode_frame(), av_channel_layout_index_from_string(), av_channel_layout_subset(), bypass_channel(), channelmap_config_input(), channelmap_init(), clean_layout(), config_input(), config_output(), config_props(), convert_coeffs(), feed(), filter_channel(), filter_channels(), init(), join_config_output(), main(), pulse_map_channels_to_pulse(), query_formats(), read_restart_header(), set_input_levels(), set_output_levels(), show_layouts(), and swr_build_matrix2().

◆ 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
namestring describing the channel whose index to obtain
Returns
a channel index described by the given string, or a negative AVERROR value.

Definition at line 746 of file channel_layout.c.

Referenced by av_channel_layout_channel_from_string(), and parse_maps().

◆ 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
namestring describing the channel to obtain
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)

Definition at line 701 of file channel_layout.c.

◆ 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

Definition at line 864 of file channel_layout.c.

Referenced by mlp_channel_layout_subset(), mlp_encode_init(), mov_write_SA3D_tag(), pcm_bluray_encode_init(), query_formats(), sane_layout(), set_channel_info(), swap_channel_layouts_on_filter(), and swr_build_matrix2().

◆ av_channel_layout_check()

int av_channel_layout_check ( const AVChannelLayout channel_layout)

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

Definition at line 808 of file channel_layout.c.

Referenced by aac_encode_init(), ac3_decode_frame(), ac3_downmix(), audio_decode_frame(), audio_thread(), av_opt_is_set_to_default(), channel_layout_retype(), config_changed(), config_output(), dcadec_init(), decode_frame_ga(), encode_preinit_audio(), ff_aac_usac_decode_frame(), ff_decode_receive_frame(), ff_filter_frame(), ff_iamf_add_audio_element(), ff_put_wav_header(), flac_encode_init(), flv_write_codec_header(), frame_copy_audio(), get_aac_tag(), get_buffer(), get_mix_any_func_TMPL(), iamf_write_mixing_presentation(), layouts_compatible(), libopus_check_vorbis_layout(), libvorbis_setup(), main(), merge_channel_layouts_internal(), mlp_decode_init(), mov_write_header(), reduce_formats_on_filter(), run_test(), scalable_channel_layout_config(), send_frame(), swr_build_matrix2(), swr_init(), and wavpack_decode_block().

◆ av_channel_layout_ambisonic_order()

int av_channel_layout_ambisonic_order ( const AVChannelLayout channel_layout)

Return the order if the layout is n-th order standard-order ambisonic.

The presence of optional extra non-diegetic channels at the end is not taken into account.

Parameters
channel_layoutinput channel layout
Returns
the order of the layout, a negative error code otherwise.

Definition at line 484 of file channel_layout.c.

Referenced by av_channel_layout_retype(), canonical_order(), mov_write_SA3D_tag(), and try_describe_ambisonic().

◆ av_channel_layout_retype()

int av_channel_layout_retype ( AVChannelLayout channel_layout,
enum AVChannelOrder  order,
int  flags 
)

Change the AVChannelOrder of a channel layout.

Change of AVChannelOrder can be either lossless or lossy. In case of a lossless conversion all the channel designations and the associated channel names (if any) are kept. On a lossy conversion the channel names and channel designations might be lost depending on the capabilities of the desired AVChannelOrder. Note that some conversions are simply not possible in which case this function returns AVERROR(ENOSYS).

The following conversions are supported:

Any -> Custom : Always possible, always lossless. Any -> Unspecified: Always possible, lossless if channel designations are all unknown and channel names are not used, lossy otherwise. Custom -> Ambisonic : Possible if it contains ambisonic channels with optional non-diegetic channels in the end. Lossy if the channels have custom names, lossless otherwise. Custom -> Native : Possible if it contains native channels in native order. Lossy if the channels have custom names, lossless otherwise.

On error this function keeps the original channel layout untouched.

Parameters
channel_layoutchannel layout which will be changed
orderthe desired channel layout order
flagsa combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants
Returns
0 if the conversion was successful and lossless or if the channel layout was already in the desired order >0 if the conversion was successful but lossy AVERROR(ENOSYS) if the conversion was not possible (or would be lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified) AVERROR(EINVAL), AVERROR(ENOMEM) on error

Definition at line 884 of file channel_layout.c.

Referenced by channel_layout_retype(), ff_aac_usac_config_decode(), ff_mov_read_chan(), ff_mov_read_chnl(), mov_get_channel_layout(), mov_read_SA3D(), parse_channel_list(), parse_mca_labels(), and query_formats().

AV_CHANNEL_ORDER_AMBISONIC
@ AV_CHANNEL_ORDER_AMBISONIC
The audio is represented as the decomposition of the sound field into spherical harmonics.
Definition: channel_layout.h:155
NULL
#define NULL
Definition: coverity.c:32
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:125