Mercurial > hg > svcore
comparison data/fileio/OggVorbisFileReader.cpp @ 620:3e139b2dfe5e
* Simpler & better fix for oggz 1.1.0 compatibility
author | Chris Cannam |
---|---|
date | Fri, 12 Mar 2010 13:03:53 +0000 |
parents | 268c5431936d |
children | 7feec7756b41 |
comparison
equal
deleted
inserted
replaced
619:268c5431936d | 620:3e139b2dfe5e |
---|---|
64 | 64 |
65 FishSoundInfo fsinfo; | 65 FishSoundInfo fsinfo; |
66 m_fishSound = fish_sound_new(FISH_SOUND_DECODE, &fsinfo); | 66 m_fishSound = fish_sound_new(FISH_SOUND_DECODE, &fsinfo); |
67 | 67 |
68 fish_sound_set_decoded_callback(m_fishSound, acceptFrames, this); | 68 fish_sound_set_decoded_callback(m_fishSound, acceptFrames, this); |
69 oggz_set_read_callback(m_oggz, -1, readPacket, this); | 69 oggz_set_read_callback(m_oggz, -1, (OggzReadPacket)readPacket, this); |
70 | 70 |
71 if (decodeMode == DecodeAtOnce) { | 71 if (decodeMode == DecodeAtOnce) { |
72 | 72 |
73 if (m_reporter) { | 73 if (m_reporter) { |
74 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled())); | 74 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled())); |
136 | 136 |
137 m_reader->endSerialised(); | 137 m_reader->endSerialised(); |
138 } | 138 } |
139 | 139 |
140 int | 140 int |
141 OggVorbisFileReader::readPacket(OGGZ *, oggz_packet *packet, long, void *data) | 141 OggVorbisFileReader::readPacket(OGGZ *, ogg_packet *packet, long, void *data) |
142 { | 142 { |
143 OggVorbisFileReader *reader = (OggVorbisFileReader *)data; | 143 OggVorbisFileReader *reader = (OggVorbisFileReader *)data; |
144 FishSound *fs = reader->m_fishSound; | 144 FishSound *fs = reader->m_fishSound; |
145 | 145 |
146 fish_sound_prepare_truncation(fs, packet->op.granulepos, packet->op.e_o_s); | 146 fish_sound_prepare_truncation(fs, packet->granulepos, packet->e_o_s); |
147 fish_sound_decode(fs, packet->op.packet, packet->op.bytes); | 147 fish_sound_decode(fs, packet->packet, packet->bytes); |
148 | 148 |
149 reader->m_bytesRead += packet->op.bytes; | 149 reader->m_bytesRead += packet->bytes; |
150 | 150 |
151 // The number of bytes read by this function is smaller than | 151 // The number of bytes read by this function is smaller than |
152 // the file size because of the packet headers | 152 // the file size because of the packet headers |
153 int p = lrint(double(reader->m_bytesRead) * 114 / | 153 int p = lrint(double(reader->m_bytesRead) * 114 / |
154 double(reader->m_fileSize)); | 154 double(reader->m_fileSize)); |