typedef struct Msvideo1Context {
AVCodecContext *avctx;
- AVFrame frame;
+ AVFrame *frame;
const unsigned char *buf;
int size;
avctx->pix_fmt = AV_PIX_FMT_RGB555;
}
- avcodec_get_frame_defaults(&s->frame);
+ s->frame = av_frame_alloc();
+ if (!s->frame)
+ return AVERROR(ENOMEM);
return 0;
}
unsigned short flags;
int skip_blocks;
unsigned char colors[8];
- unsigned char *pixels = s->frame.data[0];
- int stride = s->frame.linesize[0];
+ unsigned char *pixels = s->frame->data[0];
+ int stride = s->frame->linesize[0];
stream_ptr = 0;
skip_blocks = 0;
/* make the palette available on the way out */
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
- memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
+ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
}
static void msvideo1_decode_16bit(Msvideo1Context *s)
unsigned short flags;
int skip_blocks;
unsigned short colors[8];
- unsigned short *pixels = (unsigned short *)s->frame.data[0];
- int stride = s->frame.linesize[0] / 2;
+ unsigned short *pixels = (unsigned short *)s->frame->data[0];
+ int stride = s->frame->linesize[0] / 2;
stream_ptr = 0;
skip_blocks = 0;
s->buf = buf;
s->size = buf_size;
- if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
}
if (pal) {
memcpy(s->pal, pal, AVPALETTE_SIZE);
- s->frame.palette_has_changed = 1;
+ s->frame->palette_has_changed = 1;
}
}
else
msvideo1_decode_16bit(s);
- if ((ret = av_frame_ref(data, &s->frame)) < 0)
+ if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
*got_frame = 1;
{
Msvideo1Context *s = avctx->priv_data;
- av_frame_unref(&s->frame);
+ av_frame_free(&s->frame);
return 0;
}