Mercurial > hg > svcore
comparison data/fileio/MP3FileReader.cpp @ 1284:16a8e97179d7 3.0-integration
More error reporting updates
author | Chris Cannam |
---|---|
date | Wed, 23 Nov 2016 12:05:53 +0000 |
parents | 0a9193dc136b |
children | 97f21b03269b |
comparison
equal
deleted
inserted
replaced
1283:2f468f43c02c | 1284:16a8e97179d7 |
---|---|
46 bool normalised, | 46 bool normalised, |
47 ProgressReporter *reporter) : | 47 ProgressReporter *reporter) : |
48 CodedAudioFileReader(mode, targetRate, normalised), | 48 CodedAudioFileReader(mode, targetRate, normalised), |
49 m_source(source), | 49 m_source(source), |
50 m_path(source.getLocalFilename()), | 50 m_path(source.getLocalFilename()), |
51 m_decodeErrorShown(false), | |
51 m_decodeThread(0) | 52 m_decodeThread(0) |
52 { | 53 { |
53 SVDEBUG << "MP3FileReader: local path: \"" << m_path | 54 SVDEBUG << "MP3FileReader: local path: \"" << m_path |
54 << "\", decode mode: " << decodeMode << " (" | 55 << "\", decode mode: " << decodeMode << " (" |
55 << (decodeMode == DecodeAtOnce ? "DecodeAtOnce" : "DecodeThreaded") | 56 << (decodeMode == DecodeAtOnce ? "DecodeAtOnce" : "DecodeThreaded") |
436 enum mad_flow | 437 enum mad_flow |
437 MP3FileReader::error(void *dp, | 438 MP3FileReader::error(void *dp, |
438 struct mad_stream *stream, | 439 struct mad_stream *stream, |
439 struct mad_frame *) | 440 struct mad_frame *) |
440 { | 441 { |
441 static bool errorShown = false; | 442 DecoderData *data = (DecoderData *)dp; |
442 | 443 if (!data->reader->m_decodeErrorShown) { |
443 if (!errorShown) { | 444 char buffer[256]; |
444 DecoderData *data = (DecoderData *)dp; | 445 snprintf(buffer, 255, |
445 fprintf(stderr, "Warning: MP3 decoding error 0x%04x (%s) at byte offset %lu\n", | 446 "MP3 decoding error 0x%04x (%s) at byte offset %lu", |
446 stream->error, mad_stream_errorstr(stream), | 447 stream->error, mad_stream_errorstr(stream), |
447 (unsigned long)(stream->this_frame - data->start)); | 448 (unsigned long)(stream->this_frame - data->start)); |
448 fprintf(stderr, "(Suppressing any further errors of this sort)\n"); | 449 SVCERR << "Warning: in file \"" << data->reader->m_path << "\": " |
449 errorShown = true; | 450 << buffer << " (continuing; will not report any further decode errors for this file)" << endl; |
451 data->reader->m_decodeErrorShown = true; | |
450 } | 452 } |
451 | 453 |
452 return MAD_FLOW_CONTINUE; | 454 return MAD_FLOW_CONTINUE; |
453 } | 455 } |
454 | 456 |