From 759001c534287a96dc96d1e274665feb7059145d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 21 Nov 2012 21:34:46 +0100 Subject: lavc decoders: work with refcounted frames. --- libavcodec/bmp.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'libavcodec/bmp.c') diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 5ca73baa4f..899fc8a1dc 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -25,25 +25,13 @@ #include "internal.h" #include "msrledec.h" -static av_cold int bmp_decode_init(AVCodecContext *avctx) -{ - BMPContext *s = avctx->priv_data; - - avcodec_get_frame_defaults(&s->picture); - avctx->coded_frame = &s->picture; - - return 0; -} - static int bmp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - BMPContext *s = avctx->priv_data; - AVFrame *picture = data; - AVFrame *p = &s->picture; + AVFrame *p = data; unsigned int fsize, hsize; int width, height; unsigned int depth; @@ -205,11 +193,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if (p->data[0]) - avctx->release_buffer(avctx, p); - - p->reference = 0; - if ((ret = ff_get_buffer(avctx, p)) < 0) { + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -350,29 +334,15 @@ static int bmp_decode_frame(AVCodecContext *avctx, } } - *picture = s->picture; *got_frame = 1; return buf_size; } -static av_cold int bmp_decode_end(AVCodecContext *avctx) -{ - BMPContext* c = avctx->priv_data; - - if (c->picture.data[0]) - avctx->release_buffer(avctx, &c->picture); - - return 0; -} - AVCodec ff_bmp_decoder = { .name = "bmp", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_BMP, - .priv_data_size = sizeof(BMPContext), - .init = bmp_decode_init, - .close = bmp_decode_end, .decode = bmp_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), -- cgit v1.2.3