comparison data/fileio/AudioFileReaderFactory.cpp @ 265:e08f486e8d8c

* Enable threaded decoding for Ogg and MP3 files. Needs some work on reducing updates to the overview widget
author Chris Cannam
date Wed, 06 Jun 2007 16:24:55 +0000
parents 71dfc6ab3b54
children 9c447d664275
comparison
equal deleted inserted replaced
264:260032c26c4f 265:e08f486e8d8c
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, 76 (path,
77 MP3FileReader::DecodeAtOnce, 77 MP3FileReader::DecodeThreaded,
78 MP3FileReader::CacheInTemporaryFile); 78 MP3FileReader::CacheInTemporaryFile);
79 } 79 }
80 } 80 }
81 #endif 81 #endif
82 #ifdef HAVE_OGGZ 82 #ifdef HAVE_OGGZ
85 extensions.clear(); 85 extensions.clear();
86 OggVorbisFileReader::getSupportedExtensions(extensions); 86 OggVorbisFileReader::getSupportedExtensions(extensions);
87 if (extensions.find(ext) != extensions.end()) { 87 if (extensions.find(ext) != extensions.end()) {
88 reader = new OggVorbisFileReader 88 reader = new OggVorbisFileReader
89 (path, 89 (path,
90 OggVorbisFileReader::DecodeAtOnce, 90 OggVorbisFileReader::DecodeThreaded,
91 OggVorbisFileReader::CacheInTemporaryFile); 91 OggVorbisFileReader::CacheInTemporaryFile);
92 } 92 }
93 } 93 }
94 #endif 94 #endif
95 #endif 95 #endif
122 122
123 #ifdef HAVE_OGGZ 123 #ifdef HAVE_OGGZ
124 #ifdef HAVE_FISHSOUND 124 #ifdef HAVE_FISHSOUND
125 reader = new OggVorbisFileReader 125 reader = new OggVorbisFileReader
126 (path, 126 (path,
127 OggVorbisFileReader::DecodeAtOnce, 127 OggVorbisFileReader::DecodeThreaded,
128 OggVorbisFileReader::CacheInTemporaryFile); 128 OggVorbisFileReader::CacheInTemporaryFile);
129 if (reader->isOK()) return reader; 129 if (reader->isOK()) return reader;
130 if (reader->getError() != "") { 130 if (reader->getError() != "") {
131 std::cerr << "AudioFileReaderFactory: Ogg file reader error: \"" 131 std::cerr << "AudioFileReaderFactory: Ogg file reader error: \""
132 << reader->getError().toStdString() << "\"" << std::endl; 132 << reader->getError().toStdString() << "\"" << std::endl;
139 #endif 139 #endif
140 140
141 #ifdef HAVE_MAD 141 #ifdef HAVE_MAD
142 reader = new MP3FileReader 142 reader = new MP3FileReader
143 (path, 143 (path,
144 MP3FileReader::DecodeAtOnce, 144 MP3FileReader::DecodeThreaded,
145 MP3FileReader::CacheInTemporaryFile); 145 MP3FileReader::CacheInTemporaryFile);
146 if (reader->isOK()) return reader; 146 if (reader->isOK()) return reader;
147 if (reader->getError() != "") { 147 if (reader->getError() != "") {
148 std::cerr << "AudioFileReaderFactory: MP3 file reader error: \"" 148 std::cerr << "AudioFileReaderFactory: MP3 file reader error: \""
149 << reader->getError().toStdString() << "\"" << std::endl; 149 << reader->getError().toStdString() << "\"" << std::endl;