resample.c File Reference

samplerate conversion for both audio and video More...

#include "avcodec.h"
#include "audioconvert.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"

Go to the source code of this file.

Data Structures

struct  ReSampleContext

Macros

#define MAX_CHANNELS   8

Functions

static const char * context_to_name (void *ptr)
static void stereo_to_mono (short *output, short *input, int n1)
static void mono_to_stereo (short *output, short *input, int n1)
static void deinterleave (short **output, short *input, int channels, int samples)
static void interleave (short *output, short **input, int channels, int samples)
static void ac3_5p1_mux (short *output, short *input1, short *input2, int n)
ReSampleContextav_audio_resample_init (int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff)
 Initialize audio resampling context.
int audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)
void audio_resample_close (ReSampleContext *s)
 Free resample context.

Variables

static const AVOption options [] = {{NULL}}
static const AVClass audioresample_context_class

Detailed Description

samplerate conversion for both audio and video

Definition in file resample.c.

Macro Definition Documentation

#define MAX_CHANNELS   8

Definition at line 32 of file resample.c.

Referenced by audio_resample(), and av_audio_resample_init().

Function Documentation

static void ac3_5p1_mux ( short *  output,
short *  input1,
short *  input2,
int  n 
)
static

Definition at line 133 of file resample.c.

Referenced by audio_resample().

int audio_resample ( ReSampleContext s,
short *  output,
short *  input,
int  nb_samples 
)

Definition at line 228 of file resample.c.

Referenced by do_audio_out().

void audio_resample_close ( ReSampleContext s)

Free resample context.

Parameters
sa non-NULL pointer to a resample context previously created with av_audio_resample_init()

Definition at line 359 of file resample.c.

Referenced by do_audio_out(), and transcode().

ReSampleContext* av_audio_resample_init ( int  output_channels,
int  input_channels,
int  output_rate,
int  input_rate,
enum AVSampleFormat  sample_fmt_out,
enum AVSampleFormat  sample_fmt_in,
int  filter_length,
int  log2_phase_count,
int  linear,
double  cutoff 
)

Initialize audio resampling context.

Parameters
output_channelsnumber of output channels
input_channelsnumber of input channels
output_rateoutput sample rate
input_rateinput sample rate
sample_fmt_outrequested output sample format
sample_fmt_ininput sample format
filter_lengthlength of each FIR filter in the filterbank relative to the cutoff frequency
log2_phase_countlog2 of the number of entries in the polyphase filterbank
linearif 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used
cutoffcutoff frequency, 1.0 corresponds to half the output sampling rate
Returns
allocated ReSampleContext, NULL if error occurred

Definition at line 150 of file resample.c.

Referenced by do_audio_out().

static const char* context_to_name ( void ptr)
static

Definition at line 36 of file resample.c.

static void deinterleave ( short **  output,
short *  input,
int  channels,
int  samples 
)
static

Definition at line 111 of file resample.c.

Referenced by audio_resample().

static void interleave ( short *  output,
short **  input,
int  channels,
int  samples 
)
static

Definition at line 122 of file resample.c.

Referenced by audio_resample().

static void mono_to_stereo ( short *  output,
short *  input,
int  n1 
)
static

Definition at line 86 of file resample.c.

Referenced by audio_resample().

static void stereo_to_mono ( short *  output,
short *  input,
int  n1 
)
static

Definition at line 61 of file resample.c.

Referenced by audio_resample().

Variable Documentation

const AVClass audioresample_context_class
static
Initial value:
{
}

Definition at line 42 of file resample.c.

const AVOption options[] = {{NULL}}
static

Definition at line 41 of file resample.c.