Mercurial > hg > svcore
comparison data/fileio/MP3FileReader.cpp @ 1289:a45312bd9306 3.0-integration
Do that only for the first frame
author | Chris Cannam |
---|---|
date | Thu, 24 Nov 2016 13:38:45 +0000 |
parents | 5ef9b4d4bbdb |
children | fa574c909c3d |
comparison
equal
deleted
inserted
replaced
1288:5ef9b4d4bbdb | 1289:a45312bd9306 |
---|---|
358 | 358 |
359 enum mad_flow | 359 enum mad_flow |
360 MP3FileReader::filter(struct mad_stream const *stream, | 360 MP3FileReader::filter(struct mad_stream const *stream, |
361 struct mad_frame *) | 361 struct mad_frame *) |
362 { | 362 { |
363 struct mad_bitptr ptr = stream->anc_ptr; | 363 if (m_mp3FrameCount > 0) { |
364 unsigned long fourcc = mad_bit_read(&ptr, 32); | 364 return MAD_FLOW_CONTINUE; |
365 std::string magic("...."); | |
366 for (int i = 0; i < 4; ++i) { | |
367 magic[3-i] = char((fourcc >> (8*i)) & 0xff); | |
368 } | |
369 if (magic == "Xing" || magic == "Info" || magic == "LAME") { | |
370 SVDEBUG << "MP3FileReader: Discarding metadata frame (magic = \"" | |
371 << magic << "\")" << " at frame " << m_mp3FrameCount << endl; | |
372 return MAD_FLOW_IGNORE; | |
373 } else { | 365 } else { |
374 return MAD_FLOW_CONTINUE; | 366 struct mad_bitptr ptr = stream->anc_ptr; |
367 unsigned long fourcc = mad_bit_read(&ptr, 32); | |
368 std::string magic("...."); | |
369 for (int i = 0; i < 4; ++i) { | |
370 magic[3-i] = char((fourcc >> (8*i)) & 0xff); | |
371 } | |
372 if (magic == "Xing" || magic == "Info" || magic == "LAME") { | |
373 SVDEBUG << "MP3FileReader: Discarding metadata frame (magic = \"" | |
374 << magic << "\")" << endl; | |
375 return MAD_FLOW_IGNORE; | |
376 } else { | |
377 return MAD_FLOW_CONTINUE; | |
378 } | |
375 } | 379 } |
376 } | 380 } |
377 | 381 |
378 enum mad_flow | 382 enum mad_flow |
379 MP3FileReader::output_callback(void *dp, | 383 MP3FileReader::output_callback(void *dp, |