FFmpeg
Loading...
Searching...
No Matches
Data Fields
SwrContext Struct Reference

The libswresample context. More...

#include <swresample_internal.h>

Data Fields

const AVClassav_class
  AVClass used for AVOption and av_log()
 
  logging level offset
 
void *  log_ctx
  parent logging context
 
  input sample format
 
  internal sample format (AV_SAMPLE_FMT_FLTP or AV_SAMPLE_FMT_S16P)
 
  output sample format
 
  number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
 
  input channel layout
 
  output channel layout
 
  input sample rate
 
  output sample rate
 
int  flags
  miscellaneous flags such as SWR_FLAG_RESAMPLE
 
  surround mixing level
 
  center mixing level
 
  LFE mixing level.
 
  rematrixing volume coefficient
 
  maximum value for rematrixing output
 
  matrixed stereo encoding
 
const int *  channel_map
  channel index (or -1 if muted channel) map
 
int  engine
 
  User set used channel layout.
 
  User set input channel layout.
 
  User set output channel layout.
 
  User set internal sample format.
 
  User set dither method.
 
 
int  filter_size
  length of each FIR filter in the resampling filterbank relative to the cutoff frequency
 
int  phase_shift
  log2 of the number of entries in the resampling polyphase filterbank
 
  if 1 then the resampling FIR filter will be linearly interpolated
 
  if 1 then enable non power of 2 phase_count
 
  resampling cutoff frequency (swr: 6dB point; soxr: 0dB point).
 
int  filter_type
  swr resampling filter type
 
  swr beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER)
 
  soxr resampling precision (in bits)
 
int  cheby
  soxr: if 1 then passband rolloff will be none (Chebyshev) & irrational ratio approximation precision will be higher
 
  swr minimum below which no compensation will happen
 
  swr minimum below which no silence inject / sample drop will happen
 
  swr duration over which soft compensation is applied
 
  swr maximum soft compensation in seconds over soft_compensation_duration
 
  swr simple 1 parameter async, similar to ffmpegs -async
 
  swr first pts in samples
 
  1 if resampling must come first, 0 if rematrixing
 
int  rematrix
  flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)
 
  flag to indicate that a custom matrix has been defined
 
  input audio data
 
  post-input audio data: used for rematrix/resample
 
  intermediate audio data (postin/preout)
 
  pre-output audio data: used for rematrix/resample
 
  converted output audio data
 
  cached audio data (convert and resample purpose)
 
  temporary with silence
 
  temporary used to discard output
 
  cached buffer position
 
  cached buffer length
 
  1 if the input end was reach before the output end, 0 otherwise
 
int  flushed
  1 if data is to be flushed and no further input is expected
 
  output PTS
 
  first PTS
 
int  drop_output
  number of output samples to drop
 
  soxr 0.1.1: needed to fixup delayed_samples after flush has been called.
 
  input conversion context
 
  output conversion context
 
  full conversion context (single conversion for input and output)
 
  resampling context
 
struct Resampler const *  resampler
  resampler virtual function table
 
  floating point rematrixing coefficients
 
union { 
 
  single precision floating point rematrixing coefficients valid iff int_sample_fmt is AV_SAMPLE_FMT_FLTP More...
 
  17.15 fixed point rematrixing coefficients valid iff int_sample_fmt is != AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP More...
 
};   
 
union { 
 
   int   i 
 
   float   f 
 
   double   d 
 
native_one 
 
uint8_t *  native_matrix
 
union { 
 
   int16_t   i16 [2] 
 
   float   f 
 
 
uint8_t *  native_simd_matrix
 
