comparison data/fileio/MP3FileReader.cpp @ 348:edda24bb85fc

* Skip ID3 block when reading MP3 files (so long as ID3 support is included) * Show progress when retrieving audio file from playlist * Avoid -- but do not actually fix -- segmentation fault on exit. I am totally stumped at the moment about why both the PA and JACK audio targets should crash when properly shut down. For the moment, we just don't shut them down... * Fix incorrect behaviour (introduced on Friday as part of a different fix) when replacing main model in situation where no current main model exists
author Chris Cannam
date Fri, 30 Nov 2007 17:31:09 +0000
parents aa8dbac62024
children b92513201610 94fc0591ea43
comparison
equal deleted inserted replaced
346:a9ccd644f3bf 348:edda24bb85fc
204 } 204 }
205 205
206 unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]); 206 unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]);
207 if (nstrings == 0) { 207 if (nstrings == 0) {
208 #ifdef DEBUG_ID3TAG 208 #ifdef DEBUG_ID3TAG
209 std::cerr << "MP3FileReader::loadTags: No data for \"" << name << "\" in ID3 tag" << std::endl; 209 std::cerr << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << std::endl;
210 #endif 210 #endif
211 return ""; 211 return "";
212 } 212 }
213 213
214 id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0); 214 id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0);
289 MP3FileReader::input(void *dp, struct mad_stream *stream) 289 MP3FileReader::input(void *dp, struct mad_stream *stream)
290 { 290 {
291 DecoderData *data = (DecoderData *)dp; 291 DecoderData *data = (DecoderData *)dp;
292 292
293 if (!data->length) return MAD_FLOW_STOP; 293 if (!data->length) return MAD_FLOW_STOP;
294 mad_stream_buffer(stream, data->start, data->length); 294
295 unsigned char const *start = data->start;
296 unsigned long length = data->length;
297
298 #ifdef HAVE_ID3TAG
299 if (length > ID3_TAG_QUERYSIZE) {
300 int taglen = id3_tag_query(start, ID3_TAG_QUERYSIZE);
301 if (taglen > 0) {
302 // std::cerr << "ID3 tag length to skip: " << taglen << std::endl;
303 start += taglen;
304 length -= taglen;
305 }
306 }
307 #endif
308
309 mad_stream_buffer(stream, start, length);
295 data->length = 0; 310 data->length = 0;
296 311
297 return MAD_FLOW_CONTINUE; 312 return MAD_FLOW_CONTINUE;
298 } 313 }
299 314