[FFmpeg-cvslog] r12326 - trunk/libavcodec/xan.c

melanson subversion
Wed Mar 5 07:58:21 CET 2008


Author: melanson
Date: Wed Mar  5 07:58:20 2008
New Revision: 12326

Log:
fix the WC3 Xan decoder by correcting the frame accounting logic


Modified:
   trunk/libavcodec/xan.c

Modified: trunk/libavcodec/xan.c
==============================================================================
--- trunk/libavcodec/xan.c	(original)
+++ trunk/libavcodec/xan.c	Wed Mar  5 07:58:20 2008
@@ -435,12 +435,12 @@ static int xan_decode_frame(AVCodecConte
     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
 {
     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);




More information about the ffmpeg-cvslog mailing list