• 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, testing chunk types?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CAF file, testing chunk types?


  • Subject: Re: CAF file, testing chunk types?
  • From: Brian Willoughby <email@hidden>
  • Date: Wed, 30 Sep 2009 20:35:03 -0700

Darren,

An ASCII string is a sequence of bytes, and thus there is no difference between big-endian and little-endian. It's only when you deal with multi-byte numbers such as 16-bit integer or 32-bit integer or others that you must translate.

Brian Willoughby
Sound Consulting


On Sep 30, 2009, at 20:15, Darren Minifie wrote: I have one other related question about CAF files and endian-ness:

I have a method that looks at an NSData object (which is a CAF file in memory). The method finds the chunk type and stores it as a string. In the spec, the chunk type is defined as a UInt32, and is a seuqence of 4 chars. Here is my method which produces correct output on a little endian machine:

-(NSString*)fileType{

if(!fileType){
char type [5];
type[4] = '\0';
memcpy(type, (char*)[fileData bytes], 4);
fileType = [[NSString stringWithCString:type encoding:NSASCIIStringEncoding] retain];
}
return fileType;
}


If CAF files are in big-endian format, why does this method produce the correct result? In other words why don't have i have to do a ntohl () in this case to flip the enianness, like i have to in the case of reading the chunk length etc.

Thanks again.

_______________________________________________
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, testing chunk types?
      • From: Darren Minifie <email@hidden>
References: 
 >CAF file, testing chunk types? (From: Darren Minifie <email@hidden>)
 >Re: CAF file, testing chunk types? (From: William Stewart <email@hidden>)
 >Re: CAF file, testing chunk types? (From: Darren Minifie <email@hidden>)

  • Prev by Date: Re: CAF file, testing chunk types?
  • Next by Date: iPhoneMultichannelMixerTest And 3DMixer
  • Previous by thread: Re: CAF file, testing chunk types?
  • Next by thread: Re: CAF file, testing chunk types?
  • Index(es):
    • Date
    • Thread