fftools/ffmpeg_enc: unbreak -force_key_frames source_no_drop

Unlike the 'source' mode, which preserves source keyframe-marking as-is,
the 'source_no_drop' mode attempts to keep track of keyframes dropped by
framerate conversion and mark the next output frame as key in such
cases. However,
* c75be06148 broke this functionality entirely, and made it equivalent
  to 'source'
* even before it would only work when the frame immediately following
  the dropped keyframe is preserved and not dropped as well

Also, drop a redundant check for 'frame' in setting dropped_keyframe, as
it is redundant with the check on the above line.
This commit is contained in:
Anton Khirnov 2023-09-09 14:11:56 +02:00
parent a07b2f5f11
commit 735b082231

View File

@ -1054,7 +1054,7 @@ finish:
}
ost->last_dropped = *nb_frames == *nb_frames_prev && frame;
ost->kf.dropped_keyframe = ost->last_dropped && frame && (frame->flags & AV_FRAME_FLAG_KEY);
ost->kf.dropped_keyframe |= ost->last_dropped && (frame->flags & AV_FRAME_FLAG_KEY);
}
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
@ -1097,8 +1097,9 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
(in_picture->flags & AV_FRAME_FLAG_KEY) && !dup_idx) {
goto force_keyframe;
} else if (kf->type == KF_FORCE_SOURCE_NO_DROP && !dup_idx) {
int dropped_keyframe = kf->dropped_keyframe;
kf->dropped_keyframe = 0;
if ((in_picture->flags & AV_FRAME_FLAG_KEY) || kf->dropped_keyframe)
if ((in_picture->flags & AV_FRAME_FLAG_KEY) || dropped_keyframe)
goto force_keyframe;
}