]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/vp5.c
Fix segault
[frescor/ffmpeg.git] / libavcodec / vp5.c
index 7b39c81cb476040037653612fb29cd1b59000486..1f8434c731db408356f4189dda3e34f47dca1d03 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @file vp5.c
+ * @file libavcodec/vp5.c
  * VP5 compatible video decoder
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
@@ -26,7 +26,7 @@
 
 #include "avcodec.h"
 #include "dsputil.h"
-#include "bitstream.h"
+#include "get_bits.h"
 
 #include "vp56.h"
 #include "vp56data.h"
@@ -58,12 +58,14 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
         vp56_rac_gets(c, 8);  /* number of displayed macroblock rows */
         vp56_rac_gets(c, 8);  /* number of displayed macroblock cols */
         vp56_rac_gets(c, 2);
-        if (16*cols != s->avctx->coded_width ||
+        if (!s->macroblocks || /* first frame */
+            16*cols != s->avctx->coded_width ||
             16*rows != s->avctx->coded_height) {
             avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
             return 2;
         }
-    }
+    } else if (!s->macroblocks)
+        return 0;
     return 1;
 }