diff 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
line wrap: on
line diff
--- a/data/fileio/MP3FileReader.cpp	Thu Nov 24 13:32:04 2016 +0000
+++ b/data/fileio/MP3FileReader.cpp	Thu Nov 24 13:38:45 2016 +0000
@@ -360,18 +360,22 @@
 MP3FileReader::filter(struct mad_stream const *stream,
                       struct mad_frame *)
 {
-    struct mad_bitptr ptr = stream->anc_ptr;
-    unsigned long fourcc = mad_bit_read(&ptr, 32);
-    std::string magic("....");
-    for (int i = 0; i < 4; ++i) {
-        magic[3-i] = char((fourcc >> (8*i)) & 0xff);
-    }
-    if (magic == "Xing" || magic == "Info" || magic == "LAME") {
-        SVDEBUG << "MP3FileReader: Discarding metadata frame (magic = \""
-                << magic << "\")" << " at frame " << m_mp3FrameCount << endl;
-        return MAD_FLOW_IGNORE;
+    if (m_mp3FrameCount > 0) {
+        return MAD_FLOW_CONTINUE;
     } else {
-        return MAD_FLOW_CONTINUE;
+        struct mad_bitptr ptr = stream->anc_ptr;
+        unsigned long fourcc = mad_bit_read(&ptr, 32);
+        std::string magic("....");
+        for (int i = 0; i < 4; ++i) {
+            magic[3-i] = char((fourcc >> (8*i)) & 0xff);
+        }
+        if (magic == "Xing" || magic == "Info" || magic == "LAME") {
+            SVDEBUG << "MP3FileReader: Discarding metadata frame (magic = \""
+                    << magic << "\")" << endl;
+            return MAD_FLOW_IGNORE;
+        } else {
+            return MAD_FLOW_CONTINUE;
+        }
     }
 }