Audio related
[Common utility functions]


Modules

 Audio channel masks
 Audio channel convenience macros

Typedefs

typedef struct AVAudioFifo AVAudioFifo
 Context for an Audio FIFO Buffer.

Functions

void av_audio_fifo_free (AVAudioFifo *af)
 Free an AVAudioFifo.
AVAudioFifoav_audio_fifo_alloc (enum AVSampleFormat sample_fmt, int channels, int nb_samples)
 Allocate an AVAudioFifo.
int av_audio_fifo_realloc (AVAudioFifo *af, int nb_samples)
 Reallocate an AVAudioFifo.
int av_audio_fifo_write (AVAudioFifo *af, void **data, int nb_samples)
 Write data to an AVAudioFifo.
int av_audio_fifo_read (AVAudioFifo *af, void **data, int nb_samples)
 Read data from an AVAudioFifo.
int av_audio_fifo_drain (AVAudioFifo *af, int nb_samples)
 Drain data from an AVAudioFifo.
void av_audio_fifo_reset (AVAudioFifo *af)
 Reset the AVAudioFifo buffer.
int av_audio_fifo_size (AVAudioFifo *af)
 Get the current number of samples in the AVAudioFifo available for reading.
int av_audio_fifo_space (AVAudioFifo *af)
 Get the current number of samples in the AVAudioFifo available for writing.
uint64_t av_get_channel_layout (const char *name)
 Return a channel layout id that matches name, or 0 if no match is found.
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.
int av_get_channel_layout_nb_channels (uint64_t channel_layout)
 Return the number of channels in the channel layout.
int64_t av_get_default_channel_layout (int nb_channels)
 Return default channel layout for a given number of channels.

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_fmt sample format
channels number of channels
nb_samples initial allocation size, in samples
Returns:
newly allocated AVAudioFifo, or NULL on error

Definition at line 59 of file audio_fifo.c.

Referenced by av_buffersink_read_samples(), avresample_open(), and config_output().

int av_audio_fifo_drain ( AVAudioFifo af,
int  nb_samples 
)

Drain data from an AVAudioFifo.

Removes the data without reading it.

Parameters:
af AVAudioFifo to drain
nb_samples number of samples to drain
Returns:
0 if OK, or negative AVERROR code on failure

Definition at line 158 of file audio_fifo.c.

Referenced by avresample_read().

void av_audio_fifo_free ( AVAudioFifo af  ) 

Free an AVAudioFifo.

Parameters:
af AVAudioFifo to free

Definition at line 44 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:
af AVAudioFifo to read from
data audio data plane pointers
nb_samples number of samples to read
Returns:
number of samples actually read, or negative AVERROR code on failure.

Definition at line 138 of file audio_fifo.c.

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

int av_audio_fifo_realloc ( AVAudioFifo af,
int  nb_samples 
)

Reallocate an AVAudioFifo.

Parameters:
af AVAudioFifo to reallocate
nb_samples new allocation size, in samples
Returns:
0 if OK, or negative AVERROR code on failure

Definition at line 96 of file audio_fifo.c.

Referenced by av_audio_fifo_write().

void av_audio_fifo_reset ( AVAudioFifo af  ) 

Reset the AVAudioFifo buffer.

This empties all data in the buffer.

Parameters:
af AVAudioFifo to reset

Definition at line 175 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:
af the AVAudioFifo to query
Returns:
number of samples available for reading

Definition at line 185 of file audio_fifo.c.

Referenced by av_audio_fifo_write(), av_buffersink_read_samples(), avresample_available(), avresample_set_compensation(), get_available_samples(), handle_buffered_output(), and request_samples().

int av_audio_fifo_space ( AVAudioFifo af  ) 

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

Parameters:
af the AVAudioFifo to query
Returns:
number of samples available for writing

Definition at line 190 of file audio_fifo.c.

Referenced by 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:
af AVAudioFifo to write to
data audio data plane pointers
nb_samples number of samples to write
Returns:
number of samples actually written, or negative AVERROR code on failure.

Definition at line 112 of file audio_fifo.c.

Referenced by av_buffersink_read_samples(), ff_audio_data_add_to_fifo(), and filter_samples().

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 123 of file audioconvert.c.

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

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:
buf put here the string containing the channel layout
buf_size size in bytes of the buffer

Definition at line 139 of file audioconvert.c.

Referenced by avcodec_string(), config_output(), config_props(), decode_audio(), dprint_options(), ff_alsa_open(), ff_audio_mix_init(), ff_dlog_link(), filter_samples(), guess_input_channel_layout(), init_filters(), main(), oggvorbis_init_encoder(), print_digraph(), print_link_prop(), and query_formats().

int64_t av_get_default_channel_layout ( int  nb_channels  ) 


Generated on Fri Oct 26 02:48:04 2012 for FFmpeg by  doxygen 1.5.8