diff options
Diffstat (limited to 'libavcodec/vb.c')
-rw-r--r-- | libavcodec/vb.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/libavcodec/vb.c b/libavcodec/vb.c index 3b5a83be17..ebb06f522f 100644 --- a/libavcodec/vb.c +++ b/libavcodec/vb.c @@ -41,7 +41,6 @@ enum VBFlags { typedef struct VBDecContext { AVCodecContext *avctx; - AVFrame pic; uint8_t *frame, *prev_frame; uint32_t pal[AVPALETTE_COUNT]; @@ -189,6 +188,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { VBDecContext * const c = avctx->priv_data; + AVFrame *frame = data; uint8_t *outptr, *srcptr; int i, j, ret; int flags; @@ -197,10 +197,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, bytestream2_init(&c->stream, avpkt->data, avpkt->size); - if (c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); - c->pic.reference = 3; - if ((ret = ff_get_buffer(avctx, &c->pic)) < 0) { + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -226,22 +223,21 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, vb_decode_palette(c, size); } - memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); - c->pic.palette_has_changed = flags & VB_HAS_PALETTE; + memcpy(frame->data[1], c->pal, AVPALETTE_SIZE); + frame->palette_has_changed = flags & VB_HAS_PALETTE; - outptr = c->pic.data[0]; + outptr = frame->data[0]; srcptr = c->frame; for (i = 0; i < avctx->height; i++) { memcpy(outptr, srcptr, avctx->width); srcptr += avctx->width; - outptr += c->pic.linesize[0]; + outptr += frame->linesize[0]; } FFSWAP(uint8_t*, c->frame, c->prev_frame); *got_frame = 1; - *(AVFrame*)data = c->pic; /* always report that the buffer was completely consumed */ return avpkt->size; @@ -253,7 +249,6 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - avcodec_get_frame_defaults(&c->pic); c->frame = av_mallocz(avctx->width * avctx->height); c->prev_frame = av_mallocz(avctx->width * avctx->height); @@ -267,8 +262,6 @@ static av_cold int decode_end(AVCodecContext *avctx) av_freep(&c->frame); av_freep(&c->prev_frame); - if(c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); return 0; } |