FFmpeg
Loading...
Searching...
No Matches
swresample.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "swresample_internal.h"
#include "audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/internal.h"
#include <float.h>

Go to the source code of this file.

Macros

#define ALIGN   32
#define RSC   1
#define MAX_DROP_STEP   16384
#define MAX_SILENCE_STEP   16384

Functions

int swri_check_chlayout (struct SwrContext *s, const AVChannelLayout *chl, const char *name)
int swr_set_channel_mapping (struct SwrContext *s, const int *channel_map)
 Set a customized input channel mapping.
int swr_alloc_set_opts2 (struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *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.
static void set_audiodata_fmt (AudioData *a, enum AVSampleFormat fmt)
static void free_temp (AudioData *a)
static void clear_context (SwrContext *s)
av_cold void swr_free (SwrContext **ss)
 Free the given SwrContext and set the pointer to NULL.
av_cold void swr_close (SwrContext *s)
 Closes the context so that swr_is_initialized() returns 0.
av_cold int swr_init (struct SwrContext *s)
 Initialize context after user parameters have been set.
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 *const 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.
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_is_initialized (struct SwrContext *s)
 Check whether an swr context has been initialized or not.
int attribute_align_arg swr_convert (struct SwrContext *s, uint8_t *const *out_arg, int out_count, const uint8_t *const *in_arg, int in_count)
 Convert audio.
int swr_drop_output (struct SwrContext *s, int count)
 Drops the specified number of output samples.
int swr_inject_silence (struct SwrContext *s, int count)
 Injects the specified number of silence samples.
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.
int swr_get_out_samples (struct SwrContext *s, int in_samples)
 Find an upper bound on the number of samples that the next swr_convert call will output, if called with in_samples of input samples.
int swr_set_compensation (struct SwrContext *s, int sample_delta, int compensation_distance)
 Activate resampling compensation ("soft" compensation).
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.

Macro Definition Documentation

◆ ALIGN

#define ALIGN   32

Definition at line 31 of file swresample.c.

◆ RSC

#define RSC   1

Referenced by swr_init().

◆ MAX_DROP_STEP

#define MAX_DROP_STEP   16384

Referenced by swr_convert().

◆ MAX_SILENCE_STEP

#define MAX_SILENCE_STEP   16384

Referenced by swr_inject_silence().

Function Documentation

◆ swri_check_chlayout()

int swri_check_chlayout ( struct SwrContext * s,
const AVChannelLayout * chl,
const char * name )

Definition at line 33 of file swresample.c.

Referenced by swr_alloc_set_opts2(), swr_init(), and swr_set_matrix().

◆ set_audiodata_fmt()

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

Definition at line 98 of file swresample.c.

Referenced by swr_init().

◆ free_temp()

void free_temp ( AudioData * a)
static

Definition at line 106 of file swresample.c.

Referenced by clear_context().

◆ clear_context()

void clear_context ( SwrContext * s)
static

Definition at line 111 of file swresample.c.

Referenced by swr_close(), swr_free(), and swr_init().

◆ swri_realloc_audio()

int swri_realloc_audio ( AudioData * a,
int count )

◆ copy()

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

Definition at line 458 of file swresample.c.

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

◆ fill_audiodata()

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

Definition at line 471 of file swresample.c.

Referenced by swr_convert().

◆ reversefill_audiodata()

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

Definition at line 485 of file swresample.c.

Referenced by swr_convert(), and swr_inject_silence().

◆ buf_set()

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

out may be equal in.

Definition at line 499 of file swresample.c.

Referenced by resample(), and swr_convert().

◆ resample()

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 514 of file swresample.c.

Referenced by swr_convert_internal().

◆ swr_convert_internal()

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().