On Fri, Apr 03, 2020 at 11:05:59PM +0800, [email protected] wrote: > From: Limin Wang <[email protected]> > > Signed-off-by: Limin Wang <[email protected]> > --- > 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 > + > #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 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
