diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-01-27 22:56:13 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-01-27 23:01:52 +0100 |
commit | 23d0214939aedc77ab60d799cac4847d692358d5 (patch) | |
tree | d3e4d11cdf92f983494a24c6128adaaf80557bf2 | |
parent | 7b78684f9638b5f78766298fc4583c9a4d80d5ad (diff) | |
download | ffmpeg-23d0214939aedc77ab60d799cac4847d692358d5.tar.gz |
avfilter/vf_tpad: set output frame duration
-rw-r--r-- | libavfilter/vf_tpad.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c index c870478158..f0c065f0c3 100644 --- a/libavfilter/vf_tpad.c +++ b/libavfilter/vf_tpad.c @@ -75,7 +75,7 @@ static int activate(AVFilterContext *ctx) TPadContext *s = ctx->priv; AVFrame *frame = NULL; int ret, status; - int64_t pts; + int64_t duration, pts; FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); @@ -98,8 +98,10 @@ static int activate(AVFilterContext *ctx) ff_fill_rectangle(&s->draw, &s->color, frame->data, frame->linesize, 0, 0, frame->width, frame->height); + duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); frame->pts = s->pts; - s->pts += av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); + frame->duration = duration; + s->pts += duration; s->pad_start--; return ff_filter_frame(outlink, frame); } @@ -116,8 +118,10 @@ static int activate(AVFilterContext *ctx) frame = av_frame_clone(s->cache_start); if (!frame) return AVERROR(ENOMEM); + duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); frame->pts = s->pts; - s->pts += av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); + frame->duration = duration; + s->pts += duration; s->pad_start--; if (s->pad_start == 0) s->cache_start = NULL; @@ -160,8 +164,10 @@ static int activate(AVFilterContext *ctx) if (!frame) return AVERROR(ENOMEM); } + duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); frame->pts = s->pts; - s->pts += av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base); + frame->duration = duration; + s->pts += duration; if (s->pad_stop > 0) s->pad_stop--; return ff_filter_frame(outlink, frame); |