aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorColin Snover2016-04-21 17:17:17 -0500
committerColin Snover2016-06-19 14:48:33 -0500
commitcbc3b773aa56ec89060ca542e57597ca5a619f40 (patch)
tree9f456e1916372826c8c19bf5634ae5eef3e17c2f /audio
parent547fcecf3879a7953e67ba6a3bcba8e3d06ffb00 (diff)
downloadscummvm-rg350-cbc3b773aa56ec89060ca542e57597ca5a619f40.tar.gz
scummvm-rg350-cbc3b773aa56ec89060ca542e57597ca5a619f40.tar.bz2
scummvm-rg350-cbc3b773aa56ec89060ca542e57597ca5a619f40.zip
AUDIO: Make WAV streams seekable
This allows raw PCM in WAVE containers to have duration and be seekable, and opens the door for ADPCM streams to be seekable later if necessary. This change is needed to avoid duplication of RIFF/WAVE container parsing for SCI engine, which uses raw PCM WAVE files and needs to be able to determine their lengths.
Diffstat (limited to 'audio')
-rw-r--r--audio/decoders/adpcm.cpp2
-rw-r--r--audio/decoders/adpcm.h4
-rw-r--r--audio/decoders/adpcm_intern.h4
-rw-r--r--audio/decoders/wave.cpp2
-rw-r--r--audio/decoders/wave.h2
5 files changed, 8 insertions, 6 deletions
diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp
index fe5eec5dcc..fd97d5d109 100644
--- a/audio/decoders/adpcm.cpp
+++ b/audio/decoders/adpcm.cpp
@@ -433,7 +433,7 @@ int16 Ima_ADPCMStream::decodeIMA(byte code, int channel) {
return samp;
}
-RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign) {
+SeekableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign) {
// If size is 0, report the entire size of the stream
if (!size)
size = stream->size();
diff --git a/audio/decoders/adpcm.h b/audio/decoders/adpcm.h
index 650bc341b3..353fd3b71d 100644
--- a/audio/decoders/adpcm.h
+++ b/audio/decoders/adpcm.h
@@ -45,7 +45,7 @@ class SeekableReadStream;
namespace Audio {
class PacketizedAudioStream;
-class RewindableAudioStream;
+class SeekableAudioStream;
// There are several types of ADPCM encoding, only some are supported here
// For all the different encodings, refer to:
@@ -74,7 +74,7 @@ enum ADPCMType {
* @param blockAlign block alignment ???
* @return a new RewindableAudioStream, or NULL, if an error occurred
*/
-RewindableAudioStream *makeADPCMStream(
+SeekableAudioStream *makeADPCMStream(
Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse,
uint32 size, ADPCMType type,
diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h
index 92be704cca..3a2af91c90 100644
--- a/audio/decoders/adpcm_intern.h
+++ b/audio/decoders/adpcm_intern.h
@@ -39,7 +39,7 @@
namespace Audio {
-class ADPCMStream : public RewindableAudioStream {
+class ADPCMStream : public SeekableAudioStream {
protected:
Common::DisposablePtr<Common::SeekableReadStream> _stream;
int32 _startpos;
@@ -67,6 +67,8 @@ public:
virtual int getRate() const { return _rate; }
virtual bool rewind();
+ virtual bool seek(const Timestamp &where) { return false; }
+ virtual Timestamp getLength() const { return -1; }
/**
* This table is used by some ADPCM variants (IMA and OKI) to adjust the
diff --git a/audio/decoders/wave.cpp b/audio/decoders/wave.cpp
index adee749b37..cdd6412aa8 100644
--- a/audio/decoders/wave.cpp
+++ b/audio/decoders/wave.cpp
@@ -158,7 +158,7 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
return true;
}
-RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
+SeekableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
int size, rate;
byte flags;
uint16 type;
diff --git a/audio/decoders/wave.h b/audio/decoders/wave.h
index 6bc9f72101..f5b7fb4d2c 100644
--- a/audio/decoders/wave.h
+++ b/audio/decoders/wave.h
@@ -84,7 +84,7 @@ extern bool loadWAVFromStream(
* @param disposeAfterUse whether to delete the stream after use
* @return a new RewindableAudioStream, or NULL, if an error occurred
*/
-RewindableAudioStream *makeWAVStream(
+SeekableAudioStream *makeWAVStream(
Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse);