]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/zmbv.c
ARM: intmath: use native-size return types for clipping functions
[ffmpeg] / libavcodec / zmbv.c
index a160553c098e68fb980aad1f94ff2cdebb051937..4557cb16f967fa5363c3556ec06af6cb3abce738 100644 (file)
@@ -484,35 +484,39 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
         if (zret != Z_OK) {
             av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
             return -1;
-         }
-
-         tmp = av_realloc(c->cur,  avctx->width * avctx->height * (c->bpp / 8));
-         if (!tmp)
-             return AVERROR(ENOMEM);
-         c->cur = tmp;
-         tmp = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
-         if (!tmp)
-             return AVERROR(ENOMEM);
-         c->prev = tmp;
-         c->bx = (c->width + c->bw - 1) / c->bw;
-         c->by = (c->height+ c->bh - 1) / c->bh;
-     }
-
-     if (c->decode_intra == NULL) {
-         av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
-         return AVERROR_INVALIDDATA;
-     }
-
-     if (c->comp == 0) { //Uncompressed data
-         memcpy(c->decomp_buf, buf, len);
-         c->decomp_size = 1;
-     } else { // ZLIB-compressed data
+        }
+
+        tmp = av_realloc(c->cur,  avctx->width * avctx->height * (c->bpp / 8));
+        if (!tmp)
+            return AVERROR(ENOMEM);
+        c->cur = tmp;
+        tmp = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
+        if (!tmp)
+            return AVERROR(ENOMEM);
+        c->prev = tmp;
+        c->bx   = (c->width  + c->bw - 1) / c->bw;
+        c->by   = (c->height + c->bh - 1) / c->bh;
+    }
+
+    if (c->decode_intra == NULL) {
+        av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
+        return AVERROR_INVALIDDATA;
+    }
+
+    if (c->comp == 0) { //Uncompressed data
+        memcpy(c->decomp_buf, buf, len);
+        c->decomp_size = 1;
+    } else { // ZLIB-compressed data
         c->zstream.total_in = c->zstream.total_out = 0;
         c->zstream.next_in = buf;
         c->zstream.avail_in = len;
         c->zstream.next_out = c->decomp_buf;
         c->zstream.avail_out = c->decomp_size;
-        inflate(&c->zstream, Z_FINISH);
+        zret = inflate(&c->zstream, Z_SYNC_FLUSH);
+        if (zret != Z_OK && zret != Z_STREAM_END) {
+            av_log(avctx, AV_LOG_ERROR, "inflate error %d\n", zret);
+            return AVERROR_INVALIDDATA;
+        }
         c->decomp_len = c->zstream.total_out;
     }
     if (c->flags & ZMBV_KEYFRAME) {
@@ -671,11 +675,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
 AVCodec ff_zmbv_decoder = {
     .name           = "zmbv",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_ZMBV,
+    .id             = AV_CODEC_ID_ZMBV,
     .priv_data_size = sizeof(ZmbvContext),
     .init           = decode_init,
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
 };