[Scummvm-cvs-logs] scummvm master -> 43e2c6ee1ec8f47a61f69572043b2beca01f53f6
digitall
digitall at scummvm.org
Sat Aug 4 21:31:56 CEST 2012
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
43e2c6ee1e AUDIO: Correct ADPCM Fixes to ensure internal buffers are drained.
Commit: 43e2c6ee1ec8f47a61f69572043b2beca01f53f6
https://github.com/scummvm/scummvm/commit/43e2c6ee1ec8f47a61f69572043b2beca01f53f6
Author: D G Turner (digitall at scummvm.org)
Date: 2012-08-04T12:29:37-07:00
Commit Message:
AUDIO: Correct ADPCM Fixes to ensure internal buffers are drained.
This also adds an omitted _decodedSampleCount initialization in Oki
ADPCM decoder.
Changed paths:
audio/decoders/adpcm.cpp
audio/decoders/adpcm_intern.h
diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp
index e729742..2fe509e 100644
--- a/audio/decoders/adpcm.cpp
+++ b/audio/decoders/adpcm.cpp
@@ -71,7 +71,7 @@ int Oki_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
int samples;
byte data;
- for (samples = 0; samples < numSamples && !_stream->eos() && (_stream->pos() < _endpos); samples++) {
+ for (samples = 0; samples < numSamples && !endOfData(); samples++) {
if (_decodedSampleCount == 0) {
data = _stream->readByte();
_decodedSamples[0] = decodeOKI((data >> 4) & 0x0f);
@@ -123,7 +123,7 @@ int DVI_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
int samples;
byte data;
- for (samples = 0; samples < numSamples && !_stream->eos() && (_stream->pos() < _endpos); samples++) {
+ for (samples = 0; samples < numSamples && !endOfData(); samples++) {
if (_decodedSampleCount == 0) {
data = _stream->readByte();
_decodedSamples[0] = decodeIMA((data >> 4) & 0x0f, 0);
diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h
index 423c4af..3b8d8c7 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:
More information about the Scummvm-git-logs
mailing list