aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-06 20:25:19 +0000
committerJohannes Schickel2010-01-06 20:25:19 +0000
commitb6fb8b349a3260e8e3377366ccda45fc3b8c869e (patch)
treefacadec9b892fa8d406c122fe9f124ed1c334837
parentb6b8a23cee82a7011b4007fa1506d42e64e0c284 (diff)
downloadscummvm-rg350-b6fb8b349a3260e8e3377366ccda45fc3b8c869e.tar.gz
scummvm-rg350-b6fb8b349a3260e8e3377366ccda45fc3b8c869e.tar.bz2
scummvm-rg350-b6fb8b349a3260e8e3377366ccda45fc3b8c869e.zip
Fix FLAC's getLength implementation.
svn-id: r47093
-rw-r--r--sound/flac.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp
index b592468baf..d907137e8c 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -95,7 +95,7 @@ protected:
/** index of the first sample to be played */
FLAC__uint64 _firstSample;
- /** index + 1(!) of the last sample to be played - 0 is end of stream */
+ /** index + 1(!) of the last sample to be played */
FLAC__uint64 _lastSample;
/** total play time */
@@ -247,7 +247,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp
// Compute the start/end sample (we use floating point arithmetics here to
// avoid overflows).
_firstSample = (FLAC__uint64)(startTime * (_streaminfo.sample_rate / 1000.0));
- _lastSample = (FLAC__uint64)(endTime * (_streaminfo.sample_rate / 1000.0));
+ _lastSample = !endTime ? _streaminfo.total_samples + 1 : (FLAC__uint64)(endTime * (_streaminfo.sample_rate / 1000.0));
if (_firstSample == 0 || seekAbsolute(_firstSample)) {
int32 samples = -1;