From b6fb8b349a3260e8e3377366ccda45fc3b8c869e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 6 Jan 2010 20:25:19 +0000 Subject: Fix FLAC's getLength implementation. svn-id: r47093 --- sound/flac.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') 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; -- cgit v1.2.3