#include <stdint.h>
#include "libavutil/mem.h"
#include "audio_data.h"
Go to the source code of this file.
Functions | |
static void | calc_ptr_alignment (AudioData *a) |
int | ff_audio_data_set_channels (AudioData *a, int channels) |
int | ff_audio_data_init (AudioData *a, void **src, int plane_size, int channels, int nb_samples, enum AVSampleFormat sample_fmt, int read_only, const char *name) |
Initialize AudioData using a given source. | |
AudioData * | ff_audio_data_alloc (int channels, int nb_samples, enum AVSampleFormat sample_fmt, const char *name) |
Allocate AudioData. | |
int | ff_audio_data_realloc (AudioData *a, int nb_samples) |
Reallocate AudioData. | |
void | ff_audio_data_free (AudioData **a) |
Free AudioData. | |
int | ff_audio_data_copy (AudioData *dst, AudioData *src) |
Copy data from one AudioData to another. | |
int | ff_audio_data_combine (AudioData *dst, int dst_offset, AudioData *src, int src_offset, int nb_samples) |
Append data from one AudioData to the end of another. | |
void | ff_audio_data_drain (AudioData *a, int nb_samples) |
Drain samples from the start of the AudioData. | |
int | ff_audio_data_add_to_fifo (AVAudioFifo *af, AudioData *a, int offset, int nb_samples) |
Add samples in AudioData to an AVAudioFifo. | |
int | ff_audio_data_read_from_fifo (AVAudioFifo *af, AudioData *a, int nb_samples) |
Read samples from an AVAudioFifo to AudioData. | |
Variables | |
static const AVClass | audio_data_class |
static void calc_ptr_alignment | ( | AudioData * | a | ) | [static] |
Definition at line 35 of file audio_data.c.
Referenced by ff_audio_data_alloc(), ff_audio_data_init(), ff_audio_data_realloc(), and ff_audio_data_set_channels().
int ff_audio_data_add_to_fifo | ( | AVAudioFifo * | af, | |
AudioData * | a, | |||
int | offset, | |||
int | nb_samples | |||
) |
Add samples in AudioData to an AVAudioFifo.
af | Audio FIFO Buffer | |
a | AudioData struct | |
offset | number of samples to skip from the start of the data | |
nb_samples | number of samples to add to the FIFO |
Definition at line 315 of file audio_data.c.
Referenced by avresample_set_compensation(), and handle_buffered_output().
AudioData* ff_audio_data_alloc | ( | int | channels, | |
int | nb_samples, | |||
enum AVSampleFormat | sample_fmt, | |||
const char * | name | |||
) |
Allocate AudioData.
This allocates an internal buffer and sets audio parameters.
channels | channel count | |
nb_samples | number of samples to allocate space for | |
sample_fmt | sample format | |
name | name for debug logging (can be NULL) |
Definition at line 109 of file audio_data.c.
Referenced by avresample_open(), avresample_set_compensation(), and ff_audio_resample_init().
int ff_audio_data_combine | ( | AudioData * | dst, | |
int | dst_offset, | |||
AudioData * | src, | |||
int | src_offset, | |||
int | nb_samples | |||
) |
Append data from one AudioData to the end of another.
dst | destination AudioData | |
dst_offset | offset, in samples, to start writing, relative to the start of dst | |
src | source AudioData | |
src_offset | offset, in samples, to start copying, relative to the start of the src | |
nb_samples | number of samples to copy |
Definition at line 242 of file audio_data.c.
Referenced by ff_audio_resample().
Copy data from one AudioData to another.
Definition at line 215 of file audio_data.c.
Referenced by avresample_convert(), and handle_buffered_output().
void ff_audio_data_drain | ( | AudioData * | a, | |
int | nb_samples | |||
) |
Drain samples from the start of the AudioData.
Remaining samples are shifted to the start of the AudioData.
a | AudioData struct | |
nb_samples | number of samples to drain |
Definition at line 298 of file audio_data.c.
Referenced by ff_audio_resample().
void ff_audio_data_free | ( | AudioData ** | a | ) |
Free AudioData.
The AudioData must have been previously allocated with ff_audio_data_alloc().
a | AudioData struct |
Definition at line 207 of file audio_data.c.
Referenced by avresample_close(), avresample_set_compensation(), ff_audio_resample_free(), and ff_audio_resample_init().
int ff_audio_data_init | ( | AudioData * | a, | |
void ** | src, | |||
int | plane_size, | |||
int | channels, | |||
int | nb_samples, | |||
enum AVSampleFormat | sample_fmt, | |||
int | read_only, | |||
const char * | name | |||
) |
Initialize AudioData using a given source.
This does not allocate an internal buffer. It only sets the data pointers and audio parameters.
a | AudioData struct | |
src | source data pointers | |
plane_size | plane size, in bytes. This can be 0 if unknown, but that will lead to optimized functions not being used in many cases, which could slow down some conversions. | |
channels | channel count | |
nb_samples | number of samples in the source data | |
sample_fmt | sample format | |
read_only | indicates if buffer is read only or read/write | |
name | name for debug logging (can be NULL) |
Definition at line 64 of file audio_data.c.
Referenced by avresample_convert().
int ff_audio_data_read_from_fifo | ( | AVAudioFifo * | af, | |
AudioData * | a, | |||
int | nb_samples | |||
) |
Read samples from an AVAudioFifo to AudioData.
af | Audio FIFO Buffer | |
a | AudioData struct | |
nb_samples | number of samples to read from the FIFO |
Definition at line 330 of file audio_data.c.
Referenced by avresample_set_compensation(), and handle_buffered_output().
int ff_audio_data_realloc | ( | AudioData * | a, | |
int | nb_samples | |||
) |
Reallocate AudioData.
The AudioData must have been previously allocated with ff_audio_data_alloc().
a | AudioData struct | |
nb_samples | number of samples to allocate space for |
Definition at line 152 of file audio_data.c.
Referenced by avresample_convert(), ff_audio_data_alloc(), ff_audio_data_combine(), ff_audio_data_copy(), ff_audio_data_read_from_fifo(), and ff_audio_resample().
int ff_audio_data_set_channels | ( | AudioData * | a, | |
int | channels | |||
) |
const AVClass audio_data_class [static] |
Initial value:
{ .class_name = "AudioData", .item_name = av_default_item_name, .version = LIBAVUTIL_VERSION_INT, }
Definition at line 26 of file audio_data.c.