]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flashsvenc.c
avformat: Remove deprecated filename field from AVFormatContext
[ffmpeg] / libavcodec / flashsvenc.c
index f7f98efde346aab85e9c59ccde71008dc4077b7b..95ae98844889615f4e7a3c4ecda44afee7d1b7b5 100644 (file)
@@ -59,11 +59,10 @@ typedef struct FlashSVContext {
     uint8_t        *previous_frame;
     int             image_width, image_height;
     int             block_width, block_height;
-    uint8_t        *tmpblock;
     uint8_t        *encbuffer;
     int             block_size;
-    z_stream        zstream;
     int             last_key_frame;
+    uint8_t         tmpblock[3 * 256 * 256];
 } FlashSVContext;
 
 static int copy_region_enc(uint8_t *sptr, uint8_t *dptr, int dx, int dy,
@@ -92,11 +91,8 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx)
 {
     FlashSVContext *s = avctx->priv_data;
 
-    deflateEnd(&s->zstream);
-
     av_freep(&s->encbuffer);
     av_freep(&s->previous_frame);
-    av_freep(&s->tmpblock);
 
     return 0;
 }
@@ -113,18 +109,14 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    // Needed if zlib unused or init aborted before deflateInit
-    memset(&s->zstream, 0, sizeof(z_stream));
-
     s->last_key_frame = 0;
 
     s->image_width  = avctx->width;
     s->image_height = avctx->height;
 
-    s->tmpblock  = av_mallocz(3 * 256 * 256);
     s->encbuffer = av_mallocz(s->image_width * s->image_height * 3);
 
-    if (!s->tmpblock || !s->encbuffer) {
+    if (!s->encbuffer) {
         av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n");
         return AVERROR(ENOMEM);
     }
@@ -182,7 +174,6 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf,
                 ret = compress2(ptr + 2, &zsize, s->tmpblock,
                                 3 * cur_blk_width * cur_blk_height, 9);
 
-                //ret = deflateReset(&s->zstream);
                 if (ret != Z_OK)
                     av_log(s->avctx, AV_LOG_ERROR,
                            "error while compressing block %dx%d\n", i, j);