diff data/fileio/MP3FileReader.cpp @ 742:c10cb8782576 coreaudio_tests

Merge from branch "default"
author Chris Cannam
date Sun, 01 Jul 2012 11:53:00 +0100
parents 1424aa29ae95
children e802e550a1f2
line wrap: on
line diff
--- a/data/fileio/MP3FileReader.cpp	Mon Nov 29 12:45:39 2010 +0000
+++ b/data/fileio/MP3FileReader.cpp	Sun Jul 01 11:53:00 2012 +0100
@@ -96,7 +96,7 @@
             return;
         } else if (sz == 0) {
             std::cerr << QString("MP3FileReader::MP3FileReader: Warning: reached EOF after only %1 of %2 bytes")
-                .arg(offset).arg(m_fileSize).toStdString() << std::endl;
+                .arg(offset).arg(m_fileSize) << std::endl;
             m_fileSize = offset;
             break;
         }
@@ -141,7 +141,7 @@
     }
 
     if (m_error != "") {
-        std::cerr << "MP3FileReader::MP3FileReader(\"" << m_path.toStdString() << "\"): ERROR: " << m_error.toStdString() << std::endl;
+        std::cerr << "MP3FileReader::MP3FileReader(\"" << m_path << "\"): ERROR: " << m_error << std::endl;
     }
 }
 
@@ -177,7 +177,7 @@
     id3_tag *tag = id3_file_tag(file);
     if (!tag) {
 #ifdef DEBUG_ID3TAG
-        std::cerr << "MP3FileReader::loadTags: No ID3 tag found" << std::endl;
+        SVDEBUG << "MP3FileReader::loadTags: No ID3 tag found" << endl;
 #endif
         id3_file_close(file);
         return;
@@ -189,12 +189,19 @@
     m_maker = loadTag(tag, "TPE1"); // "lead artist"
     if (m_maker == "") m_maker = loadTag(tag, "TPE2");
 
+    for (unsigned int i = 0; i < tag->nframes; ++i) {
+        if (tag->frames[i]) {
+            QString value = loadTag(tag, tag->frames[i]->id);
+            if (value != "") m_tags[tag->frames[i]->id] = value;
+        }
+    }
+
     id3_file_close(file);
 
 #else
 #ifdef DEBUG_ID3TAG
-    std::cerr << "MP3FileReader::loadTags: ID3 tag support not compiled in"
-              << std::endl;
+    SVDEBUG << "MP3FileReader::loadTags: ID3 tag support not compiled in"
+              << endl;
 #endif
 #endif
 }
@@ -208,20 +215,20 @@
     id3_frame *frame = id3_tag_findframe(tag, name, 0);
     if (!frame) {
 #ifdef DEBUG_ID3TAG
-        std::cerr << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << std::endl;
+        SVDEBUG << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << endl;
 #endif
         return "";
     }
         
     if (frame->nfields < 2) {
-        std::cerr << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << std::endl;
+        SVDEBUG << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << endl;
         return "";
     }
 
     unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]);
     if (nstrings == 0) {
 #ifdef DEBUG_ID3TAG
-        std::cerr << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << std::endl;
+        SVDEBUG << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << endl;
 #endif
         return "";
     }
@@ -229,7 +236,7 @@
     id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0);
     if (!ustr) {
 #ifdef DEBUG_ID3TAG
-        std::cerr << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << std::endl;
+        SVDEBUG << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << endl;
 #endif
         return "";
     }
@@ -244,8 +251,8 @@
     free(u8str);
 
 #ifdef DEBUG_ID3TAG
-	std::cerr << "MP3FileReader::loadTags: tag \"" << name << "\" -> \""
-	<< rv.toStdString() << "\"" << std::endl;
+	SVDEBUG << "MP3FileReader::loadTags: tag \"" << name << "\" -> \""
+	<< rv << "\"" << endl;
 #endif
 
 
@@ -358,7 +365,7 @@
         initialiseDecodeCache();
 
         if (m_cacheMode == CacheInTemporaryFile) {
-//            std::cerr << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << std::endl;
+//            SVDEBUG << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << endl;
             startSerialised("MP3FileReader::Decode");
         }
     }