Browse Source

fix the WC3 Xan decoder by correcting the frame accounting logic

Originally committed as revision 12326 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Mike Melanson 17 years ago
parent
commit
282ee4e766
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      libavcodec/xan.c

+ 6
- 4
libavcodec/xan.c View File

@@ -435,12 +435,12 @@ static int xan_decode_frame(AVCodecContext *avctx,
if (s->last_frame.data[0]) if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame); avctx->release_buffer(avctx, &s->last_frame);


/* shuffle frames */
s->last_frame = s->current_frame;

*data_size = sizeof(AVFrame); *data_size = sizeof(AVFrame);
*(AVFrame*)data = s->current_frame; *(AVFrame*)data = s->current_frame;


/* shuffle frames */
FFSWAP(AVFrame, s->current_frame, s->last_frame);

/* always report that the buffer was completely consumed */ /* always report that the buffer was completely consumed */
return buf_size; return buf_size;
} }
@@ -449,9 +449,11 @@ static int xan_decode_end(AVCodecContext *avctx)
{ {
XanContext *s = avctx->priv_data; XanContext *s = avctx->priv_data;


/* release the last frame */
/* release the frames */
if (s->last_frame.data[0]) if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame); 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->buffer1);
av_free(s->buffer2); av_free(s->buffer2);


Loading…
Cancel
Save