Collaboration diagram for Audio related:

Modules

 Audio channel masks
 A channel layout is a 64-bits integer with a bit set for every channel.
 
 Audio channel convenience macros
 

Typedefs

typedef struct AVAudioFifo AVAudioFifo
 Context for an Audio FIFO Buffer. More...
 

Functions

void av_audio_fifo_free (AVAudioFifo *af)
 Free an AVAudioFifo. More...
 
AVAudioFifoav_audio_fifo_alloc (enum AVSampleFormat sample_fmt, int channels, int nb_samples)
 Allocate an AVAudioFifo. More...
 
int av_audio_fifo_realloc (AVAudioFifo *af, int nb_samples)
 Reallocate an AVAudioFifo. More...
 
int av_audio_fifo_write (AVAudioFifo *af, void **data, int nb_samples)
 Write data to an AVAudioFifo. More...
 
int av_audio_fifo_read (AVAudioFifo *af, void **data, int nb_samples)
 Read data from an AVAudioFifo. More...
 
int av_audio_fifo_drain (AVAudioFifo *af, int nb_samples)
 Drain data from an AVAudioFifo. More...
 
void av_audio_fifo_reset (AVAudioFifo *af)
 Reset the AVAudioFifo buffer. More...
 
int av_audio_fifo_size (AVAudioFifo *af)
 Get the current number of samples in the AVAudioFifo available for reading. More...
 
int av_audio_fifo_space (AVAudioFifo *af)
 Get the current number of samples in the AVAudioFifo available for writing. More...
 
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...
 
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

Typedef Documentation

typedef struct AVAudioFifo AVAudioFifo

Context for an Audio FIFO Buffer.

  • Operates at the sample level rather than the byte level.
  • Supports multiple channels with either planar or packed sample format.
  • Automatic reallocation when writing to a full buffer.

Definition at line 46 of file audio_fifo.h.

Function Documentation

AVAudioFifo* av_audio_fifo_alloc ( enum AVSampleFormat  sample_fmt,
int  channels,
int  nb_samples 
)

Allocate an AVAudioFifo.

Parameters
sample_fmtsample format
channelsnumber of channels
nb_samplesinitial allocation size, in samples
Returns
newly allocated AVAudioFifo, or NULL on error

Definition at line 60 of file audio_fifo.c.

Referenced by av_buffersink_get_samples(), avresample_open(), config_output(), and config_props_output().

int av_audio_fifo_drain ( AVAudioFifo af,
int  nb_samples 
)

Drain data from an AVAudioFifo.

Removes the data without reading it.

Parameters
afAVAudioFifo to drain
nb_samplesnumber of samples to drain
Returns
0 if OK, or negative AVERROR code on failure

Definition at line 159 of file audio_fifo.c.

Referenced by avresample_read().

void av_audio_fifo_free ( AVAudioFifo af)

Free an AVAudioFifo.

Parameters
afAVAudioFifo to free

Definition at line 45 of file audio_fifo.c.

Referenced by av_audio_fifo_alloc(), avresample_close(), and uninit().

int av_audio_fifo_read ( AVAudioFifo af,
void **  data,
int  nb_samples 
)

Read data from an AVAudioFifo.

See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
Parameters
afAVAudioFifo to read from
dataaudio data plane pointers
nb_samplesnumber of samples to read
Returns
number of samples actually read, or negative AVERROR code on failure. The number of samples actually read will not be greater than nb_samples, and will only be less than nb_samples if av_audio_fifo_size is less than nb_samples.

Definition at line 139 of file audio_fifo.c.

Referenced by avresample_read(), ff_audio_data_read_from_fifo(), output_frame(), push_samples(), and read_from_fifo().

int av_audio_fifo_realloc ( AVAudioFifo af,
int  nb_samples 
)

Reallocate an AVAudioFifo.

Parameters
afAVAudioFifo to reallocate
nb_samplesnew allocation size, in samples
Returns
0 if OK, or negative AVERROR code on failure

Definition at line 97 of file audio_fifo.c.

Referenced by av_audio_fifo_write(), and filter_frame().

void av_audio_fifo_reset ( AVAudioFifo af)

Reset the AVAudioFifo buffer.

This empties all data in the buffer.

Parameters
afAVAudioFifo to reset

Definition at line 176 of file audio_fifo.c.

int av_audio_fifo_size ( AVAudioFifo af)

Get the current number of samples in the AVAudioFifo available for reading.

Parameters
afthe AVAudioFifo to query
Returns
number of samples available for reading

Definition at line 186 of file audio_fifo.c.

Referenced by av_audio_fifo_write(), av_buffersink_get_samples(), avresample_available(), avresample_convert(), avresample_set_compensation(), filter_frame(), get_available_samples(), handle_buffered_output(), push_samples(), and request_samples().

int av_audio_fifo_space ( AVAudioFifo af)

Get the current number of samples in the AVAudioFifo available for writing.

Parameters
afthe AVAudioFifo to query
Returns
number of samples available for writing

Definition at line 191 of file audio_fifo.c.

Referenced by av_audio_fifo_write(), and filter_frame().

int av_audio_fifo_write ( AVAudioFifo af,
void **  data,
int  nb_samples 
)

Write data to an AVAudioFifo.

The AVAudioFifo will be reallocated automatically if the available space is less than nb_samples.

See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
Parameters
afAVAudioFifo to write to
dataaudio data plane pointers
nb_samplesnumber of samples to write
Returns
number of samples actually written, or negative AVERROR code on failure. If successful, the number of samples actually written will always be nb_samples.

Definition at line 113 of file audio_fifo.c.

Referenced by av_buffersink_get_samples(), ff_audio_data_add_to_fifo(), and filter_frame().

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 148 of file channel_layout.c.

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

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 236 of file channel_layout.c.

Referenced by filter_frame(), guess_map_any(), init(), join_config_output(), join_init(), and query_formats().

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 225 of file channel_layout.c.

Referenced by show_layouts().

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, optionally 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" = "2+FC" = "2c+1c" = "0x7"

Definition at line 132 of file channel_layout.c.

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

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 204 of file channel_layout.c.

Referenced by channelmap_config_input(), channelmap_init(), join_config_output(), parse_maps(), and read_restart_header().

int av_get_channel_layout_nb_channels ( uint64_t  channel_layout)
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

Definition at line 182 of file channel_layout.c.

Referenced by audio_decode_frame(), auto_matrix(), avcodec_open2(), avcodec_string(), channelmap_config_input(), channelmap_init(), clean_layout(), config_output(), config_props(), decode_audio(), dprint_options(), ff_alsa_open(), ff_audio_mix_set_matrix(), ff_parse_channel_layout(), ff_tlog_link(), filter_frame(), guess_channel_layout(), guess_input_channel_layout(), init_filters(), main(), oggvorbis_init_encoder(), print_digraph(), print_link_prop(), query_formats(), and swr_init().

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 214 of file channel_layout.c.

Referenced by channelmap_config_input(), init(), join_config_output(), and show_layouts().

int64_t av_get_default_channel_layout ( int  nb_channels)
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 250 of file channel_layout.c.

Referenced by show_layouts().