diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-11-09 10:14:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-11-16 13:29:24 +0100 |
commit | 32f7cf9bc38abbdca6f2d7c2e8c37c01f843ecab (patch) | |
tree | c52b058bd758f35b35b57f5eac301f66f651fb73 /libavcodec/truemotion2.c | |
parent | 42d40fd28cea925a87c8ad2d34e9c2e2c1821171 (diff) | |
download | ffmpeg-32f7cf9bc38abbdca6f2d7c2e8c37c01f843ecab.tar.gz |
truemotion2: use the AVFrame API properly.
Diffstat (limited to 'libavcodec/truemotion2.c')
-rw-r--r-- | libavcodec/truemotion2.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 5d9408d166..e41d7a39e3 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -58,7 +58,7 @@ enum TM2_BLOCKS { typedef struct TM2Context { AVCodecContext *avctx; - AVFrame pic; + AVFrame *pic; GetBitContext gb; DSPContext dsp; @@ -838,7 +838,7 @@ static int decode_frame(AVCodecContext *avctx, TM2Context * const l = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size & ~3; - AVFrame * const p = &l->pic; + AVFrame * const p = l->pic; int offset = TM2_HEADER_SIZE; int i, t, ret; uint8_t *swbuf; @@ -883,7 +883,7 @@ static int decode_frame(AVCodecContext *avctx, l->cur = !l->cur; *got_frame = 1; - ret = av_frame_ref(data, &l->pic); + ret = av_frame_ref(data, l->pic); av_free(swbuf); return (ret < 0) ? ret : buf_size; @@ -900,9 +900,12 @@ static av_cold int decode_init(AVCodecContext *avctx) } l->avctx = avctx; - avcodec_get_frame_defaults(&l->pic); avctx->pix_fmt = AV_PIX_FMT_BGR24; + l->pic = av_frame_alloc(); + if (!l->pic) + return AVERROR(ENOMEM); + ff_dsputil_init(&l->dsp, avctx); l->last = av_malloc(4 * sizeof(*l->last) * (w >> 2)); @@ -952,7 +955,6 @@ static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx) { TM2Context * const l = avctx->priv_data; - AVFrame *pic = &l->pic; int i; av_free(l->last); @@ -968,7 +970,7 @@ static av_cold int decode_end(AVCodecContext *avctx) av_free(l->V2_base); } - av_frame_unref(pic); + av_frame_free(&l->pic); return 0; } |