fftools/ffmpeg_enc: drop unnecessary parameter from forced_kf_apply()

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.
This commit is contained in:
Anton Khirnov 2024-02-22 18:30:42 +01:00
parent 2ee9362419
commit 2f5c570dd6
1 changed files with 6 additions and 6 deletions

View File

@ -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) {