Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
280:daf89d31f45c | 281:9c447d664275 |
---|---|
16 #include "AudioFileReaderFactory.h" | 16 #include "AudioFileReaderFactory.h" |
17 | 17 |
18 #include "WavFileReader.h" | 18 #include "WavFileReader.h" |
19 #include "OggVorbisFileReader.h" | 19 #include "OggVorbisFileReader.h" |
20 #include "MP3FileReader.h" | 20 #include "MP3FileReader.h" |
21 #include "QuickTimeFileReader.h" | |
21 | 22 |
22 #include <QString> | 23 #include <QString> |
23 #include <QFileInfo> | 24 #include <QFileInfo> |
24 #include <iostream> | 25 #include <iostream> |
25 | 26 |
34 #endif | 35 #endif |
35 #ifdef HAVE_OGGZ | 36 #ifdef HAVE_OGGZ |
36 #ifdef HAVE_FISHSOUND | 37 #ifdef HAVE_FISHSOUND |
37 OggVorbisFileReader::getSupportedExtensions(extensions); | 38 OggVorbisFileReader::getSupportedExtensions(extensions); |
38 #endif | 39 #endif |
40 #endif | |
41 #ifdef HAVE_QUICKTIME | |
42 QuickTimeFileReader::getSupportedExtensions(extensions); | |
39 #endif | 43 #endif |
40 | 44 |
41 QString rv; | 45 QString rv; |
42 for (std::set<QString>::const_iterator i = extensions.begin(); | 46 for (std::set<QString>::const_iterator i = extensions.begin(); |
43 i != extensions.end(); ++i) { | 47 i != extensions.end(); ++i) { |
65 WavFileReader::getSupportedExtensions(extensions); | 69 WavFileReader::getSupportedExtensions(extensions); |
66 if (extensions.find(ext) != extensions.end()) { | 70 if (extensions.find(ext) != extensions.end()) { |
67 reader = new WavFileReader(path); | 71 reader = new WavFileReader(path); |
68 } | 72 } |
69 | 73 |
70 #ifdef HAVE_MAD | |
71 if (!reader) { | |
72 extensions.clear(); | |
73 MP3FileReader::getSupportedExtensions(extensions); | |
74 if (extensions.find(ext) != extensions.end()) { | |
75 reader = new MP3FileReader | |
76 (path, | |
77 MP3FileReader::DecodeThreaded, | |
78 MP3FileReader::CacheInTemporaryFile); | |
79 } | |
80 } | |
81 #endif | |
82 #ifdef HAVE_OGGZ | 74 #ifdef HAVE_OGGZ |
83 #ifdef HAVE_FISHSOUND | 75 #ifdef HAVE_FISHSOUND |
84 if (!reader) { | 76 if (!reader) { |
85 extensions.clear(); | 77 extensions.clear(); |
86 OggVorbisFileReader::getSupportedExtensions(extensions); | 78 OggVorbisFileReader::getSupportedExtensions(extensions); |
90 OggVorbisFileReader::DecodeThreaded, | 82 OggVorbisFileReader::DecodeThreaded, |
91 OggVorbisFileReader::CacheInTemporaryFile); | 83 OggVorbisFileReader::CacheInTemporaryFile); |
92 } | 84 } |
93 } | 85 } |
94 #endif | 86 #endif |
87 #endif | |
88 | |
89 #ifdef HAVE_MAD | |
90 if (!reader) { | |
91 extensions.clear(); | |
92 MP3FileReader::getSupportedExtensions(extensions); | |
93 if (extensions.find(ext) != extensions.end()) { | |
94 reader = new MP3FileReader | |
95 (path, | |
96 MP3FileReader::DecodeThreaded, | |
97 MP3FileReader::CacheInTemporaryFile); | |
98 } | |
99 } | |
100 #endif | |
101 | |
102 #ifdef HAVE_QUICKTIME | |
103 if (!reader) { | |
104 extensions.clear(); | |
105 QuickTimeFileReader::getSupportedExtensions(extensions); | |
106 if (extensions.find(ext) != extensions.end()) { | |
107 reader = new QuickTimeFileReader | |
108 (path, | |
109 QuickTimeFileReader::DecodeThreaded, | |
110 QuickTimeFileReader::CacheInTemporaryFile); | |
111 } | |
112 } | |
95 #endif | 113 #endif |
96 | 114 |
97 if (reader) { | 115 if (reader) { |
98 if (reader->isOK()) return reader; | 116 if (reader->isOK()) return reader; |
99 if (reader->getError() != "") { | 117 if (reader->getError() != "") { |
152 << std::endl; | 170 << std::endl; |
153 } | 171 } |
154 delete reader; | 172 delete reader; |
155 #endif | 173 #endif |
156 | 174 |
175 #ifdef HAVE_QUICKTIME | |
176 reader = new QuickTimeFileReader | |
177 (path, | |
178 QuickTimeFileReader::DecodeThreaded, | |
179 QuickTimeFileReader::CacheInTemporaryFile); | |
180 if (reader->isOK()) return reader; | |
181 if (reader->getError() != "") { | |
182 std::cerr << "AudioFileReaderFactory: QuickTime file reader error: \"" | |
183 << reader->getError().toStdString() << "\"" << std::endl; | |
184 } else { | |
185 std::cerr << "AudioFileReaderFactory: QuickTime file reader failed" | |
186 << std::endl; | |
187 } | |
188 delete reader; | |
189 #endif | |
190 | |
157 return 0; | 191 return 0; |
158 } | 192 } |
159 | 193 |