aboutsummaryrefslogtreecommitdiff
path: root/sound/flac.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-01 22:57:08 +0000
committerJohannes Schickel2010-01-01 22:57:08 +0000
commit137744c40c5e5ab717c364a113cf5e83ca104663 (patch)
tree7e3d89e60f2f3195cf38214b13411f20c2eeb84d /sound/flac.cpp
parent2e9d5a5f41636054f57b4a90b3f9165902963c3c (diff)
downloadscummvm-rg350-137744c40c5e5ab717c364a113cf5e83ca104663.tar.gz
scummvm-rg350-137744c40c5e5ab717c364a113cf5e83ca104663.tar.bz2
scummvm-rg350-137744c40c5e5ab717c364a113cf5e83ca104663.zip
This time properly fix getTotalPlayTime for looped FLAC, MP3 and VORBIS audio streams.
svn-id: r46863
Diffstat (limited to 'sound/flac.cpp')
-rw-r--r--sound/flac.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp
index d06402e192..8699e8cfce 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -379,13 +379,11 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) {
if (state == FLAC__STREAM_DECODER_END_OF_STREAM) {
_lastSampleWritten = true;
+ ++_numPlayedLoops;
}
// If we reached the end of the stream, and looping is enabled: Try to rewind
- if (_lastSampleWritten && _numLoops != 1) {
- if (_numLoops != 0)
- _numLoops--;
- _numPlayedLoops++;
+ if (_lastSampleWritten && (!_numLoops || _numPlayedLoops < _numLoops)) {
seekAbsolute(_firstSample);
state = getStreamDecoderState();
}