  Lists of input channels per output channel that have non zero rematrixing coefficients.
 
 
 
 
 
 

Detailed Description

The libswresample context.

Unlike libavcodec and libavformat, this structure is opaque. This means that if you would like to set options, you must use the AVOptions API and cannot directly set values to members of the structure.

Examples
mux.c, resample_audio.c, and transcode_aac.c.

Definition at line 97 of file swresample_internal.h.

Field Documentation

◆  av_class

const AVClass* SwrContext::av_class

AVClass used for AVOption and av_log()

Definition at line 98 of file swresample_internal.h.

◆  log_level_offset

int SwrContext::log_level_offset

logging level offset

Definition at line 99 of file swresample_internal.h.

◆  log_ctx

void* SwrContext::log_ctx

parent logging context

Definition at line 100 of file swresample_internal.h.

Referenced by swr_alloc_set_opts2().

◆  in_sample_fmt

enum AVSampleFormat SwrContext::in_sample_fmt

input sample format

Definition at line 101 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), swr_alloc_set_opts2(), swr_convert_internal(), and swr_init().

◆  int_sample_fmt

enum AVSampleFormat SwrContext::int_sample_fmt

internal sample format (AV_SAMPLE_FMT_FLTP or AV_SAMPLE_FMT_S16P)

Definition at line 102 of file swresample_internal.h.

◆  out_sample_fmt

enum AVSampleFormat SwrContext::out_sample_fmt

output sample format

Definition at line 103 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), and swr_alloc_set_opts2().

◆  used_ch_layout

AVChannelLayout SwrContext::used_ch_layout

number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)

Definition at line 104 of file swresample_internal.h.

◆  in_ch_layout

AVChannelLayout SwrContext::in_ch_layout

input channel layout

Definition at line 105 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), swr_alloc_set_opts2(), and swr_init().

◆  out_ch_layout

AVChannelLayout SwrContext::out_ch_layout

output channel layout

Definition at line 106 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), and swr_alloc_set_opts2().

◆  in_sample_rate

int SwrContext::in_sample_rate

input sample rate

Definition at line 107 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), swr_alloc_set_opts2(), swr_init(), and swr_next_pts().

◆  out_sample_rate

int SwrContext::out_sample_rate

output sample rate

Definition at line 108 of file swresample_internal.h.

Referenced by LLVMFuzzerTestOneInput(), main(), and swr_alloc_set_opts2().

◆  flags

int SwrContext::flags

miscellaneous flags such as SWR_FLAG_RESAMPLE

Definition at line 109 of file swresample_internal.h.

◆  slev

float SwrContext::slev

surround mixing level

Definition at line 110 of file swresample_internal.h.

◆  clev

float SwrContext::clev

center mixing level

Definition at line 111 of file swresample_internal.h.

◆  lfe_mix_level

float SwrContext::lfe_mix_level

LFE mixing level.

Definition at line 112 of file swresample_internal.h.

◆  rematrix_volume

float SwrContext::rematrix_volume

rematrixing volume coefficient

Definition at line 113 of file swresample_internal.h.

◆  rematrix_maxval

float SwrContext::rematrix_maxval

maximum value for rematrixing output

Definition at line 114 of file swresample_internal.h.

◆  matrix_encoding

int SwrContext::matrix_encoding

matrixed stereo encoding

Definition at line 115 of file swresample_internal.h.

Referenced by config_output().

◆  channel_map

const int* SwrContext::channel_map

channel index (or -1 if muted channel) map

Definition at line 116 of file swresample_internal.h.

◆  engine

int SwrContext::engine

Definition at line 117 of file swresample_internal.h.

◆  user_used_chlayout

AVChannelLayout SwrContext::user_used_chlayout

User set used channel layout.

Definition at line 119 of file swresample_internal.h.

◆  user_in_chlayout

AVChannelLayout SwrContext::user_in_chlayout

User set input channel layout.

Definition at line 120 of file swresample_internal.h.

Referenced by swr_init().

◆  user_out_chlayout

AVChannelLayout SwrContext::user_out_chlayout

User set output channel layout.

Definition at line 121 of file swresample_internal.h.

Referenced by swr_init().

◆  user_int_sample_fmt

enum AVSampleFormat SwrContext::user_int_sample_fmt

User set internal sample format.

Definition at line 122 of file swresample_internal.h.

◆  user_dither_method

int SwrContext::user_dither_method

User set dither method.

Definition at line 123 of file swresample_internal.h.

◆  dither

struct DitherContext SwrContext::dither

Definition at line 125 of file swresample_internal.h.

◆  filter_size

int SwrContext::filter_size

length of each FIR filter in the resampling filterbank relative to the cutoff frequency

Definition at line 127 of file swresample_internal.h.

◆  phase_shift

int SwrContext::phase_shift

log2 of the number of entries in the resampling polyphase filterbank

