FFmpeg
Functions
Audio FIFO Buffer

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...
 
av_warn_unused_result 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_peek (AVAudioFifo *af, void **data, int nb_samples)
 Peek data from an AVAudioFifo. More...
 
int av_audio_fifo_peek_at (AVAudioFifo *af, void **data, int nb_samples, int offset)
 Peek data from 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...
 

Detailed Description

Function Documentation

◆ av_audio_fifo_free()

void av_audio_fifo_free ( AVAudioFifo af)

◆ av_audio_fifo_alloc()

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 62 of file audio_fifo.c.

Referenced by apac_init(), config_input(), config_output(), init_fifo(), opus_decode_init(), test_function(), and xma_decode_init().

◆ av_audio_fifo_realloc()

av_warn_unused_result 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 99 of file audio_fifo.c.

Referenced by add_samples_to_fifo(), and av_audio_fifo_write().

◆ av_audio_fifo_write()

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 119 of file audio_fifo.c.

Referenced by activate(), add_samples_to_fifo(), apac_decode(), config_input(), filter_frame(), flush(), opus_decode_frame(), opus_decode_packet(), spatial_activate(), write_samples_to_audio_fifo(), and xma_decode_packet().

◆ av_audio_fifo_peek()

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

Peek 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 peek
Returns
number of samples actually peek, or negative AVERROR code on failure. The number of samples actually peek 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 145 of file audio_fifo.c.

Referenced by activate(), filter_channel(), filter_frame(), spatial_activate(), and test_function().

◆ av_audio_fifo_peek_at()

int av_audio_fifo_peek_at ( AVAudioFifo af,
void **  data,
int  nb_samples,
int  offset 
)

Peek 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 peek
offsetoffset from current read position
Returns
number of samples actually peek, or negative AVERROR code on failure. The number of samples actually peek 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 150 of file audio_fifo.c.

Referenced by av_audio_fifo_peek(), and test_function().

◆ av_audio_fifo_read()

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 174 of file audio_fifo.c.

Referenced by apac_decode(), filter_frame(), load_encode_and_write(), opus_decode_frame(), opus_decode_packet(), opus_flush_resample(), output_frame(), read_samples_from_audio_fifo(), and xma_decode_packet().

◆ av_audio_fifo_drain()

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 194 of file audio_fifo.c.

Referenced by activate(), filter_frame(), opus_decode_flush(), opus_decode_frame(), spatial_activate(), and test_function().

◆ av_audio_fifo_reset()

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 211 of file audio_fifo.c.

Referenced by xma_flush().

◆ av_audio_fifo_size()

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 221 of file audio_fifo.c.

Referenced by activate(), add_samples_to_fifo(), apac_decode(), av_audio_fifo_write(), filter_frame(), load_encode_and_write(), main(), opus_decode_flush(), opus_decode_frame(), opus_decode_packet(), opus_flush_resample(), output_frame(), request_samples(), spatial_activate(), test_function(), and xma_decode_packet().

◆ av_audio_fifo_space()

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 226 of file audio_fifo.c.

Referenced by av_audio_fifo_write().