libavresample/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  ResampleContext

Defines

#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, int *consumed)
 Resample audio data.
int avresample_get_delay (AVAudioResampleContext *avr)
 Return the number of samples currently in the resampling delay buffer.


Define 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

int avresample_get_delay ( AVAudioResampleContext avr  ) 

Return the number of samples currently in the resampling delay buffer.

When resampling, there may be a delay between the input and output. Any unconverted samples in each call are stored internally in a delay buffer. This function allows the user to determine the current number of samples in the delay buffer, which can be useful for synchronization.

See also:
avresample_convert()
Parameters:
avr audio resample context
Returns:
number of samples currently in the resampling delay buffer

Definition at line 452 of file resample.c.

Referenced by filter_samples(), get_delay(), main(), and request_frame().

int avresample_set_compensation ( AVAudioResampleContext avr,
int  sample_delta,
int  compensation_distance 
)

Set compensation for resampling.

This can be called anytime after avresample_open(). If resampling was not being done previously, the AVAudioResampleContext is closed and reopened with resampling enabled. In this case, any samples remaining in the output FIFO and the current channel mixing matrix will be restored after reopening the context.

Parameters:
avr audio resample context
sample_delta compensation delta, in samples
compensation_distance compensation distance, in samples
Returns:
0 on success, negative AVERROR code on failure

Definition at line 246 of file resample.c.

Referenced by filter_samples().

static double bessel ( double  x  )  [static]

Definition at line 72 of file resample.c.

static int build_filter ( ResampleContext c  )  [static]

Definition at line 89 of file resample.c.

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

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:
c ResampleContext
dst destination audio data
src source audio data
consumed number of samples consumed from the source
Returns:
number of samples written to the destination

Definition at line 397 of file resample.c.

Referenced by avresample_convert().

void ff_audio_resample_free ( ResampleContext **  c  ) 

Free a ResampleContext.

Parameters:
c ResampleContext

Definition at line 237 of file resample.c.

Referenced by avresample_close().

ResampleContext* ff_audio_resample_init ( AVAudioResampleContext avr  ) 

Allocate and initialize a ResampleContext.

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

Parameters:
avr AVAudioResampleContext
Returns:
newly-allocated ResampleContext

Definition at line 145 of file resample.c.

Referenced by avresample_open().

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 320 of file resample.c.

Referenced by avfilter_register_all(), ff_audio_resample(), and swr_convert_internal().


Generated on Fri Oct 26 02:50:07 2012 for FFmpeg by  doxygen 1.5.8