[FFmpeg-cvslog] fftools: use the new AVFrame keyframe flag

James Almer git at videolan.org
Fri May 5 02:50:56 EEST 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Apr 12 19:54:10 2023 -0300| [c7a8681860d68f3ad00ef49215dbfda52c71c90b] | committer: James Almer

fftools: use the new AVFrame keyframe flag

Signed-off-by: James Almer <jamrial at gmail.com>

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

 fftools/ffmpeg.c     | 2 +-
 fftools/ffmpeg_enc.c | 6 +++---
 fftools/ffprobe.c    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 23aa343bbc..8323c32ffd 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1143,7 +1143,7 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output,
                av_ts2timestr(best_effort_timestamp, &ist->st->time_base),
                av_ts2str(decoded_frame->duration),
                av_ts2timestr(decoded_frame->duration, &ist->st->time_base),
-               decoded_frame->key_frame, decoded_frame->pict_type,
+               !!(decoded_frame->flags & AV_FRAME_FLAG_KEY), decoded_frame->pict_type,
                ist->st->time_base.num, ist->st->time_base.den);
     }
 
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index f2af81bacc..53bf320afa 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -1005,11 +1005,11 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
             goto force_keyframe;
         }
     } else if (kf->type == KF_FORCE_SOURCE &&
-               in_picture->key_frame == 1 && !dup_idx) {
+               (in_picture->flags & AV_FRAME_FLAG_KEY) && !dup_idx) {
             goto force_keyframe;
     } else if (kf->type == KF_FORCE_SOURCE_NO_DROP && !dup_idx) {
         kf->dropped_keyframe = 0;
-        if ((in_picture->key_frame == 1) || kf->dropped_keyframe)
+        if ((in_picture->flags & AV_FRAME_FLAG_KEY) || kf->dropped_keyframe)
             goto force_keyframe;
     }
 
@@ -1064,7 +1064,7 @@ static void do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
         }
     }
     ost->last_dropped = nb_frames == nb_frames_prev && frame;
-    ost->kf.dropped_keyframe = ost->last_dropped && frame && frame->key_frame;
+    ost->kf.dropped_keyframe = ost->last_dropped && frame && (frame->flags & AV_FRAME_FLAG_KEY);
 
     /* duplicates frame if needed */
     for (i = 0; i < nb_frames; i++) {
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 10492011d7..43bf10db54 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2594,7 +2594,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
     if (s) print_str    ("media_type", s);
     else   print_str_opt("media_type", "unknown");
     print_int("stream_index",           stream->index);
-    print_int("key_frame",              frame->key_frame);
+    print_int("key_frame",           !!(frame->flags & AV_FRAME_FLAG_KEY));
     print_ts  ("pts",                   frame->pts);
     print_time("pts_time",              frame->pts, &stream->time_base);
     print_ts  ("pkt_dts",               frame->pkt_dts);



More information about the ffmpeg-cvslog mailing list