mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
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.
This commit is contained in:
parent
547fcecf38
commit
cbc3b773aa
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user