]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/hnm4video.c
d3d11va: make av_d3d11va_alloc_context() available at all times
[ffmpeg] / libavcodec / hnm4video.c
index b200e89a6a18f3e19c70693c3a406d86516e7173..1dc6ed3baced41b73c0b7d1c9f0630d66a68d809 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <string.h>
 
+#include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
@@ -36,8 +37,8 @@
 
 typedef struct Hnm4VideoContext {
     uint8_t version;
-    uint16_t width;
-    uint16_t height;
+    int width;
+    int height;
     uint8_t *current;
     uint8_t *previous;
     uint8_t *buffer1;
@@ -406,6 +407,7 @@ static int hnm_decode_frame(AVCodecContext *avctx, void *data,
 static av_cold int hnm_decode_init(AVCodecContext *avctx)
 {
     Hnm4VideoContext *hnm = avctx->priv_data;
+    int ret;
 
     if (avctx->extradata_size < 1) {
         av_log(avctx, AV_LOG_ERROR,
@@ -413,6 +415,10 @@ static av_cold int hnm_decode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
+    ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
+    if (ret < 0)
+        return ret;
+
     hnm->version   = avctx->extradata[0];
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
     hnm->width     = avctx->width;
@@ -455,5 +461,5 @@ AVCodec ff_hnm4_video_decoder = {
     .init           = hnm_decode_init,
     .close          = hnm_decode_end,
     .decode         = hnm_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1,
 };