]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cljr.c
Merge commit 'd4df02131b5522a99a4e6035368484e809706ed5'
[ffmpeg] / libavcodec / cljr.c
index 51ac10662a89a59867e008565c1cf35da181c72f..7e0773b6be19bee0dce5f3454ba183dd7d516f2c 100644 (file)
@@ -99,16 +99,21 @@ AVCodec ff_cljr_decoder = {
 #if CONFIG_CLJR_ENCODER
 typedef struct CLJRContext {
     AVClass        *avclass;
-    AVFrame         picture;
     int             dither_type;
 } CLJRContext;
 
 static av_cold int encode_init(AVCodecContext *avctx)
 {
-    CLJRContext * const a = avctx->priv_data;
+    avctx->coded_frame = av_frame_alloc();
+    if (!avctx->coded_frame)
+        return AVERROR(ENOMEM);
 
-    avctx->coded_frame = &a->picture;
+    return 0;
+}
 
+static av_cold int encode_close(AVCodecContext *avctx)
+{
+    av_frame_free(&avctx->coded_frame);
     return 0;
 }
 
@@ -183,6 +188,7 @@ AVCodec ff_cljr_encoder = {
     .priv_data_size = sizeof(CLJRContext),
     .init           = encode_init,
     .encode2        = encode_frame,
+    .close          = encode_close,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV411P,
                                                    AV_PIX_FMT_NONE },
     .priv_class     = &cljr_class,