---
libavcodec/zmbv.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 8e0db8b..2c9771f 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -54,7 +54,6 @@ enum ZmbvFormat {
*/
typedef struct ZmbvContext {
AVCodecContext *avctx;
- AVFrame pic;
int bpp;
unsigned int decomp_size;
@@ -400,6 +399,7 @@ static int zmbv_decode_intra(ZmbvContext *c)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
ZmbvContext * const c = avctx->priv_data;
@@ -408,12 +408,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
int hi_ver, lo_ver, ret;
uint8_t *tmp;
- if (c->pic.data[0])
- avctx->release_buffer(avctx, &c->pic);
-
- c->pic.reference = 1;
- c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- 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;
}
@@ -522,12 +517,12 @@ static int decode_frame(AVCodecContext *avctx, void
*data, int *got_frame, AVPac
c->decomp_len = c->zstream.total_out;
}
if (c->flags & ZMBV_KEYFRAME) {
- c->pic.key_frame = 1;
- c->pic.pict_type = AV_PICTURE_TYPE_I;
+ frame->key_frame = 1;
+ frame->pict_type = AV_PICTURE_TYPE_I;
c->decode_intra(c);
} else {
- c->pic.key_frame = 0;
- c->pic.pict_type = AV_PICTURE_TYPE_P;
+ frame->key_frame = 0;
+ frame->pict_type = AV_PICTURE_TYPE_P;
if (c->decomp_len)
c->decode_xor(c);
}
@@ -537,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
uint8_t *out, *src;
int i, j;
- out = c->pic.data[0];
+ out = frame->data[0];
src = c->cur;
switch (c->fmt) {
case ZMBV_FMT_8BPP:
@@ -548,7 +543,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
out[i * 3 + 2] = c->pal[(*src) * 3 + 2];
src++;
}
- out += c->pic.linesize[0];
+ out += frame->linesize[0];
}
break;
case ZMBV_FMT_15BPP:
@@ -560,7 +555,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
out[i * 3 + 1] = (tmp & 0x03E0) >> 2;
out[i * 3 + 2] = (tmp & 0x001F) << 3;
}
- out += c->pic.linesize[0];
+ out += frame->linesize[0];
}
break;
case ZMBV_FMT_16BPP:
@@ -572,7 +567,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
out[i * 3 + 1] = (tmp & 0x07E0) >> 3;
out[i * 3 + 2] = (tmp & 0x001F) << 3;
}
- out += c->pic.linesize[0];
+ out += frame->linesize[0];
}
break;
#ifdef ZMBV_ENABLE_24BPP
@@ -580,7 +575,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
for (j = 0; j < c->height; j++) {
memcpy(out, src, c->width * 3);
src += c->width * 3;
- out += c->pic.linesize[0];
+ out += frame->linesize[0];
}
break;
#endif //ZMBV_ENABLE_24BPP
@@ -591,7 +586,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
src += 4;
AV_WB24(out+(i*3), tmp);
}
- out += c->pic.linesize[0];
+ out += frame->linesize[0];
}
break;
default:
@@ -600,7 +595,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPac
FFSWAP(uint8_t *, c->cur, c->prev);
}
*got_frame = 1;
- *(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
return buf_size;
@@ -651,8 +645,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
av_freep(&c->decomp_buf);
- if (c->pic.data[0])
- avctx->release_buffer(avctx, &c->pic);
inflateEnd(&c->zstream);
av_freep(&c->cur);
av_freep(&c->prev);
--
1.7.10.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel