[Scummvm-cvs-logs] scummvm master -> 6f105e62302b01db9b8d0bea14235d6e2c5932ba

clone2727 clone2727 at gmail.com
Mon Aug 27 17:11:00 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6f105e6230 VIDEO: Fix "empty" AVI frames


Commit: 6f105e62302b01db9b8d0bea14235d6e2c5932ba
    https://github.com/scummvm/scummvm/commit/6f105e62302b01db9b8d0bea14235d6e2c5932ba
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-08-27T08:10:05-07:00

Commit Message:
VIDEO: Fix "empty" AVI frames

Changed paths:
    video/avi_decoder.cpp



diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 09b95d3..0d51f5b 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++;






More information about the Scummvm-git-logs mailing list