diff options
author | Matthew Hoops | 2011-08-26 22:44:17 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-08-26 22:44:17 -0400 |
commit | 4a69dc13d92e82fff85dc5a3a923b74ced259ffa (patch) | |
tree | 8945cd3745fd65f28b043caf7b1beddbbce2b2a1 /audio/decoders/vorbis.cpp | |
parent | ad293b249e74dd1cfbdbd721d02145efbdaf9eca (diff) | |
parent | 5e174cbfe466dbbe8e5470b0a00de1481b986181 (diff) | |
download | scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.gz scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.bz2 scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'audio/decoders/vorbis.cpp')
-rw-r--r-- | audio/decoders/vorbis.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/audio/decoders/vorbis.cpp b/audio/decoders/vorbis.cpp index 2724dd1f02..64cacb4d58 100644 --- a/audio/decoders/vorbis.cpp +++ b/audio/decoders/vorbis.cpp @@ -29,6 +29,7 @@ #ifdef USE_VORBIS +#include "common/ptr.h" #include "common/stream.h" #include "common/textconsole.h" #include "common/util.h" @@ -42,6 +43,7 @@ #include <tremor/ivorbisfile.h> #endif #else +#define OV_EXCLUDE_STATIC_CALLBACKS #include <vorbis/vorbisfile.h> #endif @@ -88,8 +90,7 @@ static ov_callbacks g_stream_wrap = { class VorbisStream : public SeekableAudioStream { protected: - Common::SeekableReadStream *_inStream; - DisposeAfterUse::Flag _disposeAfterUse; + Common::DisposablePtr<Common::SeekableReadStream> _inStream; bool _isStereo; int _rate; @@ -120,10 +121,9 @@ protected: }; VorbisStream::VorbisStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose) : - _inStream(inStream), - _disposeAfterUse(dispose), + _inStream(inStream, dispose), _length(0, 1000), - _bufferEnd(_buffer + ARRAYSIZE(_buffer)) { + _bufferEnd(ARRAYEND(_buffer)) { int res = ov_open_callbacks(inStream, &_ovFile, NULL, 0, g_stream_wrap); if (res < 0) { @@ -149,8 +149,6 @@ VorbisStream::VorbisStream(Common::SeekableReadStream *inStream, DisposeAfterUse VorbisStream::~VorbisStream() { ov_clear(&_ovFile); - if (_disposeAfterUse == DisposeAfterUse::YES) - delete _inStream; } int VorbisStream::readBuffer(int16 *buffer, const int numSamples) { |