]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/avs.c
cook: Make constants passed to AV_BE2NE32C() unsigned to avoid signed overflow.
[ffmpeg] / libavcodec / avs.c
index 3ccded3f8c397ffce034004504de401a7d3180ff..7f8ff0f024e60b341b7527ab28afa05be23e9b7a 100644 (file)
@@ -51,7 +51,7 @@ avs_decode_frame(AVCodecContext * avctx,
     int buf_size = avpkt->size;
     AvsContext *const avs = avctx->priv_data;
     AVFrame *picture = data;
-    AVFrame *const p = (AVFrame *) & avs->picture;
+    AVFrame *const p =  &avs->picture;
     const uint8_t *table, *vect;
     uint8_t *out;
     int i, j, x, y, stride, vect_w = 3, vect_h = 3;
@@ -149,7 +149,7 @@ avs_decode_frame(AVCodecContext * avctx,
             align_get_bits(&change_map);
     }
 
-    *picture = *(AVFrame *) & avs->picture;
+    *picture   = avs->picture;
     *data_size = sizeof(AVPicture);
 
     return buf_size;
@@ -161,6 +161,15 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
+static av_cold int avs_decode_end(AVCodecContext *avctx)
+{
+    AvsContext *s = avctx->priv_data;
+    if (s->picture.data[0])
+        avctx->release_buffer(avctx, &s->picture);
+    return 0;
+}
+
+
 AVCodec ff_avs_decoder = {
     .name           = "avs",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -168,6 +177,7 @@ AVCodec ff_avs_decoder = {
     .priv_data_size = sizeof(AvsContext),
     .init           = avs_decode_init,
     .decode         = avs_decode_frame,
+    .close          = avs_decode_end,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
+    .long_name      = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
 };