[xiph-commits] r8125 - trunk/theora/examples
tterribe at motherfish-iii.xiph.org
tterribe at motherfish-iii.xiph.org
Wed Oct 27 10:54:20 PDT 2004
Author: tterribe
Date: 2004-10-27 10:54:20 -0700 (Wed, 27 Oct 2004)
New Revision: 8125
Modified:
trunk/theora/examples/encoder_example.c
Log:
Applied patch to handle extra data in the WAV header from Aaron Colwell.
Modified: trunk/theora/examples/encoder_example.c
===================================================================
--- trunk/theora/examples/encoder_example.c 2004-10-27 17:52:39 UTC (rev 8124)
+++ trunk/theora/examples/encoder_example.c 2004-10-27 17:54:20 UTC (rev 8125)
@@ -133,6 +133,7 @@
unsigned char buffer[80];
int ret;
int tmp_video_hzn, tmp_video_hzd, tmp_video_an, tmp_video_ad;
+ int extra_hdr_bytes;
/* open it, look for magic */
@@ -179,6 +180,9 @@
ret=fread(buffer,1,20,test);
if(ret<20)goto riff_err;
+ extra_hdr_bytes = (buffer[0] + (buffer[1] << 8) +
+ (buffer[2] << 16) + (buffer[3] << 24)) - 16;
+
if(memcmp(buffer+4,"\001\000",2)){
fprintf(stderr,"The WAV file %s is in a compressed format; "
"can't read it.\n",f);
@@ -195,6 +199,18 @@
exit(1);
}
+ /* read past extra header bytes */
+ while(extra_hdr_bytes){
+ int read_size = (extra_hdr_bytes > sizeof(buffer)) ?
+ sizeof(buffer) : extra_hdr_bytes;
+ ret = fread(buffer, 1, read_size, test);
+
+ if (ret < read_size)
+ goto riff_err;
+ else
+ extra_hdr_bytes -= read_size;
+ }
+
/* Now, align things to the beginning of the data */
/* Look for 'dataxxxx' */
while(!feof(test)){
More information about the commits
mailing list