48 #define LICENSE_PREFIX "libswresample license: "
114 memset(a, 0,
sizeof(*a));
121 memset(s->
in.
ch, 0,
sizeof(s->
in.
ch));
156 char l1[1024], l2[1024];
202 av_log(s,
AV_LOG_WARNING,
"Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
252 if (s->
async > 1.0001) {
258 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);
275 #define RSC 1 //FIXME finetune
283 if(!s->
in.ch_count){
305 "but there is not enough information to do it\n", l1, l2);
381 if(a->
count >= count)
414 memcpy(out->
ch[ch], in->
ch[ch], count*out->
bps);
422 memset(out->
ch, 0,
sizeof(out->
ch));
425 out->
ch[i]= in_arg[i];
428 out->
ch[i]= in_arg[0] + i*out->
bps;
436 in_arg[i]= out->
ch[i];
438 in_arg[0]= out->
ch[0];
450 out->
ch[ch]= in->
ch[ch] + count*out->
bps;
452 for(ch=out->
ch_count-1; ch>=0; ch--)
462 const AudioData * in_param,
int in_count){
477 if (border == INT_MAX) {
479 }
else if (border < 0) {
515 in_count -= consumed;
535 copy(&tmp, &in, count);
604 out_count=
FFMIN(out_count, in_count);
606 copy(out, in, out_count);
609 else if(preout==postin) preout= midbuf= postin=
out;
610 else if(preout==midbuf) preout= midbuf=
out;
620 out_count=
resample(s, midbuf, out_count, postin, in_count);
627 out_count=
resample(s, preout, out_count, midbuf, in_count);
630 if(preout != out && out_count){
634 int dither_count=
FFMAX(out_count, 1<<16);
655 int len1= out_count&~15;
656 int off = len1 * preout->
bps;
659 for(ch=0; ch<preout->
ch_count; ch++)
661 if(out_count != len1)
662 for(ch=0; ch<preout->
ch_count; ch++)
665 for(ch=0; ch<preout->
ch_count; ch++)
689 const uint8_t *in_arg [SWR_CH_MAX],
int in_count){
701 #define MAX_DROP_STEP 16384
762 if(in_count > out_count) {
774 size =
FFMIN(in_count, out_count);
784 copy(&tmp, in, in_count);
812 #define MAX_SILENCE_STEP 16384
844 if (!s || compensation_distance < 0)
846 if (!compensation_distance && sample_delta)
885 int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) *
duration ;
886 av_log(s,
AV_LOG_VERBOSE,
"compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);