fix timestamp prediction for low_delay mpeg streams
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Dec 2004 12:04:45 +0000 (12:04 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Dec 2004 12:04:45 +0000 (12:04 +0000)
Originally committed as revision 3751 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/parser.c
libavformat/utils.c

index 70552d4..60f5575 100644 (file)
@@ -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);
index 1f99daa..035403d 100644 (file)
@@ -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 */