diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 12:33:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 12:33:27 +0100 |
commit | a0c0629dd963b00f989172f0c599353b6b288c37 (patch) | |
tree | 9948f38dd870d440db9ac10f98bbf1275282b056 /libavcodec/eatgv.c | |
parent | 5b0c70c2499e20529d517b712910d6f4f72e9485 (diff) | |
parent | 97168b204a0b6b79bb6c5f0d40efdf7fc2262476 (diff) | |
download | ffmpeg-a0c0629dd963b00f989172f0c599353b6b288c37.tar.gz |
Merge commit '97168b204a0b6b79bb6c5f0d40efdf7fc2262476'
* commit '97168b204a0b6b79bb6c5f0d40efdf7fc2262476':
eatgv: use the AVFrame API properly.
libxavs: use the AVFrame API properly.
nuv: use the AVFrame API properly.
flashsvenc: use the AVFrame API properly.
Conflicts:
libavcodec/eatgv.c
libavcodec/nuv.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/eatgv.c')
-rw-r--r-- | libavcodec/eatgv.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 6664cdb0f4..9344b0ff9f 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -40,7 +40,7 @@ typedef struct TgvContext { AVCodecContext *avctx; - AVFrame last_frame; + AVFrame *last_frame; uint8_t *frame_buffer; int width,height; uint32_t palette[AVPALETTE_COUNT]; @@ -57,7 +57,11 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->time_base = (AVRational){1, 15}; avctx->pix_fmt = AV_PIX_FMT_PAL8; - avcodec_get_frame_defaults(&s->last_frame); + + s->last_frame = av_frame_alloc(); + if (!s->last_frame) + return AVERROR(ENOMEM); + return 0; } @@ -232,8 +236,8 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame, continue; } - src = s->last_frame.data[0] + mx + my * s->last_frame.linesize[0]; - src_stride = s->last_frame.linesize[0]; + src = s->last_frame->data[0] + mx + my * s->last_frame->linesize[0]; + src_stride = s->last_frame->linesize[0]; } else { int offset = vector - num_mvs; if (offset < num_blocks_raw) @@ -282,7 +286,7 @@ static int tgv_decode_frame(AVCodecContext *avctx, s->height = AV_RL16(&buf[2]); if (s->avctx->width != s->width || s->avctx->height != s->height) { av_freep(&s->frame_buffer); - av_frame_unref(&s->last_frame); + av_frame_unref(s->last_frame); if ((ret = ff_set_dimensions(s->avctx, s->width, s->height)) < 0) return ret; } @@ -318,7 +322,7 @@ static int tgv_decode_frame(AVCodecContext *avctx, s->frame_buffer + y * s->width, s->width); } else { - if (!s->last_frame.data[0]) { + if (!s->last_frame->data[0]) { av_log(avctx, AV_LOG_WARNING, "inter frame without corresponding intra frame\n"); return buf_size; } @@ -330,8 +334,8 @@ static int tgv_decode_frame(AVCodecContext *avctx, } } - av_frame_unref(&s->last_frame); - if ((ret = av_frame_ref(&s->last_frame, frame)) < 0) + av_frame_unref(s->last_frame); + if ((ret = av_frame_ref(s->last_frame, frame)) < 0) return ret; *got_frame = 1; @@ -342,7 +346,7 @@ static int tgv_decode_frame(AVCodecContext *avctx, static av_cold int tgv_decode_end(AVCodecContext *avctx) { TgvContext *s = avctx->priv_data; - av_frame_unref(&s->last_frame); + av_frame_free(&s->last_frame); av_freep(&s->frame_buffer); av_free(s->mv_codebook); av_free(s->block_codebook); |