diff data/fileio/OggVorbisFileReader.cpp @ 271:822bd7fd526c

* Add support for reading mp3 and Ogg file title tags
author Chris Cannam
date Mon, 02 Jul 2007 13:53:38 +0000
parents e08f486e8d8c
children 9c447d664275
line wrap: on
line diff
--- a/data/fileio/OggVorbisFileReader.cpp	Tue Jun 26 12:27:47 2007 +0000
+++ b/data/fileio/OggVorbisFileReader.cpp	Mon Jul 02 13:53:38 2007 +0000
@@ -40,6 +40,7 @@
     m_progress(0),
     m_fileSize(0),
     m_bytesRead(0),
+    m_commentsRead(false),
     m_cancelled(false),
     m_completion(0),
     m_decodeThread(0)
@@ -163,6 +164,15 @@
 {
     OggVorbisFileReader *reader = (OggVorbisFileReader *)data;
 
+    if (!reader->m_commentsRead) {
+        const FishSoundComment *comment = fish_sound_comment_first_byname
+            (fs, "TITLE");
+        if (comment && comment->value) {
+            reader->m_title = QString::fromUtf8(comment->value);
+        }
+        reader->m_commentsRead = true;
+    }
+
     if (reader->m_channelCount == 0) {
 	FishSoundInfo fsinfo;
 	fish_sound_command(fs, FISH_SOUND_GET_INFO,