• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CAF file anomalies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CAF file anomalies


  • Subject: Re: CAF file anomalies
  • From: james mccartney <email@hidden>
  • Date: Tue, 18 Nov 2008 17:49:06 -0800


On Nov 18, 2008, at 5:27 PM, William Bates wrote:


I've been parsing CAF files that I created with ExtAudioFile, and some Apple-distributed in various sample code.

I'm doing this on an Intel machine. Everything works well as long as you are very careful about Endian-ness.


However, I note the following anomalies and would like opinions on whether the following are me, known bugs, or worth filing bug reports on:

(1) Missing channels per frame in Audio Description Chunk.

An Audio Description Chunk Data is 32 bytes, whereas the fields described should take 36 bytes:
Size of Float64 = 8
Size of UInt32 = 4
8 + 7*4 = should be size = 36
sizeof(CAFAudioDescription) = 32
ChunkSize in file = 32

I'm not sure where you are getting your info but here is the struct as defined in CAFFile.h and on this page:
http://developer.apple.com/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/chapter_3_section_4.html

struct CAFAudioDescription
{
        Float64 mSampleRate;
        UInt32  mFormatID;
        UInt32  mFormatFlags;
        UInt32  mBytesPerPacket;
        UInt32  mFramesPerPacket;
        UInt32  mChannelsPerFrame;
        UInt32  mBitsPerChannel;
} ATTRIBUTE_PACKED;


So that is 8 + 6*4 = 32 bytes. So 32 bytes is correct.

Here's a hexdump of a CAF file:

00000000  63 61 66 66 00 01 00 00  64 65 73 63 00 00 00 00  |caff....desc....|
00000010  00 00 00 20 40 e5 88 80  00 00 00 00 61 61 63 20  |... @.......aac |
00000020  00 00 00 00 00 00 00 00  00 00 04 00 00 00 00 02  |................|
00000030  00 00 00 00 6b 75 6b 69  00 00 00 00 00 00 00 27  |....kuki.......'|
...

Here's the size of the chunk, 0x20 == 32 bytes:
00000010  00 00 00 20

The channels field is the last 4 bytes on this line == 2 channels:
00000020  00 00 00 00 00 00 00 00  00 00 04 00 00 00 00 02  |................|
                                                        



In practice, it seems that mChannelsPerFrame field is simply missing.

The Float64 does indeed seem to be a Float64.


 _______________________________________________
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

  • Follow-Ups:
    • Re: CAF file anomalies
      • From: William Bates <email@hidden>
References: 
 >CAF file anomalies (From: William Bates <email@hidden>)

  • Prev by Date: Question about the IOAudioEngine::clipOutputSamples()
  • Next by Date: Re: Question about the IOAudioEngine::clipOutputSamples()
  • Previous by thread: CAF file anomalies
  • Next by thread: Re: CAF file anomalies
  • Index(es):
    • Date
    • Thread