Changeset 1043
- Timestamp:
- 04/20/09 21:32:46 (11 months ago)
- Files:
-
- trunk/ff_private.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ff_private.c
r1042 r1043 235 235 cookie = create_cookie(codec, &cookieSize, asbd.mFormatID, map->vbr); 236 236 237 /* ask the toolbox about more information */238 // FIXME the cookie for AAC is wrong somehow, passing it in breaks FormatInfo & ASBDFromESDS239 // either fix it (like in MKV) or just ignore it240 if (asbd.mFormatID != kAudioFormatMPEG4AAC) {241 ioSize = sizeof(AudioStreamBasicDescription);242 err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, &cookie, &ioSize, &asbd);243 if (err || !asbd.mFormatID)244 fprintf(stderr, "AudioFormatGetProperty dislikes the magic cookie (error %ld / format id %lx)\n", err, asbd.mFormatID);245 }246 247 237 /* Set some fields of the AudioStreamBasicDescription. Then ask the AudioToolbox 248 238 * to fill as much as possible before creating the SoundDescriptionHandle */ … … 252 242 asbd.mBytesPerPacket = codec->block_align; /* this is tested for alaw/mulaw/msadpcm */ 253 243 244 /* ask the toolbox about more information */ 245 ioSize = sizeof(AudioStreamBasicDescription); 246 err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, cookie, &ioSize, &asbd); 247 if (err || !asbd.mFormatID) 248 fprintf(stderr, "AudioFormatGetProperty dislikes the magic cookie (error %ld / format id %lx)\n", err, asbd.mFormatID); 249 254 250 /* 255 251 FIXME: 256 252 - at least ffmp3 does not set these values without parsing+the decoder being enabled 257 253 (so we avoid overwriting them from above for now) 258 - it is unclear whether the ASBD values correspond to decoded or encoded data (same for lavc) 259 - this should be 0 for formats with variable framesPerPacket 260 - lavc frame_size is in bytes, mFramesPerPacket is in frames (maybe) 254 - this possibly should be 0 for formats with variable framesPerPacket like Vorbis 255 - lavc frame_size is in samples, mFramesPerPacket is in frames (maybe) 261 256 */ 262 257 if (!asbd.mFramesPerPacket) 263 258 asbd.mFramesPerPacket = codec->frame_size; 264 if (asbd.mFormatID == kAudioFormatMPEG4AAC) 265 asbd.mFramesPerPacket = 1024; 266 if (!asbd.mFramesPerPacket && !asbd.mBytesPerPacket) 259 if (!asbd.mFramesPerPacket && !asbd.mBytesPerPacket) //FIXME what is this for? 267 260 asbd.mFramesPerPacket = 1; 268 261 asbd.mBitsPerChannel = codec->bits_per_coded_sample; … … 332 325 fprintf(stderr, "AVI IMPORTER: Error %ld creating the sound description\n", err); 333 326 goto bail; 334 }335 336 // QTSoundDescriptionCreate sets this to 576 which is wrong337 if ((**sndHdl).version == 1 && asbd.mFormatID == kAudioFormatMPEGLayer3) {338 SoundDescriptionV1Handle v1h = (SoundDescriptionV1Handle)sndHdl;339 (**v1h).samplesPerPacket = 1152;340 327 } 341 328 }
