diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-21 21:34:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-03-08 07:38:30 +0100 |
commit | 759001c534287a96dc96d1e274665feb7059145d (patch) | |
tree | 6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/rl2.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/rl2.c')
-rw-r--r-- | libavcodec/rl2.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index 9973c28736..4f68f7e997 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -41,7 +41,6 @@ typedef struct Rl2Context { AVCodecContext *avctx; - AVFrame frame; uint16_t video_base; ///< initial drawing offset uint32_t clr_count; ///< number of used colors (currently unused) @@ -177,29 +176,24 @@ static int rl2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int ret, buf_size = avpkt->size; Rl2Context *s = avctx->priv_data; - if (s->frame.data[0]) - avctx->release_buffer(avctx, &s->frame); - - /** get buffer */ - s->frame.reference = 0; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } /** run length decode */ - rl2_rle_decode(s, buf, buf_size, s->frame.data[0], s->frame.linesize[0], + rl2_rle_decode(s, buf, buf_size, frame->data[0], frame->linesize[0], s->video_base); /** make the palette available on the way out */ - memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + memcpy(frame->data[1], s->palette, AVPALETTE_SIZE); *got_frame = 1; - *(AVFrame*)data = s->frame; /** report that the buffer was completely consumed */ return buf_size; @@ -215,9 +209,6 @@ static av_cold int rl2_decode_end(AVCodecContext *avctx) { Rl2Context *s = avctx->priv_data; - if (s->frame.data[0]) - avctx->release_buffer(avctx, &s->frame); - av_free(s->back_frame); return 0; |