#include "libavutil/common.h"
typedef struct {
- AVFrame previous_frame;
+ AVFrame *previous_frame;
z_stream zstream;
} ZeroCodecContext;
{
ZeroCodecContext *zc = avctx->priv_data;
AVFrame *pic = data;
- AVFrame *prev_pic = &zc->previous_frame;
+ AVFrame *prev_pic = zc->previous_frame;
z_stream *zstream = &zc->zstream;
uint8_t *prev = prev_pic->data[0];
uint8_t *dst;
dst -= pic->linesize[0];
}
- av_frame_unref(&zc->previous_frame);
- if ((ret = av_frame_ref(&zc->previous_frame, pic)) < 0)
+ av_frame_unref(zc->previous_frame);
+ if ((ret = av_frame_ref(zc->previous_frame, pic)) < 0)
return ret;
*got_frame = 1;
{
ZeroCodecContext *zc = avctx->priv_data;
- av_frame_unref(&zc->previous_frame);
+ av_frame_free(&zc->previous_frame);
inflateEnd(&zc->zstream);
return AVERROR(ENOMEM);
}
+ zc->previous_frame = av_frame_alloc();
+ if (!zc->previous_frame) {
+ zerocodec_decode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
return 0;
}