]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
fix the WC3 Xan decoder by correcting the frame accounting logic
authormelanson <melanson@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 5 Mar 2008 06:58:20 +0000 (06:58 +0000)
committermelanson <melanson@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 5 Mar 2008 06:58:20 +0000 (06:58 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12326 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/xan.c

index 27fc16488a8d31e070e2e0bb7107f828b25b254c..8dad6e83f9f45024084be13f744611c61bd3f64d 100644 (file)
@@ -435,12 +435,12 @@ static int xan_decode_frame(AVCodecContext *avctx,
     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;
 }
@@ -449,9 +449,11 @@ static 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);