aboutsummaryrefslogtreecommitdiff
path: root/sound/decoders
diff options
context:
space:
mode:
authorMax Horn2010-06-15 12:33:54 +0000
committerMax Horn2010-06-15 12:33:54 +0000
commitd570e10b77887fa163f17de512b14fc824f45f33 (patch)
tree44dbf95c8ad21df54d793cf22b2f3590ccb1ef77 /sound/decoders
parent651e2760a3b2de0c542ccbbf1bf3caa319cc0349 (diff)
downloadscummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.tar.gz
scummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.tar.bz2
scummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.zip
Modify makeAIFFStream to match the other sound decoder factories
svn-id: r49844
Diffstat (limited to 'sound/decoders')
-rw-r--r--sound/decoders/aiff.cpp11
-rw-r--r--sound/decoders/aiff.h9
2 files changed, 16 insertions, 4 deletions
diff --git a/sound/decoders/aiff.cpp b/sound/decoders/aiff.cpp
index 2f12669072..b76410f8d1 100644
--- a/sound/decoders/aiff.cpp
+++ b/sound/decoders/aiff.cpp
@@ -161,16 +161,21 @@ bool loadAIFFFromStream(Common::SeekableReadStream &stream, int &size, int &rate
return true;
}
-SeekableAudioStream *makeAIFFStream(Common::SeekableReadStream &stream) {
+SeekableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream,
+ DisposeAfterUse::Flag disposeAfterUse) {
int size, rate;
byte *data, flags;
- if (!loadAIFFFromStream(stream, size, rate, flags))
+ if (!loadAIFFFromStream(*stream, size, rate, flags)) {
+ if (disposeAfterUse == DisposeAfterUse::YES)
+ delete stream;
return 0;
+ }
data = (byte *)malloc(size);
assert(data);
- stream.read(data, size);
+ stream->read(data, size);
+ delete stream;
// Since we allocated our own buffer for the data, we must specify DisposeAfterUse::YES.
return makeRawStream(data, size, rate, flags);
diff --git a/sound/decoders/aiff.h b/sound/decoders/aiff.h
index e8a3b6f0b0..53f86c95fd 100644
--- a/sound/decoders/aiff.h
+++ b/sound/decoders/aiff.h
@@ -34,6 +34,7 @@
#define SOUND_AIFF_H
#include "common/scummsys.h"
+#include "common/types.h"
namespace Common { class SeekableReadStream; }
@@ -55,8 +56,14 @@ extern bool loadAIFFFromStream(Common::SeekableReadStream &stream, int &size, in
* from that data.
*
* This function uses loadAIFFFromStream() internally.
+ *
+ * @param stream the SeekableReadStream from which to read the AIFF data
+ * @param disposeAfterUse whether to delete the stream after use
+ * @return a new SeekableAudioStream, or NULL, if an error occurred
*/
-SeekableAudioStream *makeAIFFStream(Common::SeekableReadStream &stream);
+SeekableAudioStream *makeAIFFStream(
+ Common::SeekableReadStream *stream,
+ DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio