FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
resample.c File Reference
#include "libavutil/common.h"
#include "libavutil/libm.h"
#include "libavutil/log.h"
#include "internal.h"
#include "audio_data.h"
#include "resample_template.c"

Go to the source code of this file.

Data Structures

struct  resample_init_func
 

Macros

#define CONFIG_RESAMPLE_DBL
 
#define CONFIG_RESAMPLE_FLT
 
#define CONFIG_RESAMPLE_S32
 

Functions

static double bessel (double x)
 
static int build_filter (ResampleContext *c)
 
ResampleContextff_audio_resample_init (AVAudioResampleContext *avr)
 Allocate and initialize a ResampleContext.
 
void ff_audio_resample_free (ResampleContext **c)
 Free a ResampleContext.
 
int avresample_set_compensation (AVAudioResampleContext *avr, int sample_delta, int compensation_distance)
 Set compensation for resampling.
 
static int resample (ResampleContext *c, void *dst, const void *src, int *consumed, int src_size, int dst_size, int update_ctx)
 
int ff_audio_resample (ResampleContext *c, AudioData *dst, AudioData *src)
 Resample audio data.
 
int avresample_get_delay (AVAudioResampleContext *avr)
 Return the number of samples currently in the resampling delay buffer.
 

Macro Definition Documentation

#define CONFIG_RESAMPLE_DBL

Definition at line 53 of file resample.c.

#define CONFIG_RESAMPLE_FLT

Definition at line 58 of file resample.c.

#define CONFIG_RESAMPLE_S32

Definition at line 63 of file resample.c.

Function Documentation

static double bessel ( double  x)
static

Definition at line 72 of file resample.c.

Referenced by build_filter(), and ff_kbd_window_init().

static int build_filter ( ResampleContext c)
static

Definition at line 89 of file resample.c.

Referenced by ff_audio_resample_init().

ResampleContext* ff_audio_resample_init ( AVAudioResampleContext avr)

Allocate and initialize a ResampleContext.

The parameters in the AVAudioResampleContext are used to initialize the ResampleContext.

Parameters
avrAVAudioResampleContext
Returns
newly-allocated ResampleContext

Definition at line 145 of file resample.c.

Referenced by avresample_open().

void ff_audio_resample_free ( ResampleContext **  c)

Free a ResampleContext.

Parameters
cResampleContext

Definition at line 237 of file resample.c.

Referenced by avresample_close().

static int resample ( ResampleContext c,
void dst,
const void src,
int *  consumed,
int  src_size,
int  dst_size,
int  update_ctx 
)
static

Definition at line 331 of file resample.c.

Referenced by avfilter_register_all(), and ff_audio_resample().

int ff_audio_resample ( ResampleContext c,
AudioData dst,
AudioData src 
)

Resample audio data.

Changes the sample rate.

All samples in the source data may not be consumed depending on the resampling parameters and the size of the output buffer. The unconsumed samples are automatically added to the start of the source in the next call. If the destination data can be reallocated, that may be done in this function in order to fit all available output. If it cannot be reallocated, fewer input samples will be consumed in order to have the output fit in the destination data buffers.
Parameters
cResampleContext
dstdestination audio data
srcsource audio data
Returns
0 on success, negative AVERROR code on failure

Definition at line 408 of file resample.c.

Referenced by avresample_convert().