[Live-devel] streaming WAV files...

Matthew Romaine Matthew.Romaine at jp.sony.com
Thu Apr 15 18:35:18 PDT 2004

Hi Ross,

back the byte-swapping again, and am hoping for a sanity check:

i'm adapting the WAV code you've written, and looking at the get*Bytes, 
it looks like you're swapping the order; i.e., reading the file which 
is in little-endian, but swapping the return val to be in big-endian.  
This confused me at first since you use this returned value as a check, 
but the checks are so rudimentary (retval == 0, etc.), that it doesn't 
matter if the value is big/little endian.

i'm curious why you took this approach of bothering to swap (assuming 
my reading of the code is correct...).  It's great for me, since i'm 
running on a mac and I need values in big-endian, but a port to intel 
chips while implementing stricter error-checking would need a 


On 2004/04/08, at 22:37, Ross Finlayson wrote:

> At 03:25 AM 4/8/04, you wrote:
>> Before I post anything, a quick glance through the code doesn't seem 
>> to account for endian-ness.
> Yes it does.  If you look at the functions "get4Bytes()" and 
> "get2Bytes()" in the file "liveMedia/WAVAudioFileSource.cpp" (which is 
> where WAV audio files are read and parsed), you'll see that 4 and 
> 2-byte structures within WAV files are read as little-endian, 
> regardless of the endianness of the host computer.
>>  I'm serving from a mac (OSX), so my guess is I'm reading the file as 
>> little endian.
> As it should - because WAV audio files are assumed to be always little 
> endian.
> If this is incorrect - i.e., if WAV files can be either little *or* 
> big-endian, and there's some flag somewhere in the file's header that 
> indicates this, then let me know.
> 	Ross Finlayson
> 	<http://www.live.com/>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live.com
> http://lists.live.com/mailman/listinfo/live-devel
Matthew M.I. Romaine
IMNC Audio Codec Group
Sony Corporation
phone: 03-5448-6065
fax: 03-5448-5617

More information about the live-devel mailing list