[Scummvm-cvs-logs] SF.net SVN: scummvm: [25839] scummvm/trunk/sound/audiostream.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Feb 25 00:53:35 CET 2007


Revision: 25839
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25839&view=rev
Author:   fingolfin
Date:     2007-02-24 15:53:35 -0800 (Sat, 24 Feb 2007)

Log Message:
-----------
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)

Modified Paths:
--------------
    scummvm/trunk/sound/audiostream.cpp

Modified: scummvm/trunk/sound/audiostream.cpp
===================================================================
--- scummvm/trunk/sound/audiostream.cpp	2007-02-24 23:41:20 UTC (rev 25838)
+++ scummvm/trunk/sound/audiostream.cpp	2007-02-24 23:53:35 UTC (rev 25839)
@@ -42,7 +42,8 @@
 	 * 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 @@
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list