39 return FFMPEG_CONFIGURATION;
44 #define LICENSE_PREFIX "libswresample license: "
110 memset(a, 0,
sizeof(*a));
117 memset(s->
in.
ch, 0,
sizeof(s->
in.
ch));
176 extern struct Resampler const soxr_resampler;
189 av_log(s,
AV_LOG_WARNING,
"Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
193 if(!s-> in_ch_layout)
239 if (s->
async > 1.0001) {
245 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);
257 #define RSC 1 //FIXME finetune
265 if(!s->
in.ch_count){
272 char l1[1024], l2[1024];
276 "but there is not enough information to do it\n", l1, l2);
290 s-> in_sample_fmt, s->
in.ch_count, NULL, 0);
342 if(a->
count >= count)
375 memcpy(out->
ch[ch], in->
ch[ch], count*out->
bps);
383 memset(out->
ch, 0,
sizeof(out->
ch));
386 out->
ch[i]= in_arg[i];
389 out->
ch[i]= in_arg[0] + i*out->
bps;
397 in_arg[i]= out->
ch[i];
399 in_arg[0]= out->
ch[0];
411 out->
ch[ch]= in->
ch[ch] + count*out->
bps;
413 for(ch=out->
ch_count-1; ch>=0; ch--)
423 const AudioData * in_param,
int in_count){
438 if (border == INT_MAX)
return 0;
439 else if (border < 0)
return border;
470 in_count -= consumed;
490 copy(&tmp, &in, count);
559 out_count=
FFMIN(out_count, in_count);
561 copy(out, in, out_count);
564 else if(preout==postin) preout= midbuf= postin=
out;
565 else if(preout==midbuf) preout= midbuf=
out;
575 out_count=
resample(s, midbuf, out_count, postin, in_count);
582 out_count=
resample(s, preout, out_count, midbuf, in_count);
585 if(preout != out && out_count){
589 int dither_count=
FFMAX(out_count, 1<<16);
609 int len1= out_count&~15;
610 int off = len1 * preout->
bps;
613 for(ch=0; ch<preout->
ch_count; ch++)
615 if(out_count != len1)
616 for(ch=0; ch<preout->
ch_count; ch++)
619 for(ch=0; ch<preout->
ch_count; ch++)
643 const uint8_t *in_arg [SWR_CH_MAX],
int in_count){
655 #define MAX_DROP_STEP 16384
714 if(in_count > out_count) {
726 size =
FFMIN(in_count, out_count);
736 copy(&tmp, in, in_count);
763 #define MAX_SILENCE_STEP 16384
795 if (!s || compensation_distance < 0)
797 if (!compensation_distance && sample_delta)
836 int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) *
duration ;
837 av_log(s,
AV_LOG_VERBOSE,
"compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);