diff data/fileio/AudioFileReaderFactory.cpp @ 281:9c447d664275

* Add QuickTime file reader class -- totally untested, shouldn't even compile
author Chris Cannam
date Mon, 06 Aug 2007 14:37:59 +0000
parents e08f486e8d8c
children 20028c634494
line wrap: on
line diff
--- a/data/fileio/AudioFileReaderFactory.cpp	Fri Jul 13 15:54:17 2007 +0000
+++ b/data/fileio/AudioFileReaderFactory.cpp	Mon Aug 06 14:37:59 2007 +0000
@@ -18,6 +18,7 @@
 #include "WavFileReader.h"
 #include "OggVorbisFileReader.h"
 #include "MP3FileReader.h"
+#include "QuickTimeFileReader.h"
 
 #include <QString>
 #include <QFileInfo>
@@ -37,6 +38,9 @@
     OggVorbisFileReader::getSupportedExtensions(extensions);
 #endif
 #endif
+#ifdef HAVE_QUICKTIME
+    QuickTimeFileReader::getSupportedExtensions(extensions);
+#endif
 
     QString rv;
     for (std::set<QString>::const_iterator i = extensions.begin();
@@ -67,18 +71,6 @@
         reader = new WavFileReader(path);
     }
     
-#ifdef HAVE_MAD
-    if (!reader) {
-        extensions.clear();
-        MP3FileReader::getSupportedExtensions(extensions);
-        if (extensions.find(ext) != extensions.end()) {
-            reader = new MP3FileReader
-                (path,
-                 MP3FileReader::DecodeThreaded,
-                 MP3FileReader::CacheInTemporaryFile);
-        }
-    }
-#endif
 #ifdef HAVE_OGGZ
 #ifdef HAVE_FISHSOUND
     if (!reader) {
@@ -94,6 +86,32 @@
 #endif
 #endif
 
+#ifdef HAVE_MAD
+    if (!reader) {
+        extensions.clear();
+        MP3FileReader::getSupportedExtensions(extensions);
+        if (extensions.find(ext) != extensions.end()) {
+            reader = new MP3FileReader
+                (path,
+                 MP3FileReader::DecodeThreaded,
+                 MP3FileReader::CacheInTemporaryFile);
+        }
+    }
+#endif
+
+#ifdef HAVE_QUICKTIME
+    if (!reader) {
+        extensions.clear();
+        QuickTimeFileReader::getSupportedExtensions(extensions);
+        if (extensions.find(ext) != extensions.end()) {
+            reader = new QuickTimeFileReader
+                (path,
+                 QuickTimeFileReader::DecodeThreaded,
+                 QuickTimeFileReader::CacheInTemporaryFile);
+        }
+    }
+#endif
+
     if (reader) {
         if (reader->isOK()) return reader;
         if (reader->getError() != "") {
@@ -154,6 +172,22 @@
     delete reader;
 #endif
 
+#ifdef HAVE_QUICKTIME
+    reader = new QuickTimeFileReader
+        (path,
+         QuickTimeFileReader::DecodeThreaded,
+         QuickTimeFileReader::CacheInTemporaryFile);
+    if (reader->isOK()) return reader;
+    if (reader->getError() != "") {
+	std::cerr << "AudioFileReaderFactory: QuickTime file reader error: \""
+                  << reader->getError().toStdString() << "\"" << std::endl;
+    } else {
+	std::cerr << "AudioFileReaderFactory: QuickTime file reader failed"
+                  << std::endl;
+    }        
+    delete reader;
+#endif
+
     return 0;
 }