Mercurial > libavcodec.hg
comparison xan.c @ 6452:2a2f9cb7f1b0 libavcodec
fix the WC3 Xan decoder by correcting the frame accounting logic
author | melanson |
---|---|
date | Wed, 05 Mar 2008 06:58:20 +0000 |
parents | d78e2ce9b088 |
children | 48759bfbd073 |
comparison
equal
deleted
inserted
replaced
6451:355b2eb9f553 | 6452:2a2f9cb7f1b0 |
---|---|
433 | 433 |
434 /* release the last frame if it is allocated */ | 434 /* release the last frame if it is allocated */ |
435 if (s->last_frame.data[0]) | 435 if (s->last_frame.data[0]) |
436 avctx->release_buffer(avctx, &s->last_frame); | 436 avctx->release_buffer(avctx, &s->last_frame); |
437 | 437 |
438 /* shuffle frames */ | |
439 s->last_frame = s->current_frame; | |
440 | |
441 *data_size = sizeof(AVFrame); | 438 *data_size = sizeof(AVFrame); |
442 *(AVFrame*)data = s->current_frame; | 439 *(AVFrame*)data = s->current_frame; |
443 | 440 |
441 /* shuffle frames */ | |
442 FFSWAP(AVFrame, s->current_frame, s->last_frame); | |
443 | |
444 /* always report that the buffer was completely consumed */ | 444 /* always report that the buffer was completely consumed */ |
445 return buf_size; | 445 return buf_size; |
446 } | 446 } |
447 | 447 |
448 static int xan_decode_end(AVCodecContext *avctx) | 448 static int xan_decode_end(AVCodecContext *avctx) |
449 { | 449 { |
450 XanContext *s = avctx->priv_data; | 450 XanContext *s = avctx->priv_data; |
451 | 451 |
452 /* release the last frame */ | 452 /* release the frames */ |
453 if (s->last_frame.data[0]) | 453 if (s->last_frame.data[0]) |
454 avctx->release_buffer(avctx, &s->last_frame); | 454 avctx->release_buffer(avctx, &s->last_frame); |
455 if (s->current_frame.data[0]) | |
456 avctx->release_buffer(avctx, &s->current_frame); | |
455 | 457 |
456 av_free(s->buffer1); | 458 av_free(s->buffer1); |
457 av_free(s->buffer2); | 459 av_free(s->buffer2); |
458 | 460 |
459 return 0; | 461 return 0; |