FFmpeg 5.1.6
Data Fields
AVChannelLayout Struct Reference

An AVChannelLayout holds information about the channel layout of audio data. More...

#include <libavutil/channel_layout.h>

Data Fields

enum AVChannelOrder order
 Channel order used in this layout. More...
 
int nb_channels
 Number of channels in this layout. More...
 
union {
   uint64_t   mask
 This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels. More...
 
   AVChannelCustom *   map
 This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM. More...
 
u
 Details about which channels are present in this layout. More...
 
void * opaque
 For some private data of the user. More...
 

Detailed Description

An AVChannelLayout holds information about the channel layout of audio data.

A channel layout here is defined as a set of channels ordered in a specific way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an AVChannelLayout carries only the channel count).

Unlike most structures in Libav, sizeof(AVChannelLayout) is a part of the public ABI and may be used by the caller. E.g. it may be allocated on stack or embedded in caller-defined structs.

AVChannelLayout can be initialized as follows:

The channel layout must be unitialized with av_channel_layout_uninit()

Copying an AVChannelLayout via assigning is forbidden, av_channel_layout_copy() must be used instead (and its return value should be checked)

No new fields may be added to it without a major version bump, except for new elements of the union fitting in sizeof(uint64_t).

Examples
encode_audio.c, muxing.c, and resampling_audio.c.

Definition at line 290 of file channel_layout.h.

Field Documentation

◆ order

enum AVChannelOrder AVChannelLayout::order

Channel order used in this layout.

This is a mandatory field.

Examples
filtering_audio.c, and transcoding.c.

Definition at line 295 of file channel_layout.h.

Referenced by init_filter(), and init_filters().

◆ nb_channels

int AVChannelLayout::nb_channels

◆ mask

uint64_t AVChannelLayout::mask

This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels.

It is a bitmask, where the position of each set bit means that the AVChannel with the corresponding value is present.

I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO is present in the layout. Otherwise it is not present.

Note
when a channel layout using a bitmask is constructed or modified manually (i.e. not using any of the av_channel_layout_* functions), the code doing it must ensure that the number of set bits is equal to nb_channels.

Definition at line 322 of file channel_layout.h.

◆ map

AVChannelCustom* AVChannelLayout::map

This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.

It is a nb_channels-sized array, with each element signalling the presence of the AVChannel with the corresponding value in map[i].id.

I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the i-th channel in the audio data.

When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic component with ACN index (as defined above) n = map[i].id - AV_CHAN_AMBISONIC_BASE.

map[i].name may be filled with a 0-terminated string, in which case it will be used for the purpose of identifying the channel with the convenience functions below. Otherise it must be zeroed.

Definition at line 341 of file channel_layout.h.

◆ 

union { ... } AVChannelLayout::u

Details about which channels are present in this layout.

For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be used.

◆ opaque

void* AVChannelLayout::opaque

For some private data of the user.

Definition at line 347 of file channel_layout.h.


The documentation for this struct was generated from the following file: