} XanContext;
-static int xan_decode_init(AVCodecContext *avctx)
+static av_cold int xan_decode_init(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;
if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);
- /* shuffle frames */
- s->last_frame = s->current_frame;
-
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->current_frame;
+ /* shuffle frames */
+ FFSWAP(AVFrame, s->current_frame, s->last_frame);
+
/* always report that the buffer was completely consumed */
return buf_size;
}
-static int xan_decode_end(AVCodecContext *avctx)
+static av_cold int xan_decode_end(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;
- /* release the last frame */
+ /* release the frames */
if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);
+ if (s->current_frame.data[0])
+ avctx->release_buffer(avctx, &s->current_frame);
av_free(s->buffer1);
av_free(s->buffer2);
xan_decode_end,
xan_decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"),
};
/*