comparison data/fileio/QuickTimeFileReader.cpp @ 309:bbf87199e6e1

* double -> float -- at least until I'm reminded of why it was double before
author Chris Cannam
date Wed, 10 Oct 2007 15:30:00 +0000
parents c022976d18e8
children 246dbda60798
comparison
equal deleted inserted replaced
308:14e0f60435b8 309:bbf87199e6e1
38 public: 38 public:
39 D() : data(0), blockSize(1024) { } 39 D() : data(0), blockSize(1024) { }
40 40
41 MovieAudioExtractionRef extractionSessionRef; 41 MovieAudioExtractionRef extractionSessionRef;
42 AudioBufferList buffer; 42 AudioBufferList buffer;
43 double *data; 43 float *data;
44 OSErr err; 44 OSErr err;
45 AudioStreamBasicDescription asbd; 45 AudioStreamBasicDescription asbd;
46 Movie movie; 46 Movie movie;
47 size_t blockSize; 47 size_t blockSize;
48 }; 48 };
187 187
188 m_d->asbd.mFormatFlags = 188 m_d->asbd.mFormatFlags =
189 kAudioFormatFlagIsFloat | 189 kAudioFormatFlagIsFloat |
190 kAudioFormatFlagIsPacked | 190 kAudioFormatFlagIsPacked |
191 kAudioFormatFlagsNativeEndian; 191 kAudioFormatFlagsNativeEndian;
192 m_d->asbd.mBitsPerChannel = sizeof(double) * 8; 192 m_d->asbd.mBitsPerChannel = sizeof(float) * 8;
193 m_d->asbd.mBytesPerFrame = sizeof(double) * m_d->asbd.mChannelsPerFrame; 193 m_d->asbd.mBytesPerFrame = sizeof(float) * m_d->asbd.mChannelsPerFrame;
194 m_d->asbd.mBytesPerPacket = m_d->asbd.mBytesPerFrame; 194 m_d->asbd.mBytesPerPacket = m_d->asbd.mBytesPerFrame;
195 195
196 m_d->err = MovieAudioExtractionSetProperty 196 m_d->err = MovieAudioExtractionSetProperty
197 (m_d->extractionSessionRef, 197 (m_d->extractionSessionRef,
198 kQTPropertyClass_MovieAudioExtraction_Audio, 198 kQTPropertyClass_MovieAudioExtraction_Audio,
202 202
203 if (m_d->err) { 203 if (m_d->err) {
204 m_error = QString("Error in QuickTime decoder property set: code %1").arg(m_d->err); 204 m_error = QString("Error in QuickTime decoder property set: code %1").arg(m_d->err);
205 return; 205 return;
206 } 206 }
207
208 m_d->buffer.mNumberBuffers = 1; 207 m_d->buffer.mNumberBuffers = 1;
209 m_d->buffer.mBuffers[0].mNumberChannels = m_channelCount; 208 m_d->buffer.mBuffers[0].mNumberChannels = m_channelCount;
210 m_d->buffer.mBuffers[0].mDataByteSize = 209 m_d->buffer.mBuffers[0].mDataByteSize =
211 sizeof(double) * m_channelCount * m_d->blockSize; 210 sizeof(float) * m_channelCount * m_d->blockSize;
212 m_d->data = new double[m_channelCount * m_d->blockSize]; 211 m_d->data = new float[m_channelCount * m_d->blockSize];
213 m_d->buffer.mBuffers[0].mData = m_d->data; 212 m_d->buffer.mBuffers[0].mData = m_d->data;
214 213
215 initialiseDecodeCache(); 214 initialiseDecodeCache();
216 215
217 if (decodeMode == DecodeAtOnce) { 216 if (decodeMode == DecodeAtOnce) {