diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 02:09:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 02:12:51 +0100 |
commit | 8af7774c7aca6f3b595d0417b92f543ce0c7b537 (patch) | |
tree | 32551417d79c0bf387eeb3e3d9e214d5d3c8ac36 /libavcodec/zerocodec.c | |
parent | fe3808eddee81ce4712d1e729fa6fe619f1685c8 (diff) | |
parent | 3c8ea9d4a74fd4d7493d40c818ca64ee492709f3 (diff) | |
download | ffmpeg-8af7774c7aca6f3b595d0417b92f543ce0c7b537.tar.gz |
Merge commit '3c8ea9d4a74fd4d7493d40c818ca64ee492709f3'
* commit '3c8ea9d4a74fd4d7493d40c818ca64ee492709f3':
vmnc: use the AVFrame API properly.
xan: use the AVFrame API properly.
xxan: use the AVFrame API properly.
zerocodec: use the AVFrame API properly.
Conflicts:
libavcodec/vmnc.c
libavcodec/xan.c
libavcodec/xxan.c
See: cf5ab8b6f71699a48a6384d5e5779630b4be7b56
See: ad438f450b83882a1277a79c1c3d6dfe55573b1c
See: 67607e20e882eb5639a4e9099caecb52a863ab68
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/zerocodec.c')
-rw-r--r-- | libavcodec/zerocodec.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 80264b34d6..9f6c37c02a 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -23,7 +23,7 @@ #include "libavutil/common.h" typedef struct { - AVFrame previous_frame; + AVFrame *previous_frame; z_stream zstream; } ZeroCodecContext; @@ -32,7 +32,7 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, { 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; @@ -91,8 +91,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, 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; @@ -104,7 +104,7 @@ static av_cold int zerocodec_decode_close(AVCodecContext *avctx) { ZeroCodecContext *zc = avctx->priv_data; - av_frame_unref(&zc->previous_frame); + av_frame_free(&zc->previous_frame); inflateEnd(&zc->zstream); @@ -130,6 +130,12 @@ static av_cold int zerocodec_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } + zc->previous_frame = av_frame_alloc(); + if (!zc->previous_frame) { + zerocodec_decode_close(avctx); + return AVERROR(ENOMEM); + } + return 0; } |