]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cpia.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / cpia.c
index 58833b2f26706d84ada6a9c1754609ca3629caa4..d88bd1aae7be556acbd955bb03a3313b5e75e900 100644 (file)
@@ -63,7 +63,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
     uint8_t *y, *u, *v, *y_end, *u_end, *v_end;
 
     // Check header
-    if ( avpkt->size < FRAME_HEADER_SIZE
+    if ( avpkt->size < FRAME_HEADER_SIZE + avctx->height * 3
       || header[0] != MAGIC_0 || header[1] != MAGIC_1
       || (header[17] != SUBSAMPLE_420 && header[17] != SUBSAMPLE_422)
       || (header[18] != YUVORDER_YUYV && header[18] != YUVORDER_UYVY)
@@ -100,7 +100,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
     }
 
     // Get buffer filled with previous frame
-    if ((ret = ff_reget_buffer(avctx, frame)) < 0)
+    if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
         return ret;
 
 
@@ -220,7 +220,7 @@ static av_cold int cpia_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_cpia_decoder = {
+const AVCodec ff_cpia_decoder = {
     .name           = "cpia",
     .long_name      = NULL_IF_CONFIG_SMALL("CPiA video format"),
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -230,4 +230,5 @@ AVCodec ff_cpia_decoder = {
     .close          = cpia_decode_end,
     .decode         = cpia_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };