FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
resample.c File Reference

samplerate conversion for both audio and video More...

#include <string.h>
#include "avcodec.h"
#include "audioconvert.h"
#include "libavutil/opt.h"
#include "libavutil/mem.h"
#include "libavutil/samplefmt.h"

Go to the source code of this file.

Data Structures

struct  ReSampleContext
 

Macros

#define MAX_CHANNELS   8
 
#define SUPPORT_RESAMPLE(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8)   ch8<<7 | ch7<<6 | ch6<<5 | ch5<<4 | ch4<<3 | ch3<<2 | ch2<<1 | ch1<<0
 

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 surround_to_stereo (short **output, short *input, int channels, int samples)
 
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. More...
 
int audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)
 
void audio_resample_close (ReSampleContext *s)
 Free resample context. More...
 

Variables

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

Detailed Description

samplerate conversion for both audio and video

Definition in file resample.c.

Macro Definition Documentation

#define MAX_CHANNELS   8

Definition at line 38 of file resample.c.

Referenced by audio_resample(), and av_audio_resample_init().

#define SUPPORT_RESAMPLE (   ch1,
  ch2,
  ch3,
  ch4,
  ch5,
  ch6,
  ch7,
  ch8 
)    ch8<<7 | ch7<<6 | ch6<<5 | ch5<<4 | ch4<<3 | ch3<<2 | ch2<<1 | ch1<<0

Definition at line 189 of file resample.c.

Function Documentation

static const char* context_to_name ( void ptr)
static

Definition at line 42 of file resample.c.

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

Definition at line 67 of file resample.c.

Referenced by audio_resample().

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

Definition at line 92 of file resample.c.

Referenced by audio_resample().

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

Definition at line 124 of file resample.c.

Referenced by audio_resample().

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

Definition at line 150 of file resample.c.

Referenced by audio_resample().

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

Definition at line 161 of file resample.c.

Referenced by audio_resample().

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

Definition at line 172 of file resample.c.

Referenced by audio_resample().

Variable Documentation

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

Definition at line 47 of file resample.c.

const AVClass audioresample_context_class
static
Initial value:
= {
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
static const char * context_to_name(void *ptr)
Definition: resample.c:42
static const AVOption options[]
Definition: resample.c:47

Definition at line 48 of file resample.c.

const uint8_t supported_resampling[MAX_CHANNELS]
static
Initial value:
= {
SUPPORT_RESAMPLE(1, 1, 0, 0, 0, 0, 0, 0),
SUPPORT_RESAMPLE(1, 1, 0, 0, 0, 1, 0, 0),
SUPPORT_RESAMPLE(0, 0, 1, 0, 0, 0, 0, 0),
SUPPORT_RESAMPLE(0, 0, 0, 1, 0, 0, 0, 0),
SUPPORT_RESAMPLE(0, 0, 0, 0, 1, 0, 0, 0),
SUPPORT_RESAMPLE(0, 1, 0, 0, 0, 1, 0, 0),
SUPPORT_RESAMPLE(0, 0, 0, 0, 0, 0, 1, 0),
SUPPORT_RESAMPLE(0, 0, 0, 0, 0, 0, 0, 1),
}
#define SUPPORT_RESAMPLE(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8)
Definition: resample.c:189

Definition at line 192 of file resample.c.

Referenced by av_audio_resample_init().