39 return FFMPEG_CONFIGURATION;
44 #define LICENSE_PREFIX "libswresample license: "
86 memset(a, 0,
sizeof(*a));
93 memset(s->
in.
ch, 0,
sizeof(s->
in.
ch));
152 extern struct Resampler const soxr_resampler;
165 av_log(s,
AV_LOG_WARNING,
"Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
169 if(!s-> in_ch_layout)
215 if (s->
async > 1.0001) {
221 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);
233 #define RSC 1 //FIXME finetune
241 if(!s->
in.ch_count){
248 char l1[1024], l2[1024];
252 "but there is not enough information to do it\n", l1, l2);
266 s-> in_sample_fmt, s->
in.ch_count, NULL, 0);
318 if(a->
count >= count)
351 memcpy(out->
ch[ch], in->
ch[ch], count*out->
bps);
359 memset(out->
ch, 0,
sizeof(out->
ch));
362 out->
ch[i]= in_arg[i];
365 out->
ch[i]= in_arg[0] + i*out->
bps;
373 in_arg[i]= out->
ch[i];
375 in_arg[0]= out->
ch[0];
387 out->
ch[ch]= in->
ch[ch] + count*out->
bps;
389 for(ch=out->
ch_count-1; ch>=0; ch--)
399 const AudioData * in_param,
int in_count){
414 if (border == INT_MAX)
return 0;
415 else if (border < 0)
return border;
446 in_count -= consumed;
466 copy(&tmp, &in, count);
535 out_count=
FFMIN(out_count, in_count);
537 copy(out, in, out_count);
540 else if(preout==postin) preout= midbuf= postin=
out;
541 else if(preout==midbuf) preout= midbuf=
out;
551 out_count=
resample(s, midbuf, out_count, postin, in_count);
558 out_count=
resample(s, preout, out_count, midbuf, in_count);
561 if(preout != out && out_count){
565 int dither_count=
FFMAX(out_count, 1<<16);
585 int len1= out_count&~15;
586 int off = len1 * preout->
bps;
589 for(ch=0; ch<preout->
ch_count; ch++)
591 if(out_count != len1)
592 for(ch=0; ch<preout->
ch_count; ch++)
595 for(ch=0; ch<preout->
ch_count; ch++)
619 const uint8_t *in_arg [SWR_CH_MAX],
int in_count){
631 #define MAX_DROP_STEP 16384
690 if(in_count > out_count) {
702 size =
FFMIN(in_count, out_count);
712 copy(&tmp, in, in_count);
739 #define MAX_SILENCE_STEP 16384
771 if (!s || compensation_distance < 0)
773 if (!compensation_distance && sample_delta)
812 int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) *
duration ;
813 av_log(s,
AV_LOG_VERBOSE,
"compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);