aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-08-27 11:09:38 -0400
committerMatthew Hoops2012-08-27 11:10:05 -0400
commit6f105e62302b01db9b8d0bea14235d6e2c5932ba (patch)
tree66ab902a9a510869e96c4ea584fdc45e9d320f0f
parente96249a105b36f79656e4b75cd17fd88a9b69ba9 (diff)
downloadscummvm-rg350-6f105e62302b01db9b8d0bea14235d6e2c5932ba.tar.gz
scummvm-rg350-6f105e62302b01db9b8d0bea14235d6e2c5932ba.tar.bz2
scummvm-rg350-6f105e62302b01db9b8d0bea14235d6e2c5932ba.zip
VIDEO: Fix "empty" AVI frames
-rw-r--r--video/avi_decoder.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 09b95d38ad..0d51f5b130 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -330,19 +330,25 @@ void AVIDecoder::readNextPacket() {
error("Cannot get track from tag '%s'", tag2str(nextTag));
uint32 chunkSize = _fileStream->readUint32LE();
- Common::SeekableReadStream *chunk = _fileStream->readStream(chunkSize);
- _fileStream->skip(chunkSize & 1);
+ Common::SeekableReadStream *chunk = 0;
+
+ if (chunkSize != 0) {
+ chunk = _fileStream->readStream(chunkSize);
+ _fileStream->skip(chunkSize & 1);
+ }
if (track->getTrackType() == Track::kTrackTypeAudio) {
if (getStreamType(nextTag) != MKTAG16('w', 'b'))
error("Invalid audio track tag '%s'", tag2str(nextTag));
+ assert(chunk);
((AVIAudioTrack *)track)->queueSound(chunk);
} else {
AVIVideoTrack *videoTrack = (AVIVideoTrack *)track;
if (getStreamType(nextTag) == MKTAG16('p', 'c')) {
// Palette Change
+ assert(chunk);
byte firstEntry = chunk->readByte();
uint16 numEntries = chunk->readByte();
chunk->readUint16LE(); // Reserved
@@ -387,8 +393,13 @@ AVIDecoder::AVIVideoTrack::~AVIVideoTrack() {
}
void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream *stream) {
- if (_videoCodec)
- _lastFrame = _videoCodec->decodeImage(stream);
+ if (stream) {
+ if (_videoCodec)
+ _lastFrame = _videoCodec->decodeImage(stream);
+ } else {
+ // Empty frame
+ _lastFrame = 0;
+ }
delete stream;
_curFrame++;