Definition at line 128 of file swresample_internal.h.

◆  linear_interp

int SwrContext::linear_interp

if 1 then the resampling FIR filter will be linearly interpolated

Definition at line 129 of file swresample_internal.h.

◆  exact_rational

int SwrContext::exact_rational

if 1 then enable non power of 2 phase_count

Definition at line 130 of file swresample_internal.h.

◆  cutoff

double SwrContext::cutoff

resampling cutoff frequency (swr: 6dB point; soxr: 0dB point).

1.0 corresponds to half the output sample rate

Definition at line 131 of file swresample_internal.h.

◆  filter_type

int SwrContext::filter_type

swr resampling filter type

Definition at line 132 of file swresample_internal.h.

◆  kaiser_beta

double SwrContext::kaiser_beta

swr beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER)

Definition at line 133 of file swresample_internal.h.

◆  precision

double SwrContext::precision

soxr resampling precision (in bits)

Definition at line 134 of file swresample_internal.h.

◆  cheby

int SwrContext::cheby

soxr: if 1 then passband rolloff will be none (Chebyshev) & irrational ratio approximation precision will be higher

Definition at line 135 of file swresample_internal.h.

◆  min_compensation

float SwrContext::min_compensation

swr minimum below which no compensation will happen

Definition at line 137 of file swresample_internal.h.

◆  min_hard_compensation

float SwrContext::min_hard_compensation

swr minimum below which no silence inject / sample drop will happen

Definition at line 138 of file swresample_internal.h.

◆  soft_compensation_duration

float SwrContext::soft_compensation_duration

swr duration over which soft compensation is applied

Definition at line 139 of file swresample_internal.h.

◆  max_soft_compensation

float SwrContext::max_soft_compensation

swr maximum soft compensation in seconds over soft_compensation_duration

Definition at line 140 of file swresample_internal.h.

Referenced by swr_next_pts().

◆  async

float SwrContext::async

swr simple 1 parameter async, similar to ffmpegs -async

Definition at line 141 of file swresample_internal.h.

◆  firstpts_in_samples

int64_t SwrContext::firstpts_in_samples

swr first pts in samples

Definition at line 142 of file swresample_internal.h.

◆  resample_first

int SwrContext::resample_first

1 if resampling must come first, 0 if rematrixing

Definition at line 144 of file swresample_internal.h.

◆  rematrix

int SwrContext::rematrix

flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)

Definition at line 145 of file swresample_internal.h.

◆  rematrix_custom

int SwrContext::rematrix_custom

flag to indicate that a custom matrix has been defined

Definition at line 146 of file swresample_internal.h.

◆  in

AudioData SwrContext::in

input audio data

Definition at line 148 of file swresample_internal.h.

Referenced by buf_set(), copy(), resample(), swr_convert(), swr_convert_internal(), and swr_init().

◆  postin

AudioData SwrContext::postin

post-input audio data: used for rematrix/resample

Definition at line 149 of file swresample_internal.h.

Referenced by swr_convert_internal().

◆  midbuf

AudioData SwrContext::midbuf

intermediate audio data (postin/preout)

Definition at line 150 of file swresample_internal.h.

Referenced by swr_convert_internal().

◆  preout

AudioData SwrContext::preout

pre-output audio data: used for rematrix/resample

Definition at line 151 of file swresample_internal.h.

Referenced by swr_convert_internal().

◆  out

AudioData SwrContext::out

converted output audio data

Definition at line 152 of file swresample_internal.h.

◆  in_buffer

AudioData SwrContext::in_buffer

cached audio data (convert and resample purpose)

Definition at line 153 of file swresample_internal.h.

◆  silence

AudioData SwrContext::silence

temporary with silence

Definition at line 154 of file swresample_internal.h.

◆  drop_temp

AudioData SwrContext::drop_temp

temporary used to discard output

Definition at line 155 of file swresample_internal.h.

◆  in_buffer_index

int SwrContext::in_buffer_index

cached buffer position

Definition at line 156 of file swresample_internal.h.

Referenced by resample(), and swr_convert().

◆  in_buffer_count

int SwrContext::in_buffer_count

cached buffer length

Definition at line 157 of file swresample_internal.h.

◆  resample_in_constraint

