31 #include "libavutil/ffversion.h"
42 return FFMPEG_CONFIGURATION;
47 #define LICENSE_PREFIX "libswresample license: "
113 memset(a, 0,
sizeof(*a));
120 memset(s->
in.
ch, 0,
sizeof(s->
in.
ch));
191 av_log(s,
AV_LOG_WARNING,
"Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
241 if (s->
async > 1.0001) {
247 s->
resample = s->
resampler->
init(s->
resample, s->
out_sample_rate, s->
in_sample_rate, s->
filter_size, s->
phase_shift, s->
linear_interp, s->
cutoff, s->
int_sample_fmt, s->
filter_type, s->
kaiser_beta, s->
precision, s->
cheby);
259 #define RSC 1 //FIXME finetune
267 if(!s->
in.ch_count){
274 char l1[1024], l2[1024];
278 "but there is not enough information to do it\n", l1, l2);
344 if(a->
count >= count)
377 memcpy(out->
ch[ch], in->
ch[ch], count*out->
bps);
385 memset(out->
ch, 0,
sizeof(out->
ch));
388 out->
ch[i]= in_arg[i];
391 out->
ch[i]= in_arg[0] + i*out->
bps;
399 in_arg[i]= out->
ch[i];
401 in_arg[0]= out->
ch[0];
413 out->
ch[ch]= in->
ch[ch] + count*out->
bps;
415 for(ch=out->
ch_count-1; ch>=0; ch--)
425 const AudioData * in_param,
int in_count){
440 if (border == INT_MAX) {
442 }
else if (border < 0) {
478 in_count -= consumed;
498 copy(&tmp, &in, count);
567 out_count=
FFMIN(out_count, in_count);
569 copy(out, in, out_count);
572 else if(preout==postin) preout= midbuf= postin=
out;
573 else if(preout==midbuf) preout= midbuf=
out;
583 out_count=
resample(s, midbuf, out_count, postin, in_count);
590 out_count=
resample(s, preout, out_count, midbuf, in_count);
593 if(preout != out && out_count){
597 int dither_count=
FFMAX(out_count, 1<<16);
617 int len1= out_count&~15;
618 int off = len1 * preout->
bps;
621 for(ch=0; ch<preout->
ch_count; ch++)
623 if(out_count != len1)
624 for(ch=0; ch<preout->
ch_count; ch++)
627 for(ch=0; ch<preout->
ch_count; ch++)
651 const uint8_t *in_arg [SWR_CH_MAX],
int in_count){
663 #define MAX_DROP_STEP 16384
724 if(in_count > out_count) {
736 size =
FFMIN(in_count, out_count);
746 copy(&tmp, in, in_count);
774 #define MAX_SILENCE_STEP 16384
806 if (!s || compensation_distance < 0)
808 if (!compensation_distance && sample_delta)
847 int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) *
duration ;
848 av_log(s,
AV_LOG_VERBOSE,
"compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);