ref: e8e76b1a07d1925c34debc75c6cba86910cab44e
parent: 876f21808513d24b82838b0558c71dce9a414f0e
author: cbagwell <cbagwell>
date: Thu Nov 9 12:56:46 EST 2000
Added partial support to handle AIFC files. Only uncompressed audio though.
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,10 @@
compiled on a box that doesn't have a sound card but the OS supports
it (which is the enviornment of most distributions creating new
binaries).
+ o Added support to partially handle AIFC files but only uncompressed
+ versions. This should allow people to work with raw CD audio data
+ on Mac OSX and also gives a basis for adding future support for
+ things like ADPCM processing.
sox-12.17
---------
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -119,9 +119,10 @@
return(ST_EOF);
}
st_readdw(ft, &totalsize);
- if (st_reads(ft, buf, 4) == ST_EOF || strncmp(buf, "AIFF", 4) != 0)
+ if (st_reads(ft, buf, 4) == ST_EOF || (strncmp(buf, "AIFF", 4) != 0 &&
+ strncmp(buf, "AIFC", 4) != 0))
{
- st_fail("AIFF 'FORM' chunk does not specify 'AIFF' as type");
+ st_fail("AIFF 'FORM' chunk does not specify 'AIFF' or 'AIFC' as type");
return(ST_EOF);
}
@@ -142,15 +143,24 @@
if (strncmp(buf, "COMM", 4) == 0) {
/* COMM chunk */
st_readdw(ft, &chunksize);
- if (chunksize != 18)
- {
- st_fail("AIFF COMM chunk has bad size");
- return(ST_EOF);
- }
st_readw(ft, &channels);
st_readdw(ft, &frames);
st_readw(ft, &bits);
rate = read_ieee_extended(ft);
+ chunksize -= 18;
+ if (chunksize > 0)
+ {
+ st_reads(ft, buf, 4);
+ chunksize -= 4;
+ if (strncmp(buf, "NONE", 4) != 0)
+ {
+ buf[4] = 0;
+ st_fail("Can not support AIFC files that contain compressed data: %s",buf);
+ return(ST_EOF);
+ }
+ }
+ while(chunksize-- > 0)
+ st_readb(ft, (unsigned char *)&trash);
foundcomm = 1;
}
else if (strncmp(buf, "SSND", 4) == 0) {