diff mbox series

[FFmpeg-devel,11/18] fftools/ffmpeg_enc: drop unnecessary parameter from forced_kf_apply()

Message ID 20240306110319.17339-11-anton@khirnov.net
State Accepted
Commit 2f5c570dd67f04d7ec49aaf6e282d102d88a34cc
Headers show
Series [FFmpeg-devel,01/18] fftools/cmdutils: fix printing group name in split_commandline() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov March 6, 2024, 11:03 a.m. UTC
Encoder timebase is equal to the frame timebase, so does not need to be
passed separately.

Also, rename in_picture to frame, which is shorter and more accurate -
it always contains a frame, never a field.
---
 fftools/ffmpeg_enc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 1ddef46d03..f0a17228fe 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -746,16 +746,16 @@  static int do_audio_out(OutputFile *of, OutputStream *ost,
 }
 
 static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
-                                          AVRational tb, const AVFrame *in_picture)
+                                          const AVFrame *frame)
 {
     double pts_time;
 
     if (kf->ref_pts == AV_NOPTS_VALUE)
-        kf->ref_pts = in_picture->pts;
+        kf->ref_pts = frame->pts;
 
-    pts_time = (in_picture->pts - kf->ref_pts) * av_q2d(tb);
+    pts_time = (frame->pts - kf->ref_pts) * av_q2d(frame->time_base);
     if (kf->index < kf->nb_pts &&
-        av_compare_ts(in_picture->pts, tb, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) {
+        av_compare_ts(frame->pts, frame->time_base, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) {
         kf->index++;
         goto force_keyframe;
     } else if (kf->pexpr) {
@@ -780,7 +780,7 @@  static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
             kf->expr_const_values[FKF_N_FORCED]     += 1;
             goto force_keyframe;
         }
-    } else if (kf->type == KF_FORCE_SOURCE && (in_picture->flags & AV_FRAME_FLAG_KEY)) {
+    } else if (kf->type == KF_FORCE_SOURCE && (frame->flags & AV_FRAME_FLAG_KEY)) {
         goto force_keyframe;
     }
 
@@ -801,7 +801,7 @@  static int do_video_out(OutputFile *of, OutputStream *ost,
         return AVERROR_EOF;
 
     in_picture->quality = enc->global_quality;
-    in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture);
+    in_picture->pict_type = forced_kf_apply(ost, &ost->kf, in_picture);
 
 #if FFMPEG_OPT_TOP
     if (ost->top_field_first >= 0) {