[vorbis-dev] CVS, etc...

Jeff Smith
2001-03-01T23:58:55Z

I apologize for posting to both groups.  I knew which to send it to, but I
somehow missed that little thing.  So much for first impressions.
  Thanks for the hints about Reverse DNS.  I will check that out soon.
  I didn't know how you wanted the patch, so I am just inserting the diff
output here.  If you need something different (or for future reference), let
me know.

24c24
<
(((buf)[3]<<24)|((buf)[2]<<16)|((buf)[1]<<8)|((buf)[0]&0xff));

---
>
(((buf)[3]<<24)|((buf)[2]<<16)|((buf)[1]<<8)|((buf)[0]&0xff))
27c27
< 	(((buf)[1]<<8)|((buf)[0]&0xff));
---
>	(((buf)[1]<<8)|((buf)[0]&0xff))
30c30
<
(((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff));
---
>
(((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff))
33c33
< 	(((buf)[0]<<8)|((buf)[1]&0xff));
---
>	(((buf)[0]<<8)|((buf)[1]&0xff))
337c337
< 	unsigned char buf[16];
---
>	unsigned char buf[18];
352,353c352
< 	if(len!=16)
< 	{
---
>	if ((len!=16) && (len!=18)) {
358,359c357
< 	if(fread(buf,1,16,in) < 16)
< 	{
---
>	if(fread(buf,1,len,in) < len) {
369a368,371
>	if ((len==18) && (READ_U16_LE(buf+16)!=0)) {
>		fprintf(stderr, "Warning: Unrecognised format chunk in WAV
header\n");
>		return 0;
>	}

Reasoning:
    Some programs seem to treat the 'fmt ' section of a standard,
uncompressed WAV slightly differently.  Some specs show an extra word,
cbSize, which tells how many extra bytes there are in the section.
    This word may be thrown out with normal uncompressed WAVs, making the
size of the 'fmt ' section to be 16.  But these programs don't,
leaving it
size 18.  If the data in this extra word is anything besides 0, there is an
inconsistency.

Specific items:
    The ; on the macro definitions is redundant (take a look at 'gcc -E
audio.c' if you need more convincing).  If you do not use the macro at the
*very* end of a statement, it causes errors.  This change should be effected
regardless of whether the rest is.  But other parts of my changes rely on
this.
    increasing buf size from 16 to 18.  The size of the alternate header is
one word longer.
    if ((len!=16) && (len!=18))  Check for both header sizes.
    if(fread(buf,1,len,in) < len)  16 and 18 are the only possible values of
len, if we got this, far and we take care of both.
    if ((len==18) && (READ_U16_LE(buf+16)!=0))  The extra word must
contain
the data 0x0000.

  - Hope I didn't get too wordy