From: Limin Wang <lance.lmw...@gmail.com> delete the previous change of ffmpeg.c and movenc.c as mux.c will be in charge of setting AV_PKT_FLAG_KEY.
Signed-off-by: Limin Wang <lance.lmw...@gmail.com> --- fftools/ffmpeg.c | 1 - libavformat/internal.h | 2 ++ libavformat/mux.c | 7 ++++++- libavformat/tests/movenc.c | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 293561a8b1..d896b14a14 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1056,7 +1056,6 @@ static void do_subtitle_out(OutputFile *of, else pkt.pts += av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->mux_timebase); } - pkt.flags |= AV_PKT_FLAG_KEY; pkt.dts = pkt.pts; output_packet(of, &pkt, ost, 0); } diff --git a/libavformat/internal.h b/libavformat/internal.h index 716e42cc3e..c4fac5cc76 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -189,6 +189,8 @@ struct AVStreamInternal { */ int need_context_update; + int is_intra_only; + FFFrac *priv_pts; }; diff --git a/libavformat/mux.c b/libavformat/mux.c index a6253f5430..ea6524f579 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -357,6 +357,8 @@ FF_ENABLE_DEPRECATION_WARNINGS if (desc && desc->props & AV_CODEC_PROP_REORDER) st->internal->reorder = 1; + st->internal->is_intra_only = ff_is_intra_only(par->codec_id); + if (of->codec_tag) { if ( par->codec_tag && par->codec_id == AV_CODEC_ID_RAWVIDEO @@ -773,6 +775,7 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt) static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt) { int ret; + AVStream *st = s->streams[pkt->stream_index]; ret = check_packet(s, pkt); if (ret < 0) @@ -781,7 +784,6 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt) #if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX /* sanitize the timestamps */ if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { - AVStream *st = s->streams[pkt->stream_index]; /* when there is no reordering (so dts is equal to pts), but * only one of them is set, set the other as well */ @@ -818,6 +820,9 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt) } } #endif + /* update flags */ + if (st->internal->is_intra_only) + pkt->flags |= AV_PKT_FLAG_KEY; return 0; } diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index 0ff87da7d6..1d15d97ad9 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -256,7 +256,6 @@ static void mux_frames(int n, int c) pkt.dts = pkt.pts = audio_dts; pkt.stream_index = 1; pkt.duration = audio_duration; - pkt.flags |= AV_PKT_FLAG_KEY; audio_dts += audio_duration; } else { if (frames == end_frames) -- 2.21.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".