summaryrefslogtreecommitdiff
path: root/libavcodec/cljr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/cljr.c')
-rw-r--r--libavcodec/cljr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c
index 51ac10662a..7e0773b6be 100644
--- a/libavcodec/cljr.c
+++ b/libavcodec/cljr.c
@@ -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,