On Fri, Apr 03, 2020 at 11:23:59PM +0200, Michael Niedermayer wrote: > On Fri, Apr 03, 2020 at 11:05:59PM +0800, lance.lmw...@gmail.com wrote: > > From: Limin Wang <lance.lmw...@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > > --- > > libavformat/mux.c | 16 ++++++++ > > tests/ref/fate/binsub-movtextenc | 2 +- > > tests/ref/fate/movenc | 50 +++++++++++------------ > > tests/ref/fate/sub2video | 86 > > ++++++++++++++++++++-------------------- > > 4 files changed, 85 insertions(+), 69 deletions(-) > > > > diff --git a/libavformat/mux.c b/libavformat/mux.c > > index cc2d1e2..dc897c2 100644 > > --- a/libavformat/mux.c > > +++ b/libavformat/mux.c > > @@ -548,6 +548,17 @@ fail: > > return ret; > > } > > > > +static int is_intra_only(enum AVCodecID id) > > +{ > > + const AVCodecDescriptor *d = avcodec_descriptor_get(id); > > + if (!d) > > + return 0; > > + if ((d->type == AVMEDIA_TYPE_VIDEO || d->type == AVMEDIA_TYPE_AUDIO) && > > + !(d->props & AV_CODEC_PROP_INTRA_ONLY)) > > + return 0; > > + return 1; > > +} > > this should not be duplicated with code in utils.c
OK > > > > + > > #define AV_PKT_FLAG_UNCODED_FRAME 0x2000 > > > > /* Note: using sizeof(AVFrame) from outside lavu is unsafe in general, but > > @@ -664,6 +675,11 @@ static int compute_muxer_pkt_fields(AVFormatContext > > *s, AVStream *st, AVPacket * > > frac_add(st->internal->priv_pts, (int64_t)st->time_base.den * > > st->time_base.num); > > break; > > } > > + > > + /* update flags */ > > + if (is_intra_only(st->codecpar->codec_id)) > > + pkt->flags |= AV_PKT_FLAG_KEY; > > + > > it may make sense to store the AVCodecDescriptor and not search it again for > each packet. But then the "is_intra_only" itself also does not change so that > should itself be computet just once per stream Do you say we should add a is_intra_only field in AVStream to compute at beginning, however it'll change the API header. So I prefer to use is_intra_only() function first, > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I am the wisest man alive, for I know one thing, and that is that I know > nothing. -- Socrates > _______________________________________________ > 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". -- Thanks, Limin Wang _______________________________________________ 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".