diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2011-09-17 01:30:15 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2011-10-16 00:52:23 +0200 |
commit | 22137bb5c25364a2f7406914ad5688f449718f21 (patch) | |
tree | f4489d28eeb18843681a46be8972bc8e8aa5ab30 | |
parent | cc6b8c4b612d239bef31a8115402b03453c2b4bc (diff) | |
download | ffmpeg-22137bb5c25364a2f7406914ad5688f449718f21.tar.gz |
af_aresample: fix properties setting in the output buffer
In particular: set output timebase to 1/output_sample_rate, fix output
PTS computation, and do not forget to copy properties values from the
input buffer.
-rw-r--r-- | libavfilter/af_aresample.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index 9af50cf208..4cf6936ba8 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -83,6 +83,7 @@ static int config_output(AVFilterLink *outlink) aresample->out_rate = outlink->sample_rate; else outlink->sample_rate = aresample->out_rate; + outlink->time_base = (AVRational) {1, aresample->out_rate}; //TODO: make the resampling parameters configurable aresample->resample = av_resample_init(aresample->out_rate, inlink->sample_rate, @@ -270,13 +271,14 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref aresample->outsamplesref = avfilter_get_audio_buffer(outlink, AV_PERM_WRITE, requested_out_nb_samples); - avfilter_copy_buffer_ref_props(aresample->outsamplesref, insamplesref); - aresample->outsamplesref->pts = - insamplesref->pts / inlink->sample_rate * outlink->sample_rate; - aresample->outsamplesref->audio->sample_rate = outlink->sample_rate; outlink->out_buf = aresample->outsamplesref; } + avfilter_copy_buffer_ref_props(aresample->outsamplesref, insamplesref); + aresample->outsamplesref->audio->sample_rate = outlink->sample_rate; + aresample->outsamplesref->pts = + av_rescale(outlink->sample_rate, insamplesref->pts, inlink->sample_rate); + /* av_resample() works with planar audio buffers */ if (!inlink->planar && nb_channels > 1) { int16_t *out[8]; |