comparison data/fileio/AudioFileReaderFactory.cpp @ 263:71dfc6ab3b54

* Threaded mp3/ogg file reading. Not activated yet, as it doesn't work in context (SV needs to know the duration of its main model at the outset)
author Chris Cannam
date Thu, 24 May 2007 16:20:22 +0000
parents 2b40f83e7627
children e08f486e8d8c
comparison
equal deleted inserted replaced
262:524bcd89743b 263:71dfc6ab3b54
71 if (!reader) { 71 if (!reader) {
72 extensions.clear(); 72 extensions.clear();
73 MP3FileReader::getSupportedExtensions(extensions); 73 MP3FileReader::getSupportedExtensions(extensions);
74 if (extensions.find(ext) != extensions.end()) { 74 if (extensions.find(ext) != extensions.end()) {
75 reader = new MP3FileReader 75 reader = new MP3FileReader
76 (path, true, MP3FileReader::CacheInTemporaryFile); 76 (path,
77 MP3FileReader::DecodeAtOnce,
78 MP3FileReader::CacheInTemporaryFile);
77 } 79 }
78 } 80 }
79 #endif 81 #endif
80 #ifdef HAVE_OGGZ 82 #ifdef HAVE_OGGZ
81 #ifdef HAVE_FISHSOUND 83 #ifdef HAVE_FISHSOUND
82 if (!reader) { 84 if (!reader) {
83 extensions.clear(); 85 extensions.clear();
84 OggVorbisFileReader::getSupportedExtensions(extensions); 86 OggVorbisFileReader::getSupportedExtensions(extensions);
85 if (extensions.find(ext) != extensions.end()) { 87 if (extensions.find(ext) != extensions.end()) {
86 reader = new OggVorbisFileReader 88 reader = new OggVorbisFileReader
87 (path, true, OggVorbisFileReader::CacheInTemporaryFile); 89 (path,
90 OggVorbisFileReader::DecodeAtOnce,
91 OggVorbisFileReader::CacheInTemporaryFile);
88 } 92 }
89 } 93 }
90 #endif 94 #endif
91 #endif 95 #endif
92 96
117 delete reader; 121 delete reader;
118 122
119 #ifdef HAVE_OGGZ 123 #ifdef HAVE_OGGZ
120 #ifdef HAVE_FISHSOUND 124 #ifdef HAVE_FISHSOUND
121 reader = new OggVorbisFileReader 125 reader = new OggVorbisFileReader
122 (path, true, OggVorbisFileReader::CacheInTemporaryFile); 126 (path,
127 OggVorbisFileReader::DecodeAtOnce,
128 OggVorbisFileReader::CacheInTemporaryFile);
123 if (reader->isOK()) return reader; 129 if (reader->isOK()) return reader;
124 if (reader->getError() != "") { 130 if (reader->getError() != "") {
125 std::cerr << "AudioFileReaderFactory: Ogg file reader error: \"" 131 std::cerr << "AudioFileReaderFactory: Ogg file reader error: \""
126 << reader->getError().toStdString() << "\"" << std::endl; 132 << reader->getError().toStdString() << "\"" << std::endl;
127 } else { 133 } else {
132 #endif 138 #endif
133 #endif 139 #endif
134 140
135 #ifdef HAVE_MAD 141 #ifdef HAVE_MAD
136 reader = new MP3FileReader 142 reader = new MP3FileReader
137 (path, true, MP3FileReader::CacheInTemporaryFile); 143 (path,
144 MP3FileReader::DecodeAtOnce,
145 MP3FileReader::CacheInTemporaryFile);
138 if (reader->isOK()) return reader; 146 if (reader->isOK()) return reader;
139 if (reader->getError() != "") { 147 if (reader->getError() != "") {
140 std::cerr << "AudioFileReaderFactory: MP3 file reader error: \"" 148 std::cerr << "AudioFileReaderFactory: MP3 file reader error: \""
141 << reader->getError().toStdString() << "\"" << std::endl; 149 << reader->getError().toStdString() << "\"" << std::endl;
142 } else { 150 } else {