Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
270:840dd5e6400f | 271:822bd7fd526c |
---|---|
38 CodedAudioFileReader(mode), | 38 CodedAudioFileReader(mode), |
39 m_path(path), | 39 m_path(path), |
40 m_progress(0), | 40 m_progress(0), |
41 m_fileSize(0), | 41 m_fileSize(0), |
42 m_bytesRead(0), | 42 m_bytesRead(0), |
43 m_commentsRead(false), | |
43 m_cancelled(false), | 44 m_cancelled(false), |
44 m_completion(0), | 45 m_completion(0), |
45 m_decodeThread(0) | 46 m_decodeThread(0) |
46 { | 47 { |
47 m_frameCount = 0; | 48 m_frameCount = 0; |
161 OggVorbisFileReader::acceptFrames(FishSound *fs, float **frames, long nframes, | 162 OggVorbisFileReader::acceptFrames(FishSound *fs, float **frames, long nframes, |
162 void *data) | 163 void *data) |
163 { | 164 { |
164 OggVorbisFileReader *reader = (OggVorbisFileReader *)data; | 165 OggVorbisFileReader *reader = (OggVorbisFileReader *)data; |
165 | 166 |
167 if (!reader->m_commentsRead) { | |
168 const FishSoundComment *comment = fish_sound_comment_first_byname | |
169 (fs, "TITLE"); | |
170 if (comment && comment->value) { | |
171 reader->m_title = QString::fromUtf8(comment->value); | |
172 } | |
173 reader->m_commentsRead = true; | |
174 } | |
175 | |
166 if (reader->m_channelCount == 0) { | 176 if (reader->m_channelCount == 0) { |
167 FishSoundInfo fsinfo; | 177 FishSoundInfo fsinfo; |
168 fish_sound_command(fs, FISH_SOUND_GET_INFO, | 178 fish_sound_command(fs, FISH_SOUND_GET_INFO, |
169 &fsinfo, sizeof(FishSoundInfo)); | 179 &fsinfo, sizeof(FishSoundInfo)); |
170 reader->m_channelCount = fsinfo.channels; | 180 reader->m_channelCount = fsinfo.channels; |