[Scummvm-cvs-logs] SF.net SVN: scummvm:[55502] scummvm/trunk/video

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Jan 24 15:09:47 CET 2011


Revision: 55502
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55502&view=rev
Author:   drmccoy
Date:     2011-01-24 14:09:47 +0000 (Mon, 24 Jan 2011)

Log Message:
-----------
VIDEO: Don't fill empty sound slices at the end

Modified Paths:
--------------
    scummvm/trunk/video/coktel_decoder.cpp
    scummvm/trunk/video/coktel_decoder.h

Modified: scummvm/trunk/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/video/coktel_decoder.cpp	2011-01-24 14:00:55 UTC (rev 55501)
+++ scummvm/trunk/video/coktel_decoder.cpp	2011-01-24 14:09:47 UTC (rev 55502)
@@ -220,6 +220,14 @@
 	_audioStream = 0;
 }
 
+void CoktelDecoder::finishSound() {
+	if (!_audioStream)
+		return;
+
+	_audioStream->finish();
+	_soundStage = kSoundFinished;
+}
+
 void CoktelDecoder::colorModeChanged() {
 }
 
@@ -1531,9 +1539,10 @@
 	_stream(0), _version(0), _flags(0), _frameInfoOffset(0), _partsPerFrame(0), _frames(0),
 	_soundFlags(0), _soundFreq(0), _soundSliceSize(0), _soundSlicesCount(0),
 	_soundBytesPerSample(0), _soundStereo(0), _soundHeaderSize(0), _soundDataSize(0),
-	_audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0),
-	_blitMode(0), _bytesPerPixel(0), _firstFramePos(0), _videoBufferSize(0),
-	_externalCodec(false), _codec(0), _subtitle(-1), _isPaletted(true) {
+	_soundLastFilledFrame(0), _audioFormat(kAudioFormat8bitRaw),
+	_hasVideo(false), _videoCodec(0), _blitMode(0), _bytesPerPixel(0),
+	_firstFramePos(0), _videoBufferSize(0), _externalCodec(false), _codec(0),
+	_subtitle(-1), _isPaletted(true) {
 
 	_videoBuffer   [0] = 0;
 	_videoBuffer   [1] = 0;
@@ -1896,6 +1905,7 @@
 		_frames[i].offset = _stream->readUint32LE();
 	}
 
+	_soundLastFilledFrame = 0;
 	for (uint16 i = 0; i < _frameCount; i++) {
 		bool separator = false;
 
@@ -1910,6 +1920,9 @@
 				_frames[i].parts[j].flags = _stream->readByte();
 				_stream->skip(9); // Unknown
 
+				if (_frames[i].parts[j].flags != 3)
+					_soundLastFilledFrame = i;
+
 			} else if (_frames[i].parts[j].type == kPartTypeVideo) {
 
 				_frames[i].parts[j].left    = _stream->readUint16LE();
@@ -2006,15 +2019,16 @@
 	_partsPerFrame   = 0;
 	_frames          = 0;
 
-	_soundFlags          = 0;
-	_soundFreq           = 0;
-	_soundSliceSize      = 0;
-	_soundSlicesCount    = 0;
-	_soundBytesPerSample = 0;
-	_soundStereo         = 0;
-	_soundHeaderSize     = 0;
-	_soundDataSize       = 0;
-	_audioFormat         = kAudioFormat8bitRaw;
+	_soundFlags           = 0;
+	_soundFreq            = 0;
+	_soundSliceSize       = 0;
+	_soundSlicesCount     = 0;
+	_soundBytesPerSample  = 0;
+	_soundStereo          = 0;
+	_soundHeaderSize      = 0;
+	_soundDataSize        = 0;
+	_soundLastFilledFrame = 0;
+	_audioFormat          = kAudioFormat8bitRaw;
 
 	_hasVideo      = false;
 	_videoCodec    = 0;
@@ -2101,7 +2115,8 @@
 				// Empty sound slice
 
 				if (_soundEnabled) {
-					emptySoundSlice(_soundDataSize * _soundBytesPerSample);
+					if ((uint32)_curFrame < _soundLastFilledFrame)
+						emptySoundSlice(_soundDataSize * _soundBytesPerSample);
 
 					if (_soundStage == kSoundLoaded)
 						startSound = true;

Modified: scummvm/trunk/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/video/coktel_decoder.h	2011-01-24 14:00:55 UTC (rev 55501)
+++ scummvm/trunk/video/coktel_decoder.h	2011-01-24 14:09:47 UTC (rev 55502)
@@ -105,6 +105,7 @@
 
 	void enableSound();
 	void disableSound();
+	void finishSound();
 
 	virtual void colorModeChanged();
 
@@ -453,6 +454,7 @@
 	byte   _soundStereo; // (0: mono, 1: old-style stereo, 2: new-style stereo)
 	uint32 _soundHeaderSize;
 	uint32 _soundDataSize;
+	uint32 _soundLastFilledFrame;
 	AudioFormat _audioFormat;
 
 	// Video properties


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list