diff options
author | Willem Jan Palenstijn | 2013-04-18 23:34:29 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:44 +0200 |
commit | 01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6 (patch) | |
tree | 544b07f3aa41abe7907bcd2040cdad11ebc324bb /audio/decoders/raw.cpp | |
parent | 9cf2c83e5e5a35816ab153bf8443dac691829ea8 (diff) | |
parent | a41d72a44a660c72fdadbc3a8ef580e5e03cb890 (diff) | |
download | scummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.tar.gz scummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.tar.bz2 scummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.zip |
Merge branch 'master'
Diffstat (limited to 'audio/decoders/raw.cpp')
-rw-r--r-- | audio/decoders/raw.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/audio/decoders/raw.cpp b/audio/decoders/raw.cpp index 4789fd0f36..881b8c1d6a 100644 --- a/audio/decoders/raw.cpp +++ b/audio/decoders/raw.cpp @@ -51,7 +51,7 @@ template<bool is16Bit, bool isUnsigned, bool isLE> class RawStream : public SeekableAudioStream { public: RawStream(int rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, const RawStreamBlockList &blocks) - : _rate(rate), _isStereo(stereo), _playtime(0, rate), _stream(stream), _disposeAfterUse(disposeStream), _blocks(blocks), _curBlock(_blocks.begin()), _blockLeft(0), _buffer(0) { + : _rate(rate), _isStereo(stereo), _playtime(0, rate), _stream(stream, disposeStream), _blocks(blocks), _curBlock(_blocks.begin()), _blockLeft(0), _buffer(0) { assert(_blocks.size() > 0); @@ -82,9 +82,6 @@ public: } ~RawStream() { - if (_disposeAfterUse == DisposeAfterUse::YES) - delete _stream; - delete[] _buffer; } @@ -98,15 +95,14 @@ public: bool seek(const Timestamp &where); private: - const int _rate; ///< Sample rate of stream - const bool _isStereo; ///< Whether this is an stereo stream - Timestamp _playtime; ///< Calculated total play time - Common::SeekableReadStream *_stream; ///< Stream to read data from - const DisposeAfterUse::Flag _disposeAfterUse; ///< Indicates whether the stream object should be deleted when this RawStream is destructed - const RawStreamBlockList _blocks; ///< Audio block list - - RawStreamBlockList::const_iterator _curBlock; ///< Current audio block number - int32 _blockLeft; ///< How many bytes are still left in the current block + const int _rate; ///< Sample rate of stream + const bool _isStereo; ///< Whether this is an stereo stream + Timestamp _playtime; ///< Calculated total play time + Common::DisposablePtr<Common::SeekableReadStream> _stream; ///< Stream to read data from + const RawStreamBlockList _blocks; ///< Audio block list + + RawStreamBlockList::const_iterator _curBlock; ///< Current audio block number + int32 _blockLeft; ///< How many bytes are still left in the current block /** * Advance one block in the stream in case |