aboutsummaryrefslogtreecommitdiff
path: root/sound/mp3.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-01 16:57:23 +0000
committerJohannes Schickel2010-01-01 16:57:23 +0000
commitbba2c8ce952b5242e3ff80054f1ac9cc48bcd097 (patch)
tree3a62d52c8ea2d92d7eefb9ed7e0a3698b4685f2b /sound/mp3.cpp
parent54d9bf4c57d265dd0d0539ed5eb0bfe324427ea7 (diff)
downloadscummvm-rg350-bba2c8ce952b5242e3ff80054f1ac9cc48bcd097.tar.gz
scummvm-rg350-bba2c8ce952b5242e3ff80054f1ac9cc48bcd097.tar.bz2
scummvm-rg350-bba2c8ce952b5242e3ff80054f1ac9cc48bcd097.zip
Fix getTotalPlayTime for MP3, FLAC, Vorbis and LinearMemoryStream after the latest loop related changes.
svn-id: r46838
Diffstat (limited to 'sound/mp3.cpp')
-rw-r--r--sound/mp3.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/mp3.cpp b/sound/mp3.cpp
index 02c6634999..6614dc944c 100644
--- a/sound/mp3.cpp
+++ b/sound/mp3.cpp
@@ -92,7 +92,11 @@ public:
bool endOfData() const { return _state == MP3_STATE_EOS; }
bool isStereo() const { return MAD_NCHANNELS(&_frame.header) == 2; }
int getRate() const { return _frame.header.samplerate; }
- int32 getTotalPlayTime() const { return _totalPlayTime; }
+ int32 getTotalPlayTime() const {
+ if (!_numLoops)
+ return kUnknownPlayTime;
+ return _totalPlayTime * _numLoops;
+ }
void setNumLoops(uint numLoops = 1) { _numLoops = numLoops; }
uint getNumPlayedLoops() { return _numPlayedLoops; }
@@ -182,9 +186,7 @@ MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, bool dispos
_totalPlayTime = mad_timer_count(length, MAD_UNITS_MILLISECONDS);
- if (numLoops && mad_timer_sign(length) >= 0)
- _totalPlayTime *= numLoops;
- else
+ if (mad_timer_sign(length) < 0)
_totalPlayTime = kUnknownPlayTime;
// Decode the first chunk of data. This is necessary so that _frame