]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/eacmv.c
mimic: Convert to the new bitstream reader
[ffmpeg] / libavcodec / eacmv.c
index d39ebd36b97333f31763c4844ff3af1242318f30..633c26ae141e550e8340ba852e8f7a112e00b038 100644 (file)
@@ -71,8 +71,8 @@ static void cmv_decode_intra(CmvContext * s, AVFrame *frame,
     }
 }
 
-static void cmv_motcomp(unsigned char *dst, int dst_stride,
-                        const unsigned char *src, int src_stride,
+static void cmv_motcomp(unsigned char *dst, ptrdiff_t dst_stride,
+                        const unsigned char *src, ptrdiff_t src_stride,
                         int x, int y,
                         int xoffset, int yoffset,
                         int width, int height){
@@ -131,7 +131,7 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf,
 
 static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
 {
-    int pal_start, pal_count, i, ret;
+    int pal_start, pal_count, i, ret, fps;
 
     if(buf_end - buf < 16) {
         av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
@@ -141,12 +141,19 @@ static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *
     s->width  = AV_RL16(&buf[4]);
     s->height = AV_RL16(&buf[6]);
 
+    if (s->width  != s->avctx->width ||
+        s->height != s->avctx->height) {
+        av_frame_unref(s->last_frame);
+        av_frame_unref(s->last2_frame);
+    }
+
     ret = ff_set_dimensions(s->avctx, s->width, s->height);
     if (ret < 0)
         return ret;
 
-    s->avctx->time_base.num = 1;
-    s->avctx->time_base.den = AV_RL16(&buf[10]);
+    fps = AV_RL16(&buf[10]);
+    if (fps > 0)
+        s->avctx->framerate = (AVRational){ fps, 1 };
 
     pal_start = AV_RL16(&buf[12]);
     pal_count = AV_RL16(&buf[14]);
@@ -233,5 +240,5 @@ AVCodec ff_eacmv_decoder = {
     .init           = cmv_decode_init,
     .close          = cmv_decode_end,
     .decode         = cmv_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1,
 };