]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flashsv.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / flashsv.c
index 90e1d43cdad6c02a4b56a60341634af370827da7..4240091d92f1e093ef6f4c6a90e9c26453f7f0c1 100644 (file)
@@ -132,7 +132,6 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
 
     s->frame = av_frame_alloc();
     if (!s->frame) {
-        flashsv_decode_end(avctx);
         return AVERROR(ENOMEM);
     }
 
@@ -180,7 +179,7 @@ static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size)
     return 0;
 }
 
-static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
+static int flashsv_decode_block(AVCodecContext *avctx, const AVPacket *avpkt,
                                 GetBitContext *gb, int block_size,
                                 int width, int height, int x_pos, int y_pos,
                                 int blk_idx)
@@ -369,7 +368,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
             s->image_width, s->image_height, s->block_width, s->block_height,
             h_blocks, v_blocks, h_part, v_part);
 
-    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+    if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
         return ret;
 
     /* loop over all block columns */
@@ -508,7 +507,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
 }
 
 #if CONFIG_FLASHSV_DECODER
-AVCodec ff_flashsv_decoder = {
+const AVCodec ff_flashsv_decoder = {
     .name           = "flashsv",
     .long_name      = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"),
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -518,6 +517,7 @@ AVCodec ff_flashsv_decoder = {
     .close          = flashsv_decode_end,
     .decode         = flashsv_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
 };
 #endif /* CONFIG_FLASHSV_DECODER */
@@ -551,7 +551,11 @@ static const uint32_t ff_flashsv2_default_palette[128] = {
 static av_cold int flashsv2_decode_init(AVCodecContext *avctx)
 {
     FlashSVContext *s = avctx->priv_data;
-    flashsv_decode_init(avctx);
+    int ret;
+
+    ret = flashsv_decode_init(avctx);
+    if (ret < 0)
+        return ret;
     s->pal = ff_flashsv2_default_palette;
     s->ver = 2;
 
@@ -571,7 +575,7 @@ static av_cold int flashsv2_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_flashsv2_decoder = {
+const AVCodec ff_flashsv2_decoder = {
     .name           = "flashsv2",
     .long_name      = NULL_IF_CONFIG_SMALL("Flash Screen Video v2"),
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -581,6 +585,7 @@ AVCodec ff_flashsv2_decoder = {
     .close          = flashsv2_decode_end,
     .decode         = flashsv_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
 };
 #endif /* CONFIG_FLASHSV2_DECODER */