aboutsummaryrefslogtreecommitdiff
path: root/sound/flac.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-05 20:14:28 +0000
committerJohannes Schickel2010-01-05 20:14:28 +0000
commit920dac2f9d271889ffdc6c05313c89a6077ec2d2 (patch)
tree5ca24942081a5171605aea463febd5a06860d5ac /sound/flac.cpp
parente9a94ecb9b6eb20cb7cdc4f838df3f9b049d2de6 (diff)
downloadscummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.tar.gz
scummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.tar.bz2
scummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.zip
Remove unsafe getTotalPlayTime from AudioStream.
svn-id: r47037
Diffstat (limited to 'sound/flac.cpp')
-rw-r--r--sound/flac.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp
index b99f8bb484..0310754374 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -143,12 +143,6 @@ public:
return _streaminfo.channels == 0 || (_lastSampleWritten && _sampleCache.bufFill == 0);
}
- int32 getTotalPlayTime() const {
- if (!_numLoops)
- return kUnknownPlayTime;
- return _totalPlayTime * _numLoops;
- }
-
bool seek(const Timestamp &where);
// TODO: We can definitly increase the precision here, since FLAC allows us to catch the sample count
Timestamp getLength() const { return Timestamp(_totalPlayTime, getRate()); }
@@ -256,7 +250,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp
_lastSample = (FLAC__uint64)(endTime * (_streaminfo.sample_rate / 1000.0));
if (_firstSample == 0 || seekAbsolute(_firstSample)) {
- int32 samples = kUnknownPlayTime;
+ int32 samples = -1;
if (!_lastSample) {
if (_streaminfo.total_samples)
@@ -265,7 +259,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp
samples = _lastSample - _firstSample - 1;
}
- if (samples != kUnknownPlayTime && samples >= 0 && numLoops) {
+ if (samples != -1 && samples >= 0 && numLoops) {
const int32 rate = _streaminfo.sample_rate;
int32 seconds = samples / rate;
@@ -273,7 +267,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp
_totalPlayTime = (seconds * 1000 + milliseconds);
} else {
- _totalPlayTime = kUnknownPlayTime;
+ _totalPlayTime = 0;
}
return; // no error occured