swresample.c File Reference
#include "libavutil/opt.h"
#include "swresample_internal.h"
#include "audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include <float.h>
Include dependency graph for swresample.c:

Go to the source code of this file.

Macros

#define C30DB   M_SQRT2
 
#define C15DB   1.189207115
 
#define C__0DB   1.0
 
#define C_15DB   0.840896415
 
#define C_30DB   M_SQRT1_2
 
#define C_45DB   0.594603558
 
#define C_60DB   0.5
 
#define ALIGN   32
 
#define OFFSET(x)   offsetof(SwrContext,x)
 
#define PARAM   AV_OPT_FLAG_AUDIO_PARAM
 
#define LICENSE_PREFIX   "libswresample license: "
 
#define RSC   1
 
#define MAX_DROP_STEP   16384
 
#define MAX_SILENCE_STEP   16384
 

Functions

static const char * context_to_name (void *ptr)
 
unsigned swresample_version (void)
 Return the LIBSWRESAMPLE_VERSION_INT constant. More...
 
const char * swresample_configuration (void)
 Return the swr build-time configuration. More...
 
const char * swresample_license (void)
 Return the swr license. More...
 
int swr_set_channel_mapping (struct SwrContext *s, const int *channel_map)
 Set a customized input channel mapping. More...
 
const AVClassswr_get_class (void)
 Get the AVClass for swrContext. More...
 
av_cold struct SwrContextswr_alloc (void)
 Allocate SwrContext. More...
 
struct SwrContextswr_alloc_set_opts (struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
 Allocate SwrContext if needed and set/reset common parameters. More...
 
static void set_audiodata_fmt (AudioData *a, enum AVSampleFormat fmt)
 
static void free_temp (AudioData *a)
 
av_cold void swr_free (SwrContext **ss)
 Free the given SwrContext and set the pointer to NULL. More...
 
av_cold int swr_init (struct SwrContext *s)
 Initialize context after user parameters have been set. More...
 
int swri_realloc_audio (AudioData *a, int count)
 
static void copy (AudioData *out, AudioData *in, int count)
 
static void fill_audiodata (AudioData *out, uint8_t *in_arg[SWR_CH_MAX])
 
static void reversefill_audiodata (AudioData *out, uint8_t *in_arg[SWR_CH_MAX])
 
static void buf_set (AudioData *out, AudioData *in, int count)
 out may be equal in. More...
 
static int resample (SwrContext *s, AudioData *out_param, int out_count, const AudioData *in_param, int in_count)
 
static int swr_convert_internal (struct SwrContext *s, AudioData *out, int out_count, AudioData *in, int in_count)
 
int swr_convert (struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg[SWR_CH_MAX], int in_count)
 
int swr_drop_output (struct SwrContext *s, int count)
 Drops the specified number of output samples. More...
 
int swr_inject_silence (struct SwrContext *s, int count)
 Injects the specified number of silence samples. More...
 
int64_t swr_get_delay (struct SwrContext *s, int64_t base)
 Gets the delay the next input sample will experience relative to the next output sample. More...
 
int swr_set_compensation (struct SwrContext *s, int sample_delta, int compensation_distance)
 Activate resampling compensation. More...
 
int64_t swr_next_pts (struct SwrContext *s, int64_t pts)
 Convert the next timestamp from input to output timestamps are in 1/(in_sample_rate * out_sample_rate) units. More...
 

Variables

static const AVOption options []
 
static const AVClass av_class
 

Macro Definition Documentation

#define ALIGN   32

Definition at line 37 of file swresample.c.

Referenced by swri_realloc_audio().

#define C15DB   1.189207115

Definition at line 30 of file swresample.c.

#define C30DB   M_SQRT2

Definition at line 29 of file swresample.c.

#define C_15DB   0.840896415

Definition at line 32 of file swresample.c.

#define C_30DB   M_SQRT1_2

Definition at line 33 of file swresample.c.

#define C_45DB   0.594603558

Definition at line 34 of file swresample.c.

#define C_60DB   0.5

Definition at line 35 of file swresample.c.

#define C__0DB   1.0

Definition at line 31 of file swresample.c.

#define LICENSE_PREFIX   "libswresample license: "

Referenced by swresample_license().

#define MAX_DROP_STEP   16384

Referenced by swr_convert().

#define MAX_SILENCE_STEP   16384

Referenced by swr_inject_silence().

#define OFFSET (   x)    offsetof(SwrContext,x)

Definition at line 40 of file swresample.c.

#define PARAM   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 41 of file swresample.c.

#define RSC   1

Referenced by swr_init().

Function Documentation

static void buf_set ( AudioData out,
AudioData in,
int  count 
)
static

out may be equal in.

Definition at line 516 of file swresample.c.

Referenced by resample(), and swr_convert().

static const char* context_to_name ( void ptr)
static

Definition at line 134 of file swresample.c.

static void copy ( AudioData out,
AudioData in,
int  count 
)
static

Definition at line 476 of file swresample.c.

Referenced by resample(), swr_convert(), and swr_convert_internal().

static void fill_audiodata ( AudioData out,
uint8_t in_arg[SWR_CH_MAX] 
)
static

Definition at line 489 of file swresample.c.

Referenced by swr_convert().

static void free_temp ( AudioData a)
static

Definition at line 215 of file swresample.c.

Referenced by swr_free(), and swr_init().

static int resample ( SwrContext s,
AudioData out_param,
int  out_count,
const AudioData in_param,
int  in_count 
)
static
Returns
number of samples output per channel

Definition at line 531 of file swresample.c.

Referenced by swr_convert_internal().

static void reversefill_audiodata ( AudioData out,
uint8_t in_arg[SWR_CH_MAX] 
)
static

Definition at line 502 of file swresample.c.

Referenced by swr_convert(), and swr_inject_silence().

static void set_audiodata_fmt ( AudioData a,
enum AVSampleFormat  fmt 
)
static

Definition at line 209 of file swresample.c.

Referenced by swr_init().

int swr_convert ( struct SwrContext s,
uint8_t out_arg[SWR_CH_MAX],
int  out_count,
const uint8_t in_arg[SWR_CH_MAX],
int  in_count 
)
static int swr_convert_internal ( struct SwrContext s,
AudioData out,
int  out_count,
AudioData in,
int  in_count 
)
static

Definition at line 609 of file swresample.c.

Referenced by swr_convert().

int swri_realloc_audio ( AudioData a,
int  count 
)

Variable Documentation

const AVClass av_class
static
Initial value:
= {
.class_name = "SWResampler",
.item_name = context_to_name,
.option = options,
.log_level_offset_offset = OFFSET(log_level_offset),
.parent_log_context_offset = OFFSET(log_ctx),
}
static const char * context_to_name(void *ptr)
Definition: swresample.c:134
#define OFFSET(x)
Definition: swresample.c:40
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static const AVOption options[]
Definition: swresample.c:43

Definition at line 138 of file swresample.c.

Referenced by amr_decode_fix_avctx(), swr_alloc(), and swr_get_class().

const AVOption options[]
static

Definition at line 43 of file swresample.c.