[Scummvm-cvs-logs] SF.net SVN: scummvm: [30254] scummvm/trunk/sound/flac.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jan 5 21:40:27 CET 2008


Revision: 30254
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30254&view=rev
Author:   fingolfin
Date:     2008-01-05 12:40:27 -0800 (Sat, 05 Jan 2008)

Log Message:
-----------
This 'if' should not be necessary anymore

Modified Paths:
--------------
    scummvm/trunk/sound/flac.cpp

Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp	2008-01-05 20:38:26 UTC (rev 30253)
+++ scummvm/trunk/sound/flac.cpp	2008-01-05 20:40:27 UTC (rev 30254)
@@ -331,44 +331,42 @@
 
 	bool decoderOk = true;
 
-	if (!_lastSampleWritten) {
-		FLAC__StreamDecoderState state = getStreamDecoderState();
+	FLAC__StreamDecoderState state = getStreamDecoderState();
 
-		// Keep poking FLAC to process more samples until we completely satisfied the request
-		// respectively until we run out of data.
-		while (!_lastSampleWritten && _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) {
-			assert(_sampleCache.bufFill == 0);
-			assert(_requestedSamples % numChannels == 0);
-			processSingleBlock();
-			state = getStreamDecoderState();
-			
-			if (state == FLAC__STREAM_DECODER_END_OF_STREAM) {
-				_lastSampleWritten = true;
-			}
-
-			// If we reached the end of the stream, and looping is enabled: Try to rewind
-			if (_lastSampleWritten && _numLoops != 1) {
-				if (_numLoops != 0)
-					_numLoops--;
-				seekAbsolute(_firstSample);
-				state = getStreamDecoderState();
-			}
+	// Keep poking FLAC to process more samples until we completely satisfied the request
+	// respectively until we run out of data.
+	while (!_lastSampleWritten && _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) {
+		assert(_sampleCache.bufFill == 0);
+		assert(_requestedSamples % numChannels == 0);
+		processSingleBlock();
+		state = getStreamDecoderState();
+		
+		if (state == FLAC__STREAM_DECODER_END_OF_STREAM) {
+			_lastSampleWritten = true;
 		}
 
-		// Error handling
-		switch (state) {
-		case FLAC__STREAM_DECODER_END_OF_STREAM:
-			_lastSampleWritten = true;
-			break;
-		case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
-			break;
-		default:
-			decoderOk = false;
-			warning("FlacInputStream: An error occured while decoding. DecoderState is: %s",
-				FLAC__StreamDecoderStateString[getStreamDecoderState()]);
+		// If we reached the end of the stream, and looping is enabled: Try to rewind
+		if (_lastSampleWritten && _numLoops != 1) {
+			if (_numLoops != 0)
+				_numLoops--;
+			seekAbsolute(_firstSample);
+			state = getStreamDecoderState();
 		}
 	}
 
+	// Error handling
+	switch (state) {
+	case FLAC__STREAM_DECODER_END_OF_STREAM:
+		_lastSampleWritten = true;
+		break;
+	case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+		break;
+	default:
+		decoderOk = false;
+		warning("FlacInputStream: An error occured while decoding. DecoderState is: %s",
+			FLAC__StreamDecoderStateString[getStreamDecoderState()]);
+	}
+
 	// Compute how many samples we actually produced
 	const int samples = (int)(_outBuffer - buffer);
 	assert(samples % numChannels == 0);


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