summaryrefslogtreecommitdiff
path: root/libavcodec/xfacedec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/xfacedec.c')
-rw-r--r--libavcodec/xfacedec.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/libavcodec/xfacedec.c b/libavcodec/xfacedec.c
index a2f8636cae..2711b129f0 100644
--- a/libavcodec/xfacedec.c
+++ b/libavcodec/xfacedec.c
@@ -87,7 +87,6 @@ static void decode_block(BigInt *b, char *bitmap, int w, int h, int level)
}
typedef struct XFaceContext {
- AVFrame frame;
uint8_t bitmap[XFACE_PIXELS]; ///< image used internally for decoding
} XFaceContext;
@@ -95,8 +94,6 @@ static av_cold int xface_decode_init(AVCodecContext *avctx)
{
XFaceContext *xface = avctx->priv_data;
- avcodec_get_frame_defaults(&xface->frame);
-
if (avctx->width || avctx->height) {
if (avctx->width != XFACE_WIDTH || avctx->height != XFACE_HEIGHT) {
av_log(avctx, AV_LOG_ERROR,
@@ -117,9 +114,6 @@ static av_cold int xface_decode_close(AVCodecContext *avctx)
{
XFaceContext *xface = avctx->priv_data;
- if (xface->frame.data[0])
- avctx->release_buffer(avctx, &xface->frame);
-
return 0;
}
@@ -133,13 +127,10 @@ static int xface_decode_frame(AVCodecContext *avctx,
BigInt b = {0};
char *buf;
int64_t c;
+ AVFrame *frame = data;
- if (xface->frame.data[0])
- avctx->release_buffer(avctx, &xface->frame);
- xface->frame.data[0] = NULL;
- if ((ret = ff_get_buffer(avctx, &xface->frame)) < 0)
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- xface->frame.reference = 0;
for (i = 0, k = 0; avpkt->data[i] && i < avpkt->size; i++) {
c = avpkt->data[i];
@@ -173,7 +164,7 @@ static int xface_decode_frame(AVCodecContext *avctx,
ff_xface_generate_face(xface->bitmap, xface->bitmap);
/* convert image from 1=black 0=white bitmap to MONOWHITE */
- buf = xface->frame.data[0];
+ buf = frame->data[0];
for (i = 0, j = 0, k = 0, byte = 0; i < XFACE_PIXELS; i++) {
byte += xface->bitmap[i];
if (k == 7) {
@@ -185,12 +176,11 @@ static int xface_decode_frame(AVCodecContext *avctx,
}
if (j == XFACE_WIDTH/8) {
j = 0;
- buf += xface->frame.linesize[0];
+ buf += frame->linesize[0];
}
}
*got_frame = 1;
- *(AVFrame*)data = xface->frame;
return avpkt->size;
}