int SwrContext::resample_in_constraint

1 if the input end was reach before the output end, 0 otherwise

Definition at line 158 of file swresample_internal.h.

◆  flushed

int SwrContext::flushed

1 if data is to be flushed and no further input is expected

Definition at line 159 of file swresample_internal.h.

◆  outpts

int64_t SwrContext::outpts

output PTS

Definition at line 160 of file swresample_internal.h.

Referenced by filter_frame().

◆  firstpts

int64_t SwrContext::firstpts

first PTS

Definition at line 161 of file swresample_internal.h.

◆  drop_output

int SwrContext::drop_output

number of output samples to drop

Definition at line 162 of file swresample_internal.h.

◆  delayed_samples_fixup

double SwrContext::delayed_samples_fixup

soxr 0.1.1: needed to fixup delayed_samples after flush has been called.

Definition at line 163 of file swresample_internal.h.

◆  in_convert

struct AudioConvert* SwrContext::in_convert

input conversion context

Definition at line 165 of file swresample_internal.h.

Referenced by clear_context().

◆  out_convert

struct AudioConvert* SwrContext::out_convert

output conversion context

Definition at line 166 of file swresample_internal.h.

◆  full_convert

struct AudioConvert* SwrContext::full_convert

full conversion context (single conversion for input and output)

Definition at line 167 of file swresample_internal.h.

◆  resample

struct ResampleContext* SwrContext::resample

resampling context

Definition at line 168 of file swresample_internal.h.

◆  resampler

struct Resampler const* SwrContext::resampler

resampler virtual function table

Definition at line 169 of file swresample_internal.h.

◆  matrix

double SwrContext::matrix[SWR_CH_MAX][SWR_CH_MAX]

floating point rematrixing coefficients

Definition at line 171 of file swresample_internal.h.

◆  matrix_flt

float SwrContext::matrix_flt[SWR_CH_MAX][SWR_CH_MAX]

single precision floating point rematrixing coefficients valid iff int_sample_fmt is AV_SAMPLE_FMT_FLTP

Definition at line 173 of file swresample_internal.h.

◆  matrix32

int32_t SwrContext::matrix32[SWR_CH_MAX][SWR_CH_MAX]

17.15 fixed point rematrixing coefficients valid iff int_sample_fmt is != AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP

Definition at line 175 of file swresample_internal.h.

◆  [union]

union { ... } SwrContext

◆  i

int SwrContext::i

Definition at line 179 of file swresample_internal.h.

◆  f

float SwrContext::f

Definition at line 180 of file swresample_internal.h.

◆  d

double SwrContext::d

Definition at line 181 of file swresample_internal.h.

◆  [union]

union { ... } SwrContext::native_one

◆  native_matrix

uint8_t* SwrContext::native_matrix

Definition at line 183 of file swresample_internal.h.

◆  i16

int16_t SwrContext::i16[2]

Definition at line 185 of file swresample_internal.h.

◆  [union]

union { ... } SwrContext::native_simd_one

◆  native_simd_matrix

uint8_t* SwrContext::native_simd_matrix

Definition at line 188 of file swresample_internal.h.

◆  matrix_ch

uint8_t SwrContext::matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1]

Lists of input channels per output channel that have non zero rematrixing coefficients.

Definition at line 189 of file swresample_internal.h.

◆  mix_1_1_f

mix_1_1_func_type* SwrContext::mix_1_1_f

Definition at line 190 of file swresample_internal.h.

◆  mix_1_1_simd

mix_1_1_func_type* SwrContext::mix_1_1_simd

Definition at line 191 of file swresample_internal.h.

◆  mix_2_1_f

mix_2_1_func_type* SwrContext::mix_2_1_f

Definition at line 193 of file swresample_internal.h.

◆  mix_2_1_simd

mix_2_1_func_type* SwrContext::mix_2_1_simd

Definition at line 194 of file swresample_internal.h.

◆  mix_any_f

mix_any_func_type* SwrContext::mix_any_f

Definition at line 196 of file swresample_internal.h.


The documentation for this struct was generated from the following file:

Generated on Sun Sep 6 2026 19:21:28 for FFmpeg by doxygen 1.13.2

AltStyle によって変換されたページ (->オリジナル) /