#include "libavutil/common.h"
#include "libavutil/dict.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avresample.h"
#include "audio_data.h"
#include "internal.h"
Go to the source code of this file.
Defines | |
#define | LICENSE_PREFIX "libavresample license: " |
Functions | |
int | avresample_open (AVAudioResampleContext *avr) |
Initialize AVAudioResampleContext. | |
void | avresample_close (AVAudioResampleContext *avr) |
Close AVAudioResampleContext. | |
void | avresample_free (AVAudioResampleContext **avr) |
Free AVAudioResampleContext and associated AVOption values. | |
static int | handle_buffered_output (AVAudioResampleContext *avr, AudioData *output, AudioData *converted) |
int attribute_align_arg | avresample_convert (AVAudioResampleContext *avr, void **output, int out_plane_size, int out_samples, void **input, int in_plane_size, int in_samples) |
Convert input samples and write them to the output FIFO. | |
int | avresample_available (AVAudioResampleContext *avr) |
Return the number of available samples in the output FIFO. | |
int | avresample_read (AVAudioResampleContext *avr, void **output, int nb_samples) |
Read samples from the output FIFO. | |
unsigned | avresample_version (void) |
Return the LIBAVRESAMPLE_VERSION_INT constant. | |
const char * | avresample_license (void) |
Return the libavresample license. | |
const char * | avresample_configuration (void) |
Return the libavresample build-time configuration. |
#define LICENSE_PREFIX "libavresample license: " |
int avresample_available | ( | AVAudioResampleContext * | avr | ) |
Return the number of available samples in the output FIFO.
During conversion, if the user does not specify an output buffer or specifies an output buffer that is smaller than what is needed, remaining samples that are not written to the output are stored to an internal FIFO buffer. The samples in the FIFO can be read with avresample_read() or avresample_convert().
avr | audio resample context |
Definition at line 408 of file utils.c.
Referenced by filter_samples(), get_delay(), and main().
void avresample_close | ( | AVAudioResampleContext * | avr | ) |
Close AVAudioResampleContext.
This closes the context, but it does not change the parameters. The context can be reopened with avresample_open(). It does, however, clear the output FIFO and any remaining leftover samples in the resampling delay buffer. If there was a custom matrix being used, that is also cleared.
avr | audio resample context |
Definition at line 184 of file utils.c.
Referenced by avresample_free(), avresample_open(), avresample_set_compensation(), config_output(), main(), and uninit().
const char* avresample_configuration | ( | void | ) |
int attribute_align_arg avresample_convert | ( | AVAudioResampleContext * | avr, | |
void ** | output, | |||
int | out_plane_size, | |||
int | out_samples, | |||
void ** | input, | |||
int | in_plane_size, | |||
int | in_samples | |||
) |
Convert input samples and write them to the output FIFO.
The output data can be NULL or have fewer allocated samples than required. In this case, any remaining samples not written to the output will be added to an internal FIFO buffer, to be returned at the next call to this function or to avresample_read().
If converting sample rate, there may be data remaining in the internal resampling delay buffer. avresample_get_delay() tells the number of remaining samples. To get this data as output, call avresample_convert() with NULL input.
At the end of the conversion process, there may be data remaining in the internal FIFO buffer. avresample_available() tells the number of remaining samples. To get this data as output, either call avresample_convert() with NULL input or call avresample_read().
avr | audio resample context | |
output | output data pointers | |
out_plane_size | output plane size, in bytes. This can be 0 if unknown, but that will lead to optimized functions not being used directly on the output, which could slow down some conversions. | |
out_samples | maximum number of samples that the output buffer can hold | |
input | input data pointers | |
in_plane_size | input plane size, in bytes This can be 0 if unknown, but that will lead to optimized functions not being used directly on the input, which could slow down some conversions. | |
in_samples | number of input samples to convert |
Definition at line 249 of file utils.c.
Referenced by filter_samples(), main(), request_frame(), and write_to_fifo().
void avresample_free | ( | AVAudioResampleContext ** | avr | ) |
Free AVAudioResampleContext and associated AVOption values.
This also calls avresample_close() before freeing.
avr | audio resample context |
Definition at line 198 of file utils.c.
Referenced by config_output(), main(), and uninit().
const char* avresample_license | ( | void | ) |
int avresample_open | ( | AVAudioResampleContext * | avr | ) |
Initialize AVAudioResampleContext.
avr | audio resample context |
Definition at line 32 of file utils.c.
Referenced by avresample_set_compensation(), config_output(), config_props(), and main().
int avresample_read | ( | AVAudioResampleContext * | avr, | |
void ** | output, | |||
int | nb_samples | |||
) |
Read samples from the output FIFO.
During conversion, if the user does not specify an output buffer or specifies an output buffer that is smaller than what is needed, remaining samples that are not written to the output are stored to an internal FIFO buffer. This function can be used to read samples from that internal FIFO.
avr | audio resample context | |
output | output data pointers. May be NULL, in which case nb_samples of data is discarded from output FIFO. | |
nb_samples | number of samples to read from the FIFO |
Definition at line 413 of file utils.c.
Referenced by filter_samples().
unsigned avresample_version | ( | void | ) |
static int handle_buffered_output | ( | AVAudioResampleContext * | avr, | |
AudioData * | output, | |||
AudioData * | converted | |||
) | [static] |