FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Audio resampling
Encoding/Decoding Library

Functions

attribute_deprecated
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.
 
attribute_deprecated int audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)
 
attribute_deprecated void audio_resample_close (ReSampleContext *s)
 Free resample context.
 
attribute_deprecated struct
AVResampleContext
av_resample_init (int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff)
 Initialize an audio resampler.
 
attribute_deprecated int av_resample (struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx)
 Resample an array of samples using a previously configured context.
 
attribute_deprecated void av_resample_compensate (struct AVResampleContext *c, int sample_delta, int compensation_distance)
 Compensate samplerate/timestamp drift.
 
attribute_deprecated void av_resample_close (struct AVResampleContext *c)
 

Detailed Description

Deprecated:
use libswresample instead

Function Documentation

attribute_deprecated 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 203 of file resample.c.

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

Definition at line 284 of file resample.c.

attribute_deprecated 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 422 of file resample.c.

attribute_deprecated struct AVResampleContext* av_resample_init ( int  out_rate,
int  in_rate,
int  filter_length,
int  log2_phase_count,
int  linear,
double  cutoff 
)
read

Initialize an audio resampler.

Note, if either rate is not an integer then simply scale both rates up so they are.

Parameters
filter_lengthlength of each FIR filter in the filterbank relative to the cutoff freq
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

Definition at line 192 of file resample2.c.

Referenced by av_audio_resample_init().

attribute_deprecated int av_resample ( struct AVResampleContext c,
short *  dst,
short *  src,
int *  consumed,
int  src_size,
int  dst_size,
int  update_ctx 
)

Resample an array of samples using a previously configured context.

Parameters
srcan array of unconsumed samples
consumedthe number of samples of src which have been consumed are returned here
src_sizethe number of unconsumed samples available
dst_sizethe amount of space in samples available in dst
update_ctxIf this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
Returns
the number of samples written in dst or -1 if an error occurred

Definition at line 237 of file resample2.c.

Referenced by audio_resample().

attribute_deprecated void av_resample_compensate ( struct AVResampleContext c,
int  sample_delta,
int  compensation_distance 
)

Compensate samplerate/timestamp drift.

The compensation is done by changing the resampler parameters, so no audible clicks or similar distortions occur

Parameters
compensation_distancedistance in output samples over which the compensation should be performed
sample_deltanumber of output samples which should be output less

example: av_resample_compensate(c, 10, 500) here instead of 510 samples only 500 samples would be output

note, due to rounding the actual compensation might be slightly different, especially if the compensation_distance is large and the in_rate used during init is small

Definition at line 231 of file resample2.c.

attribute_deprecated void av_resample_close ( struct AVResampleContext c)

Definition at line 226 of file resample2.c.

Referenced by audio_resample_close().