aboutsummaryrefslogtreecommitdiff
path: root/audio/decoders/adpcm_intern.h
diff options
context:
space:
mode:
authorD G Turner2012-08-04 20:29:37 +0100
committerD G Turner2012-08-04 20:29:37 +0100
commit43e2c6ee1ec8f47a61f69572043b2beca01f53f6 (patch)
treeb03401467209acce70ebc0b29f66ad990c1ca9c9 /audio/decoders/adpcm_intern.h
parent9c47fdae293e05888d3b4ec45fd4b374d1022c0b (diff)
downloadscummvm-rg350-43e2c6ee1ec8f47a61f69572043b2beca01f53f6.tar.gz
scummvm-rg350-43e2c6ee1ec8f47a61f69572043b2beca01f53f6.tar.bz2
scummvm-rg350-43e2c6ee1ec8f47a61f69572043b2beca01f53f6.zip
AUDIO: Correct ADPCM Fixes to ensure internal buffers are drained.
This also adds an omitted _decodedSampleCount initialization in Oki ADPCM decoder.
Diffstat (limited to 'audio/decoders/adpcm_intern.h')
-rw-r--r--audio/decoders/adpcm_intern.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h
index 423c4af267..3b8d8c74d0 100644
--- a/audio/decoders/adpcm_intern.h
+++ b/audio/decoders/adpcm_intern.h
@@ -37,7 +37,6 @@
#include "common/stream.h"
#include "common/textconsole.h"
-
namespace Audio {
class ADPCMStream : public RewindableAudioStream {
@@ -64,12 +63,11 @@ public:
ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign);
virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos); }
- virtual bool isStereo() const { return _channels == 2; }
- virtual int getRate() const { return _rate; }
+ virtual bool isStereo() const { return _channels == 2; }
+ virtual int getRate() const { return _rate; }
virtual bool rewind();
-
/**
* This table is used by some ADPCM variants (IMA and OKI) to adjust the
* step for use on the next sample.
@@ -83,7 +81,9 @@ public:
class Oki_ADPCMStream : public ADPCMStream {
public:
Oki_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
- : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
+ : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; }
+
+ virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); }
virtual int readBuffer(int16 *buffer, const int numSamples);
@@ -114,6 +114,8 @@ public:
DVI_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; }
+ virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); }
+
virtual int readBuffer(int16 *buffer, const int numSamples);
private: