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) {
440 }
else if (border < 0) {
476 in_count -= consumed;
496 copy(&tmp, &in, count);
565 out_count=
FFMIN(out_count, in_count);
567 copy(out, in, out_count);
570 else if(preout==postin) preout= midbuf= postin=
out;
571 else if(preout==midbuf) preout= midbuf=
out;
581 out_count=
resample(s, midbuf, out_count, postin, in_count);
588 out_count=
resample(s, preout, out_count, midbuf, in_count);
591 if(preout != out && out_count){
595 int dither_count=
FFMAX(out_count, 1<<16);
615 int len1= out_count&~15;
616 int off = len1 * preout->
bps;
619 for(ch=0; ch<preout->
ch_count; ch++)
621 if(out_count != len1)
622 for(ch=0; ch<preout->
ch_count; ch++)
625 for(ch=0; ch<preout->
ch_count; ch++)
649 const uint8_t *in_arg [SWR_CH_MAX],
int in_count){
661 #define MAX_DROP_STEP 16384
722 if(in_count > out_count) {
734 size =
FFMIN(in_count, out_count);
744 copy(&tmp, in, in_count);
772 #define MAX_SILENCE_STEP 16384
804 if (!s || compensation_distance < 0)
806 if (!compensation_distance && sample_delta)
845 int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) *
duration ;
846 av_log(s,
AV_LOG_VERBOSE,
"compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);