changeset 1614:6c82ef97d3e6 libavcodec

also parse extradata for MPEG4
author bellard
date Mon, 10 Nov 2003 18:33:58 +0000
parents 0279c6c61f11
children 721a76648a4b
files parser.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/parser.c	Mon Nov 10 15:29:20 2003 +0000
+++ b/parser.c	Mon Nov 10 18:33:58 2003 +0000
@@ -114,8 +114,10 @@
     int frame_rate;
     int progressive_sequence;
     int width, height;
+
     /* XXX: suppress that, needed by MPEG4 */
     MpegEncContext *enc;
+    int first_picture;
 } ParseContext1;
 
 /**
@@ -439,21 +441,31 @@
     int ret;
 
     s->avctx = avctx;
+    s->current_picture_ptr = &s->current_picture;
+
+    if (avctx->extradata_size && pc->first_picture){
+        init_get_bits(gb, avctx->extradata, avctx->extradata_size*8);
+        ret = ff_mpeg4_decode_picture_header(s, gb);
+    }
+
     init_get_bits(gb, buf, 8 * buf_size);
     ret = ff_mpeg4_decode_picture_header(s, gb);
     if (s->width) {
         avctx->width = s->width;
         avctx->height = s->height;
     }
+    pc->first_picture = 0;
     return ret;
 }
 
 int mpeg4video_parse_init(AVCodecParserContext *s)
 {
     ParseContext1 *pc = s->priv_data;
+
     pc->enc = av_mallocz(sizeof(MpegEncContext));
     if (!pc->enc)
         return -1;
+    pc->first_picture = 1;
     return 0;
 }