aboutsummaryrefslogtreecommitdiff
path: root/sound/audiostream.cpp
diff options
context:
space:
mode:
authorMax Horn2007-02-24 23:53:35 +0000
committerMax Horn2007-02-24 23:53:35 +0000
commit7f09562d081bbdfe1962e8a5811cdfdc9f2952ff (patch)
treea0a54e91e463586f9c89c74e4dff4f542a4d5258 /sound/audiostream.cpp
parent836642047488427ffce13b4355deab3ced1d2b17 (diff)
downloadscummvm-rg350-7f09562d081bbdfe1962e8a5811cdfdc9f2952ff.tar.gz
scummvm-rg350-7f09562d081bbdfe1962e8a5811cdfdc9f2952ff.tar.bz2
scummvm-rg350-7f09562d081bbdfe1962e8a5811cdfdc9f2952ff.zip
Changed AudioStream::openStreamFile to use the modern variant of the audio stream factories (thus, the FLAC/Ogg/MP3 files it opens are not read completely into memory anymore)
svn-id: r25839
Diffstat (limited to 'sound/audiostream.cpp')
-rw-r--r--sound/audiostream.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index e0b079ef2c..351deeb3b7 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -42,7 +42,8 @@ struct StreamFileFormat {
* Pointer to a function which tries to open a file of type StreamFormat.
* Return NULL in case of an error (invalid/nonexisting file).
*/
- AudioStream* (*openStreamFile)(Common::File *file, uint32 size);
+ AudioStream* (*openStreamFile)(Common::SeekableReadStream *stream, bool disposeAfterUse,
+ uint32 startTime, uint32 duration, uint numLoops);
};
static const StreamFileFormat STREAM_FILEFORMATS[] = {
@@ -77,13 +78,14 @@ AudioStream* AudioStream::openStreamFile(const char *filename)
for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS)-1 && stream == NULL; ++i) {
strcpy(ext, STREAM_FILEFORMATS[i].fileExtension);
fileHandle->open(buffer);
- if (fileHandle->isOpen())
- stream = STREAM_FILEFORMATS[i].openStreamFile(fileHandle, fileHandle->size());
+ if (fileHandle->isOpen()) {
+ stream = STREAM_FILEFORMATS[i].openStreamFile(fileHandle, true, 0, 0, 1);
+ fileHandle = 0;
+ break;
+ }
}
- // Do not reference the file anymore. If the stream didn't incRef the file,
- // the object will be deleted (and the file be closed).
- fileHandle->decRef();
+ delete fileHandle;
if (stream == NULL) {
debug(1, "AudioStream: Could not open compressed AudioFile %s", filename);