comparison data/fileio/MP3FileReader.cpp @ 687:06f13a3b9e9e debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:09 +0100
parents b4a8d8221eaf
children 1424aa29ae95
comparison
equal deleted inserted replaced
686:b4a8d8221eaf 687:06f13a3b9e9e
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 std::cerr << "MP3FileReader::loadTags: No ID3 tag found" << std::endl; 180 DEBUG << "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 std::cerr << "MP3FileReader::loadTags: ID3 tag support not compiled in" 203 DEBUG << "MP3FileReader::loadTags: ID3 tag support not compiled in"
204 << std::endl; 204 << endl;
205 #endif 205 #endif
206 #endif 206 #endif
207 } 207 }
208 208
209 QString 209 QString
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 std::cerr << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << std::endl; 218 DEBUG << "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 std::cerr << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << std::endl; 224 DEBUG << "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 std::cerr << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << std::endl; 231 DEBUG << "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 std::cerr << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << std::endl; 239 DEBUG << "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 std::cerr << "MP3FileReader::loadTags: tag \"" << name << "\" -> \"" 254 DEBUG << "MP3FileReader::loadTags: tag \"" << name << "\" -> \""
255 << rv << "\"" << std::endl; 255 << rv << "\"" << endl;
256 #endif 256 #endif
257 257
258 258
259 return rv; 259 return rv;
260 260
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 // std::cerr << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << std::endl; 368 // DEBUG << "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) {