Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
AudioFileGetProperty values, reading an MP3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioFileGetProperty values, reading an MP3



I am reading an MP3 using AudioFileReadPackets and I've come across something strange.  After reading the documentation and looking at some examples I am unable to reconcile why the calculated buffer size does not match the byte count I get from AudioFileGetProperty.

err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataPacketCount, &dataSize, &packetCount);

err = AudioFileGetProperty(audioFile, kAudioFilePropertyMaximumPacketSize, &dataSize, &maxPacketSize);

err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataByteCount, &dataSize, &byteCount);

I create a buffer based on the number of packets multiplied by the packet count.  The byte count does not match when opening mp3's

buffer = calloc( 1, packetCount * maxPacketSize );

mp3: packetCount * maxPacketSize > byteCount
wave: packetCount * maxPacketSize == byteCount

I thought the multiplication method would be correct however when I inspect the buffer, there is no sound data in the difference between the two sizes.

Should I always use kAudioFilePropertyAudioDataByteCount to determine my buffer size?  Shouldn't these methods always match perfectly?


Thanks,


W.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.