Libav
|
Functions that manipulate audio samples. More...
Functions | |
int | av_samples_fill_arrays (uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) |
Fill channel data pointers and linesize for samples with sample format sample_fmt. More... | |
int | av_samples_alloc (uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) |
Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly. More... | |
int | av_samples_copy (uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt) |
Copy samples from src to dst. More... | |
int | av_samples_set_silence (uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt) |
Fill an audio buffer with silence. More... | |
Functions that manipulate audio samples.
int av_samples_fill_arrays | ( | uint8_t ** | audio_data, |
int * | linesize, | ||
const uint8_t * | buf, | ||
int | nb_channels, | ||
int | nb_samples, | ||
enum AVSampleFormat | sample_fmt, | ||
int | align | ||
) |
Fill channel data pointers and linesize for samples with sample format sample_fmt.
The pointers array is filled with the pointers to the samples data: for planar, set the start point of each channel's data within the buffer, for packed, set the start point of the entire buffer only.
The linesize array is filled with the aligned size of each channel's data buffer for planar layout, or the aligned size of the buffer for all channels for packed layout.
[out] | audio_data | array to be filled with the pointer for each channel |
[out] | linesize | calculated linesize, may be NULL |
buf | the pointer to a buffer containing the samples | |
nb_channels | the number of channels | |
nb_samples | the number of samples in a single channel | |
sample_fmt | the sample format | |
align | buffer size alignment (0 = default, 1 = no alignment) |
Definition at line 140 of file samplefmt.c.
Referenced by allocate_buffers(), av_samples_alloc(), avcodec_fill_audio_frame(), dca_decode_frame(), ff_audio_data_realloc(), main(), and tak_decode_frame().
int av_samples_alloc | ( | uint8_t ** | audio_data, |
int * | linesize, | ||
int | nb_channels, | ||
int | nb_samples, | ||
enum AVSampleFormat | sample_fmt, | ||
int | align | ||
) |
Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly.
The allocated samples buffer can be freed by using av_freep(&audio_data[0]) Allocated data will be initialized to silence.
[out] | audio_data | array to be filled with the pointer for each channel |
[out] | linesize | aligned size for audio buffer(s), may be NULL |
nb_channels | number of audio channels | |
nb_samples | number of samples per channel | |
align | buffer size alignment (0 = default, 1 = no alignment) |
Definition at line 162 of file samplefmt.c.
Referenced by ff_audio_data_realloc(), and init_converted_samples().
int av_samples_copy | ( | uint8_t ** | dst, |
uint8_t *const * | src, | ||
int | dst_offset, | ||
int | src_offset, | ||
int | nb_samples, | ||
int | nb_channels, | ||
enum AVSampleFormat | sample_fmt | ||
) |
Copy samples from src to dst.
dst | destination array of pointers to data planes |
src | source array of pointers to data planes |
dst_offset | offset in samples at which the data will be written to dst |
src_offset | offset in samples at which the data will be read from src |
nb_samples | number of samples to be copied |
nb_channels | number of audio channels |
sample_fmt | audio sample format |
Definition at line 187 of file samplefmt.c.
Referenced by ff_filter_frame(), frame_copy_audio(), pad_last_frame(), and return_audio_frame().
int av_samples_set_silence | ( | uint8_t ** | audio_data, |
int | offset, | ||
int | nb_samples, | ||
int | nb_channels, | ||
enum AVSampleFormat | sample_fmt | ||
) |
Fill an audio buffer with silence.
audio_data | array of pointers to data planes |
offset | offset in samples at which to start filling |
nb_samples | number of samples to fill |
nb_channels | number of audio channels |
sample_fmt | audio sample format |
Definition at line 206 of file samplefmt.c.
Referenced by av_samples_alloc(), ff_audio_data_copy(), ff_audio_mix(), ff_default_get_audio_buffer(), filter_frame(), pad_last_frame(), and return_audio_frame().