diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 01:36:26 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 01:38:41 +0100 |
commit | 9f890a165666a73376c73b3c2bd920345b5c3b79 (patch) | |
tree | c458e2bc9350fd0be13b249b63bd319330870e0f /libavcodec/msrle.c | |
parent | 10ac6f3ce9ae4065a5b72ddfaded45f75b357518 (diff) | |
parent | 2e09096da912f563c4dd889a8f25c314529bbaa6 (diff) | |
download | ffmpeg-9f890a165666a73376c73b3c2bd920345b5c3b79.tar.gz |
Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6'
* commit '2e09096da912f563c4dd889a8f25c314529bbaa6':
kgv1: use the AVFrame API properly.
indeo2: use the AVFrame API properly.
iff: use the AVFrame API properly.
msrle: use the AVFrame API properly.
Conflicts:
libavcodec/iff.c
libavcodec/indeo2.c
libavcodec/kgv1dec.c
libavcodec/msrle.c
See: 451b2ca1b4349f9b60416cc057eaf5518d81025c
See: 80e9e63c946660304fc65fa8141ccfdbe4d196d1
See: 057dce5f21cd70db1ef6e3b67644a39f0d51aba5
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/msrle.c')
-rw-r--r-- | libavcodec/msrle.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 2b4ab1a6a5..2836fec2fd 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -38,7 +38,7 @@ typedef struct MsrleContext { AVCodecContext *avctx; - AVFrame frame; + AVFrame *frame; GetByteContext gb; const unsigned char *buf; @@ -70,7 +70,9 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - avcodec_get_frame_defaults(&s->frame); + s->frame = av_frame_alloc(); + if (!s->frame) + return AVERROR(ENOMEM); if (avctx->extradata_size >= 4) for (i = 0; i < FFMIN(avctx->extradata_size, AVPALETTE_SIZE)/4; i++) @@ -92,24 +94,24 @@ static int msrle_decode_frame(AVCodecContext *avctx, s->buf = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { - s->frame.palette_has_changed = 1; + s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } /* make the palette available */ - memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); + memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; - uint8_t *ptr = s->frame.data[0]; + uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; @@ -125,14 +127,14 @@ static int msrle_decode_frame(AVCodecContext *avctx, memcpy(ptr, buf, linesize); } buf -= istride; - ptr += s->frame.linesize[0]; + ptr += s->frame->linesize[0]; } } else { bytestream2_init(&s->gb, buf, buf_size); - ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, &s->gb); + ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); } - if ((ret = av_frame_ref(data, &s->frame)) < 0) + if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; @@ -146,7 +148,7 @@ static av_cold int msrle_decode_end(AVCodecContext *avctx) MsrleContext *s = avctx->priv_data; /* release the last frame */ - av_frame_unref(&s->frame); + av_frame_free(&s->frame); return 0; } |