On 1/24/19, Paweł Wegner <pawel.wegne...@gmail.com> wrote: > Signed-off-by: Paweł Wegner <pawel.wegne...@gmail.com> > --- > libavfilter/af_atempo.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c > index bfdad7d76b..1245eae8c1 100644 > --- a/libavfilter/af_atempo.c > +++ b/libavfilter/af_atempo.c > @@ -147,6 +147,8 @@ typedef struct ATempoContext { > uint8_t *dst_end; > uint64_t nsamples_in; > uint64_t nsamples_out; > + > + int64_t first_frame_pts; > } ATempoContext; > > #define YAE_ATEMPO_MIN 0.5 > @@ -994,6 +996,7 @@ static av_cold int init(AVFilterContext *ctx) > ATempoContext *atempo = ctx->priv; > atempo->format = AV_SAMPLE_FMT_NONE; > atempo->state = YAE_LOAD_FRAGMENT; > + atempo->first_frame_pts = AV_NOPTS_VALUE; > return 0; > } > > @@ -1069,6 +1072,7 @@ static int push_samples(ATempoContext *atempo, > > // adjust the PTS: > atempo->dst_buffer->pts = > + (atempo->first_frame_pts == AV_NOPTS_VALUE ? 0 : > atempo->first_frame_pts / atempo->tempo) + > av_rescale_q(atempo->nsamples_out, > (AVRational){ 1, outlink->sample_rate }, > outlink->time_base); > @@ -1108,6 +1112,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *src_buffer) > > atempo->dst = atempo->dst_buffer->data[0]; > atempo->dst_end = atempo->dst + n_out * atempo->stride; > + > + if (atempo->first_frame_pts == AV_NOPTS_VALUE) > + atempo->first_frame_pts = > av_rescale_q(atempo->dst_buffer->pts, > + inlink->time_base, > + outlink->time_base); > } > > yae_apply(atempo, &src, src_end, &atempo->dst, atempo->dst_end); > -- > 2.17.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
lgtm _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel