comparison data/fileio/MP3FileReader.cpp @ 690:1424aa29ae95

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:26:52 +0100
parents 06f13a3b9e9e
children e802e550a1f2
comparison
equal deleted inserted replaced
689:573d45e9487b 690:1424aa29ae95
175 // when we implement support for more than just the one tag! 175 // when we implement support for more than just the one tag!
176 176
177 id3_tag *tag = id3_file_tag(file); 177 id3_tag *tag = id3_file_tag(file);
178 if (!tag) { 178 if (!tag) {
179 #ifdef DEBUG_ID3TAG 179 #ifdef DEBUG_ID3TAG
180 DEBUG << "MP3FileReader::loadTags: No ID3 tag found" << endl; 180 SVDEBUG << "MP3FileReader::loadTags: No ID3 tag found" << endl;
181 #endif 181 #endif
182 id3_file_close(file); 182 id3_file_close(file);
183 return; 183 return;
184 } 184 }
185 185
198 198
199 id3_file_close(file); 199 id3_file_close(file);
200 200
201 #else 201 #else
202 #ifdef DEBUG_ID3TAG 202 #ifdef DEBUG_ID3TAG
203 DEBUG << "MP3FileReader::loadTags: ID3 tag support not compiled in" 203 SVDEBUG << "MP3FileReader::loadTags: ID3 tag support not compiled in"
204 << endl; 204 << endl;
205 #endif 205 #endif
206 #endif 206 #endif
207 } 207 }
208 208
213 id3_tag *tag = (id3_tag *)vtag; 213 id3_tag *tag = (id3_tag *)vtag;
214 214
215 id3_frame *frame = id3_tag_findframe(tag, name, 0); 215 id3_frame *frame = id3_tag_findframe(tag, name, 0);
216 if (!frame) { 216 if (!frame) {
217 #ifdef DEBUG_ID3TAG 217 #ifdef DEBUG_ID3TAG
218 DEBUG << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << endl; 218 SVDEBUG << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << endl;
219 #endif 219 #endif
220 return ""; 220 return "";
221 } 221 }
222 222
223 if (frame->nfields < 2) { 223 if (frame->nfields < 2) {
224 DEBUG << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << endl; 224 SVDEBUG << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << endl;
225 return ""; 225 return "";
226 } 226 }
227 227
228 unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]); 228 unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]);
229 if (nstrings == 0) { 229 if (nstrings == 0) {
230 #ifdef DEBUG_ID3TAG 230 #ifdef DEBUG_ID3TAG
231 DEBUG << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << endl; 231 SVDEBUG << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << endl;
232 #endif 232 #endif
233 return ""; 233 return "";
234 } 234 }
235 235
236 id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0); 236 id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0);
237 if (!ustr) { 237 if (!ustr) {
238 #ifdef DEBUG_ID3TAG 238 #ifdef DEBUG_ID3TAG
239 DEBUG << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << endl; 239 SVDEBUG << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << endl;
240 #endif 240 #endif
241 return ""; 241 return "";
242 } 242 }
243 243
244 id3_utf8_t *u8str = id3_ucs4_utf8duplicate(ustr); 244 id3_utf8_t *u8str = id3_ucs4_utf8duplicate(ustr);
249 249
250 QString rv = QString::fromUtf8((const char *)u8str); 250 QString rv = QString::fromUtf8((const char *)u8str);
251 free(u8str); 251 free(u8str);
252 252
253 #ifdef DEBUG_ID3TAG 253 #ifdef DEBUG_ID3TAG
254 DEBUG << "MP3FileReader::loadTags: tag \"" << name << "\" -> \"" 254 SVDEBUG << "MP3FileReader::loadTags: tag \"" << name << "\" -> \""
255 << rv << "\"" << endl; 255 << rv << "\"" << endl;
256 #endif 256 #endif
257 257
258 258
259 return rv; 259 return rv;
363 m_channelCount = channels; 363 m_channelCount = channels;
364 364
365 initialiseDecodeCache(); 365 initialiseDecodeCache();
366 366
367 if (m_cacheMode == CacheInTemporaryFile) { 367 if (m_cacheMode == CacheInTemporaryFile) {
368 // DEBUG << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << endl; 368 // SVDEBUG << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << endl;
369 startSerialised("MP3FileReader::Decode"); 369 startSerialised("MP3FileReader::Decode");
370 } 370 }
371 } 371 }
372 372
373 if (m_bitrateDenom > 0) { 373 if (m_bitrateDenom > 0) {