diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 70552d4c578969a25f1f91fa10b16485077f8647..60f55758ffe26ba870f3df25f9130e9eb2616f28 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -325,6 +325,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, frame_rate_ext_n = (buf[5] >> 5) & 3; frame_rate_ext_d = (buf[5] & 0x1f); pc->progressive_sequence = buf[1] & (1 << 3); + avctx->has_b_frames= buf[5] >> 7; pc->width |=(horiz_size_ext << 12); pc->height |=( vert_size_ext << 12); diff --git a/libavformat/utils.c b/libavformat/utils.c index 1f99daa42b3ac14e7f2dc52d6a80812c35dae390..035403d0eb3f43a63d7d81d0001faf1eea567b29 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -702,10 +702,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (st->codec.codec_type == CODEC_TYPE_VIDEO) { /* XXX: need has_b_frame, but cannot get it if the codec is not initialized */ - if ((st->codec.codec_id == CODEC_ID_MPEG1VIDEO || - st->codec.codec_id == CODEC_ID_MPEG2VIDEO || - st->codec.codec_id == CODEC_ID_MPEG4 || - st->codec.codec_id == CODEC_ID_H264) && + if (( st->codec.codec_id == CODEC_ID_H264 + || st->codec.has_b_frames) && pc && pc->pict_type != FF_B_TYPE) presentation_delayed = 1; /* this may be redundant, but it shouldnt hurt */