]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_parser.c
lavc: move SANE_NB_CHANNELS to internal.h and use it in the PCM decoders
[ffmpeg] / libavcodec / h264_parser.c
index 826c17a0f1e415d23add71bfa17b8e2ce69d1521..0464476382c6cd5583a2b1d37ef10f59afcfe1c6 100644 (file)
@@ -37,7 +37,6 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si
     int i;
     uint32_t state;
     ParseContext *pc = &(h->s.parse_context);
-//printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]);
 //    mb_addr= pc->mb_addr - 1;
     state= pc->state;
     if(state>13)
@@ -251,6 +250,13 @@ static int h264_parse(AVCodecParserContext *s,
         h->got_first = 1;
         if (avctx->extradata_size) {
             h->s.avctx = avctx;
+            // must be done like in the decoder.
+            // otherwise opening the parser, creating extradata,
+            // and then closing and opening again
+            // will cause has_b_frames to be always set.
+            // NB: estimate_timings_from_pts behaves exactly like this.
+            if (!avctx->has_b_frames)
+                h->s.low_delay = 1;
             ff_h264_decode_extradata(h);
         }
     }
@@ -330,11 +336,12 @@ static int init(AVCodecParserContext *s)
 {
     H264Context *h = s->priv_data;
     h->thread_context[0] = h;
+    h->s.slice_context_count = 1;
     return 0;
 }
 
 AVCodecParser ff_h264_parser = {
-    .codec_ids      = { CODEC_ID_H264 },
+    .codec_ids      = { AV_CODEC_ID_H264 },
     .priv_data_size = sizeof(H264Context),
     .parser_init    = init,
     .parser_parse   = h264_parse,