History

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.

Anton Khirnov committed 2 years ago

Commit 2f5c5701 parent 2ee93621 file · +6 −6Browse files

Showing the changes to fftools (1 of 1 file). Show all

Unified · Split

fftools/ffmpeg_enc.c+6−6
@@ -746,16 +746,16 @@ static int do_audio_out(OutputFile *of, OutputStream *ost, · 745 unmodified lines
746746 }
747747
748748 static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
749− AVRational tb, const AVFrame *in_picture)
749+ const AVFrame *frame)
750750 {
751751 double pts_time;
752752
753753 if (kf->ref_pts == AV_NOPTS_VALUE)
754− kf->ref_pts = in_picture->pts;
754+ kf->ref_pts = frame->pts;
755755
756− pts_time = (in_picture->pts - kf->ref_pts) * av_q2d(tb);
756+ pts_time = (frame->pts - kf->ref_pts) * av_q2d(frame->time_base);
757757 if (kf->index < kf->nb_pts &&
758− av_compare_ts(in_picture->pts, tb, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) {
758+ av_compare_ts(frame->pts, frame->time_base, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) {
759759 kf->index++;
760760 goto force_keyframe;
761761 } else if (kf->pexpr) {
@@ -780,7 +780,7 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, · 18 unmodified lines
780780 kf->expr_const_values[FKF_N_FORCED] += 1;
781781 goto force_keyframe;
782782 }
783− } else if (kf->type == KF_FORCE_SOURCE && (in_picture->flags & AV_FRAME_FLAG_KEY)) {
783+ } else if (kf->type == KF_FORCE_SOURCE && (frame->flags & AV_FRAME_FLAG_KEY)) {
784784 goto force_keyframe;
785785 }
786786
@@ -801,7 +801,7 @@ static int do_video_out(OutputFile *of, OutputStream *ost, · 14 unmodified lines
801801 return AVERROR_EOF;
802802
803803 in_picture->quality = enc->global_quality;
804− in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture);
804+ in_picture->pict_type = forced_kf_apply(ost, &ost->kf, in_picture);
805805
806806 #if FFMPEG_OPT_TOP
807807 if (ost->top_field_first >= 0) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t