[FFmpeg-cvslog] avfilter/vf_tpad: set output frame duration

Paul B Mahol git at videolan.org
Fri Jan 27 23:57:22 EET 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jan 27 22:56:13 2023 +0100| [23d0214939aedc77ab60d799cac4847d692358d5] | committer: Paul B Mahol

avfilter/vf_tpad: set output frame duration

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23d0214939aedc77ab60d799cac4847d692358d5
---

 libavfilter/vf_tpad.c | 14 ++++++++++----
 1 file 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);



More information about the ffmpeg-cvslog mailing list