]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flashsv.c
gain code, gain pitch and pitch delay decoding for ACELP based codecs
[ffmpeg] / libavcodec / flashsv.c
index b5905e1ea42830c937c52990dad408aafd796a3d..3842594ad264300cc9e00fb5c640fc0c995edc03 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <zlib.h>
 
-#include "common.h"
 #include "avcodec.h"
 #include "bitstream.h"
 
+#include <zlib.h>
+
 typedef struct FlashSVContext {
     AVCodecContext *avctx;
     AVFrame frame;
@@ -79,9 +79,9 @@ static void copy_region(uint8_t *sptr, uint8_t *dptr,
 }
 
 
-static int flashsv_decode_init(AVCodecContext *avctx)
+static av_cold int flashsv_decode_init(AVCodecContext *avctx)
 {
-    FlashSVContext *s = (FlashSVContext *)avctx->priv_data;
+    FlashSVContext *s = avctx->priv_data;
     int zret; // Zlib return code
 
     s->avctx = avctx;
@@ -94,7 +94,6 @@ static int flashsv_decode_init(AVCodecContext *avctx)
         return 1;
     }
     avctx->pix_fmt = PIX_FMT_BGR24;
-    avctx->has_b_frames = 0;
     s->frame.data[0] = NULL;
 
     return 0;
@@ -103,9 +102,9 @@ static int flashsv_decode_init(AVCodecContext *avctx)
 
 static int flashsv_decode_frame(AVCodecContext *avctx,
                                     void *data, int *data_size,
-                                    uint8_t *buf, int buf_size)
+                                    const uint8_t *buf, int buf_size)
 {
-    FlashSVContext *s = (FlashSVContext *)avctx->priv_data;
+    FlashSVContext *s = avctx->priv_data;
     int h_blocks, v_blocks, h_part, v_part, i, j;
     GetBitContext gb;
 
@@ -201,7 +200,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx,
                 ret = inflate(&(s->zstream), Z_FINISH);
                 if (ret == Z_DATA_ERROR)
                 {
-                    av_log(avctx, AV_LOG_ERROR, "Zlib resync occured\n");
+                    av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
                     inflateSync(&(s->zstream));
                     ret = inflate(&(s->zstream), Z_FINISH);
                 }
@@ -229,9 +228,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx,
 }
 
 
-static int flashsv_decode_end(AVCodecContext *avctx)
+static av_cold int flashsv_decode_end(AVCodecContext *avctx)
 {
-    FlashSVContext *s = (FlashSVContext *)avctx->priv_data;
+    FlashSVContext *s = avctx->priv_data;
     inflateEnd(&(s->zstream));
     /* release the frame if needed */
     if (s->frame.data[0])
@@ -255,5 +254,6 @@ AVCodec flashsv_decoder = {
     flashsv_decode_end,
     flashsv_decode_frame,
     CODEC_CAP_DR1,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_BGR24, -1},
+    .pix_fmts = (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"),
 };