[xiph-commits] r11665 - trunk/vorbis-tools/oggenc

msmith at svn.xiph.org msmith at svn.xiph.org
Thu Jun 29 04:01:07 PDT 2006


Author: msmith
Date: 2006-06-29 04:00:57 -0700 (Thu, 29 Jun 2006)
New Revision: 11665

Modified:
   trunk/vorbis-tools/oggenc/audio.c
   trunk/vorbis-tools/oggenc/audio.h
   trunk/vorbis-tools/oggenc/easyflac.c
   trunk/vorbis-tools/oggenc/easyflac.h
   trunk/vorbis-tools/oggenc/encode.c
   trunk/vorbis-tools/oggenc/encode.h
   trunk/vorbis-tools/oggenc/flac.c
   trunk/vorbis-tools/oggenc/flac.h
   trunk/vorbis-tools/oggenc/oggenc.c
   trunk/vorbis-tools/oggenc/platform.c
   trunk/vorbis-tools/oggenc/resample.c
   trunk/vorbis-tools/oggenc/resample.h
Log:
Convert tabs to spaces. Remove accidently committed debug line


Modified: trunk/vorbis-tools/oggenc/audio.c
===================================================================
--- trunk/vorbis-tools/oggenc/audio.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/audio.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -32,301 +32,301 @@
 
 /* Macros to read header data */
 #define READ_U32_LE(buf) \
-	(((buf)[3]<<24)|((buf)[2]<<16)|((buf)[1]<<8)|((buf)[0]&0xff))
+    (((buf)[3]<<24)|((buf)[2]<<16)|((buf)[1]<<8)|((buf)[0]&0xff))
 
 #define READ_U16_LE(buf) \
-	(((buf)[1]<<8)|((buf)[0]&0xff))
+    (((buf)[1]<<8)|((buf)[0]&0xff))
 
 #define READ_U32_BE(buf) \
-	(((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff))
+    (((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff))
 
 #define READ_U16_BE(buf) \
-	(((buf)[0]<<8)|((buf)[1]&0xff))
+    (((buf)[0]<<8)|((buf)[1]&0xff))
 
 /* Define the supported formats here */
 input_format formats[] = {
-	{wav_id, 12, wav_open, wav_close, "wav", N_("WAV file reader")},
-	{aiff_id, 12, aiff_open, wav_close, "aiff", N_("AIFF/AIFC file reader")},
+    {wav_id, 12, wav_open, wav_close, "wav", N_("WAV file reader")},
+    {aiff_id, 12, aiff_open, wav_close, "aiff", N_("AIFF/AIFC file reader")},
 #ifdef HAVE_LIBFLAC
-	{flac_id,     4, flac_open, flac_close, "flac", N_("FLAC file reader")},
-	{oggflac_id, 32, flac_open, flac_close, "ogg", N_("Ogg FLAC file reader")},
+    {flac_id,     4, flac_open, flac_close, "flac", N_("FLAC file reader")},
+    {oggflac_id, 32, flac_open, flac_close, "ogg", N_("Ogg FLAC file reader")},
 #endif
-	{NULL, 0, NULL, NULL, NULL, NULL}
+    {NULL, 0, NULL, NULL, NULL, NULL}
 };
 
 input_format *open_audio_file(FILE *in, oe_enc_opt *opt)
 {
-	int j=0;
-	unsigned char *buf=NULL;
-	int buf_size=0, buf_filled=0;
-	int size,ret;
+    int j=0;
+    unsigned char *buf=NULL;
+    int buf_size=0, buf_filled=0;
+    int size,ret;
 
-	while(formats[j].id_func)
-	{
-		size = formats[j].id_data_len;
-		if(size >= buf_size)
-		{
-			buf = realloc(buf, size);
-			buf_size = size;
-		}
+    while(formats[j].id_func)
+    {
+        size = formats[j].id_data_len;
+        if(size >= buf_size)
+        {
+            buf = realloc(buf, size);
+            buf_size = size;
+        }
 
-		if(size > buf_filled)
-		{
-			ret = fread(buf+buf_filled, 1, buf_size-buf_filled, in);
-			buf_filled += ret;
+        if(size > buf_filled)
+        {
+            ret = fread(buf+buf_filled, 1, buf_size-buf_filled, in);
+            buf_filled += ret;
 
-			if(buf_filled < size)
-			{ /* File truncated */
-				j++;
-				continue;
-			}
-		}
+            if(buf_filled < size)
+            { /* File truncated */
+                j++;
+                continue;
+            }
+        }
 
-		if(formats[j].id_func(buf, buf_filled))
-		{
-			/* ok, we now have something that can handle the file */
-			if(formats[j].open_func(in, opt, buf, buf_filled)) {
+        if(formats[j].id_func(buf, buf_filled))
+        {
+            /* ok, we now have something that can handle the file */
+            if(formats[j].open_func(in, opt, buf, buf_filled)) {
                 free(buf);
-				return &formats[j];
+                return &formats[j];
             }
-		}
-		j++;
-	}
+        }
+        j++;
+    }
 
     free(buf);
 
-	return NULL;
+    return NULL;
 }
 
 static int seek_forward(FILE *in, int length)
 {
-	if(fseek(in, length, SEEK_CUR))
-	{
-		/* Failed. Do it the hard way. */
-		unsigned char buf[1024];
-		int seek_needed = length, seeked;
-		while(seek_needed > 0)
-		{
-			seeked = fread(buf, 1, seek_needed>1024?1024:seek_needed, in);
-			if(!seeked)
-				return 0; /* Couldn't read more, can't read file */
-			else
-				seek_needed -= seeked;
-		}
-	}
-	return 1;
+    if(fseek(in, length, SEEK_CUR))
+    {
+        /* Failed. Do it the hard way. */
+        unsigned char buf[1024];
+        int seek_needed = length, seeked;
+        while(seek_needed > 0)
+        {
+            seeked = fread(buf, 1, seek_needed>1024?1024:seek_needed, in);
+            if(!seeked)
+                return 0; /* Couldn't read more, can't read file */
+            else
+                seek_needed -= seeked;
+        }
+    }
+    return 1;
 }
 
 
 static int find_wav_chunk(FILE *in, char *type, unsigned int *len)
 {
-	unsigned char buf[8];
+    unsigned char buf[8];
 
-	while(1)
-	{
-		if(fread(buf,1,8,in) < 8) /* Suck down a chunk specifier */
-		{
-			fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n"));
-			return 0; /* EOF before reaching the appropriate chunk */
-		}
+    while(1)
+    {
+        if(fread(buf,1,8,in) < 8) /* Suck down a chunk specifier */
+        {
+            fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n"));
+            return 0; /* EOF before reaching the appropriate chunk */
+        }
 
-		if(memcmp(buf, type, 4))
-		{
-			*len = READ_U32_LE(buf+4);
-			if(!seek_forward(in, *len))
-				return 0;
+        if(memcmp(buf, type, 4))
+        {
+            *len = READ_U32_LE(buf+4);
+            if(!seek_forward(in, *len))
+                return 0;
 
-			buf[4] = 0;
-			fprintf(stderr, _("Skipping chunk of type \"%s\", length %d\n"), buf, *len);
-		}
-		else
-		{
-			*len = READ_U32_LE(buf+4);
-			return 1;
-		}
-	}
+            buf[4] = 0;
+            fprintf(stderr, _("Skipping chunk of type \"%s\", length %d\n"), buf, *len);
+        }
+        else
+        {
+            *len = READ_U32_LE(buf+4);
+            return 1;
+        }
+    }
 }
 
 static int find_aiff_chunk(FILE *in, char *type, unsigned int *len)
 {
-	unsigned char buf[8];
+    unsigned char buf[8];
 
-	while(1)
-	{
-		if(fread(buf,1,8,in) <8)
-		{
-			fprintf(stderr, _("Warning: Unexpected EOF in AIFF chunk\n"));
-			return 0;
-		}
+    while(1)
+    {
+        if(fread(buf,1,8,in) <8)
+        {
+            fprintf(stderr, _("Warning: Unexpected EOF in AIFF chunk\n"));
+            return 0;
+        }
 
-		*len = READ_U32_BE(buf+4);
+        *len = READ_U32_BE(buf+4);
 
-		if(memcmp(buf,type,4))
-		{
-			if((*len) & 0x1)
-				(*len)++;
+        if(memcmp(buf,type,4))
+        {
+            if((*len) & 0x1)
+                (*len)++;
 
-			if(!seek_forward(in, *len))
-				return 0;
-		}
-		else
-			return 1;
-	}
+            if(!seek_forward(in, *len))
+                return 0;
+        }
+        else
+            return 1;
+    }
 }
 
 
 
 double read_IEEE80(unsigned char *buf)
 {
-	int s=buf[0]&0xff;
-	int e=((buf[0]&0x7f)<<8)|(buf[1]&0xff);
-	double f=((unsigned long)(buf[2]&0xff)<<24)|
-		((buf[3]&0xff)<<16)|
-		((buf[4]&0xff)<<8) |
-		 (buf[5]&0xff);
+    int s=buf[0]&0xff;
+    int e=((buf[0]&0x7f)<<8)|(buf[1]&0xff);
+    double f=((unsigned long)(buf[2]&0xff)<<24)|
+        ((buf[3]&0xff)<<16)|
+        ((buf[4]&0xff)<<8) |
+         (buf[5]&0xff);
 
-	if(e==32767)
-	{
-		if(buf[2]&0x80)
-			return HUGE_VAL; /* Really NaN, but this won't happen in reality */
-		else
-		{
-			if(s)
-				return -HUGE_VAL;
-			else
-				return HUGE_VAL;
-		}
-	}
+    if(e==32767)
+    {
+        if(buf[2]&0x80)
+            return HUGE_VAL; /* Really NaN, but this won't happen in reality */
+        else
+        {
+            if(s)
+                return -HUGE_VAL;
+            else
+                return HUGE_VAL;
+        }
+    }
 
-	f=ldexp(f,32);
-	f+= ((buf[6]&0xff)<<24)|
-		((buf[7]&0xff)<<16)|
-		((buf[8]&0xff)<<8) |
-		 (buf[9]&0xff);
+    f=ldexp(f,32);
+    f+= ((buf[6]&0xff)<<24)|
+        ((buf[7]&0xff)<<16)|
+        ((buf[8]&0xff)<<8) |
+         (buf[9]&0xff);
 
-	return ldexp(f, e-16446);
+    return ldexp(f, e-16446);
 }
 
 /* AIFF/AIFC support adapted from the old OggSQUISH application */
 int aiff_id(unsigned char *buf, int len)
 {
-	if(len<12) return 0; /* Truncated file, probably */
+    if(len<12) return 0; /* Truncated file, probably */
 
-	if(memcmp(buf, "FORM", 4))
-		return 0;
+    if(memcmp(buf, "FORM", 4))
+        return 0;
 
-	if(memcmp(buf+8, "AIF",3))
-		return 0;
+    if(memcmp(buf+8, "AIF",3))
+        return 0;
 
-	if(buf[11]!='C' && buf[11]!='F')
-		return 0;
+    if(buf[11]!='C' && buf[11]!='F')
+        return 0;
 
-	return 1;
+    return 1;
 }
 
 int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
 {
-	int aifc; /* AIFC or AIFF? */
-	unsigned int len;
-	unsigned char *buffer;
-	unsigned char buf2[8];
-	aiff_fmt format;
-	aifffile *aiff = malloc(sizeof(aifffile));
+    int aifc; /* AIFC or AIFF? */
+    unsigned int len;
+    unsigned char *buffer;
+    unsigned char buf2[8];
+    aiff_fmt format;
+    aifffile *aiff = malloc(sizeof(aifffile));
     int i;
 
-	if(buf[11]=='C')
-		aifc=1;
-	else
-		aifc=0;
+    if(buf[11]=='C')
+        aifc=1;
+    else
+        aifc=0;
 
-	if(!find_aiff_chunk(in, "COMM", &len))
-	{
-		fprintf(stderr, _("Warning: No common chunk found in AIFF file\n"));
-		return 0; /* EOF before COMM chunk */
-	}
+    if(!find_aiff_chunk(in, "COMM", &len))
+    {
+        fprintf(stderr, _("Warning: No common chunk found in AIFF file\n"));
+        return 0; /* EOF before COMM chunk */
+    }
 
-	if(len < 18) 
-	{
-		fprintf(stderr, _("Warning: Truncated common chunk in AIFF header\n"));
-		return 0; /* Weird common chunk */
-	}
+    if(len < 18) 
+    {
+        fprintf(stderr, _("Warning: Truncated common chunk in AIFF header\n"));
+        return 0; /* Weird common chunk */
+    }
 
-	buffer = alloca(len);
+    buffer = alloca(len);
 
-	if(fread(buffer,1,len,in) < len)
-	{
-		fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
-		return 0;
-	}
+    if(fread(buffer,1,len,in) < len)
+    {
+        fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
+        return 0;
+    }
 
-	format.channels = READ_U16_BE(buffer);
-	format.totalframes = READ_U32_BE(buffer+2);
-	format.samplesize = READ_U16_BE(buffer+6);
-	format.rate = (int)read_IEEE80(buffer+8);
+    format.channels = READ_U16_BE(buffer);
+    format.totalframes = READ_U32_BE(buffer+2);
+    format.samplesize = READ_U16_BE(buffer+6);
+    format.rate = (int)read_IEEE80(buffer+8);
 
     aiff->bigendian = 1;
 
-	if(aifc)
-	{
-		if(len < 22)
-		{
-			fprintf(stderr, _("Warning: AIFF-C header truncated.\n"));
-			return 0;
-		}
+    if(aifc)
+    {
+        if(len < 22)
+        {
+            fprintf(stderr, _("Warning: AIFF-C header truncated.\n"));
+            return 0;
+        }
 
-		if(!memcmp(buffer+18, "NONE", 4)) 
-		{
-			aiff->bigendian = 1;
-		}
-		else if(!memcmp(buffer+18, "sowt", 4)) 
-		{
-			aiff->bigendian = 0;
-		}
-		else
-		{
-			fprintf(stderr, _("Warning: Can't handle compressed AIFF-C (%c%c%c%c)\n"), *(buffer+18), *(buffer+19), *(buffer+20), *(buffer+21));
-			return 0; /* Compressed. Can't handle */
-		}
-	}
+        if(!memcmp(buffer+18, "NONE", 4)) 
+        {
+            aiff->bigendian = 1;
+        }
+        else if(!memcmp(buffer+18, "sowt", 4)) 
+        {
+            aiff->bigendian = 0;
+        }
+        else
+        {
+            fprintf(stderr, _("Warning: Can't handle compressed AIFF-C (%c%c%c%c)\n"), *(buffer+18), *(buffer+19), *(buffer+20), *(buffer+21));
+            return 0; /* Compressed. Can't handle */
+        }
+    }
 
-	if(!find_aiff_chunk(in, "SSND", &len))
-	{
-		fprintf(stderr, _("Warning: No SSND chunk found in AIFF file\n"));
-		return 0; /* No SSND chunk -> no actual audio */
-	}
+    if(!find_aiff_chunk(in, "SSND", &len))
+    {
+        fprintf(stderr, _("Warning: No SSND chunk found in AIFF file\n"));
+        return 0; /* No SSND chunk -> no actual audio */
+    }
 
-	if(len < 8) 
-	{
-		fprintf(stderr, _("Warning: Corrupted SSND chunk in AIFF header\n"));
-		return 0; 
-	}
+    if(len < 8) 
+    {
+        fprintf(stderr, _("Warning: Corrupted SSND chunk in AIFF header\n"));
+        return 0; 
+    }
 
-	if(fread(buf2,1,8, in) < 8)
-	{
-		fprintf(stderr, _("Warning: Unexpected EOF reading AIFF header\n"));
-		return 0;
-	}
+    if(fread(buf2,1,8, in) < 8)
+    {
+        fprintf(stderr, _("Warning: Unexpected EOF reading AIFF header\n"));
+        return 0;
+    }
 
-	format.offset = READ_U32_BE(buf2);
-	format.blocksize = READ_U32_BE(buf2+4);
+    format.offset = READ_U32_BE(buf2);
+    format.blocksize = READ_U32_BE(buf2+4);
 
-	if( format.blocksize == 0 &&
-		(format.samplesize == 16 || format.samplesize == 8))
-	{
-		/* From here on, this is very similar to the wav code. Oh well. */
-		
-		opt->rate = format.rate;
-		opt->channels = format.channels;
-		opt->read_samples = wav_read; /* Similar enough, so we use the same */
-		opt->total_samples_per_channel = format.totalframes;
+    if( format.blocksize == 0 &&
+        (format.samplesize == 16 || format.samplesize == 8))
+    {
+        /* From here on, this is very similar to the wav code. Oh well. */
+        
+        opt->rate = format.rate;
+        opt->channels = format.channels;
+        opt->read_samples = wav_read; /* Similar enough, so we use the same */
+        opt->total_samples_per_channel = format.totalframes;
 
-		aiff->f = in;
-		aiff->samplesread = 0;
-		aiff->channels = format.channels;
-		aiff->samplesize = format.samplesize;
-		aiff->totalsamples = format.totalframes;
+        aiff->f = in;
+        aiff->samplesread = 0;
+        aiff->channels = format.channels;
+        aiff->samplesize = format.samplesize;
+        aiff->totalsamples = format.totalframes;
 
-		opt->readdata = (void *)aiff;
+        opt->readdata = (void *)aiff;
 
         aiff->channel_permute = malloc(aiff->channels * sizeof(int));
         /* Use a default 1-1 mapping, not sure what the spec says */
@@ -334,34 +334,34 @@
             aiff->channel_permute[i] = i;
 
 
-		seek_forward(in, format.offset); /* Swallow some data */
-		return 1;
-	}
-	else
-	{
-		fprintf(stderr, 
-				_("Warning: OggEnc does not support this type of AIFF/AIFC file\n"
-				" Must be 8 or 16 bit PCM.\n"));
-		return 0;
-	}
+        seek_forward(in, format.offset); /* Swallow some data */
+        return 1;
+    }
+    else
+    {
+        fprintf(stderr, 
+                _("Warning: OggEnc does not support this type of AIFF/AIFC file\n"
+                " Must be 8 or 16 bit PCM.\n"));
+        return 0;
+    }
 }
 
 
 int wav_id(unsigned char *buf, int len)
 {
-	unsigned int flen;
-	
-	if(len<12) return 0; /* Something screwed up */
+    unsigned int flen;
+    
+    if(len<12) return 0; /* Something screwed up */
 
-	if(memcmp(buf, "RIFF", 4))
-		return 0; /* Not wave */
+    if(memcmp(buf, "RIFF", 4))
+        return 0; /* Not wave */
 
-	flen = READ_U32_LE(buf+4); /* We don't use this */
+    flen = READ_U32_LE(buf+4); /* We don't use this */
 
-	if(memcmp(buf+8, "WAVE",4))
-		return 0; /* RIFF, but not wave */
+    if(memcmp(buf+8, "WAVE",4))
+        return 0; /* RIFF, but not wave */
 
-	return 1;
+    return 1;
 }
 
 static int wav_permute_matrix[6][6] = 
@@ -376,77 +376,77 @@
 
 int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
 {
-	unsigned char buf[16];
-	unsigned int len;
-	int samplesize;
-	wav_fmt format;
-	wavfile *wav = malloc(sizeof(wavfile));
+    unsigned char buf[16];
+    unsigned int len;
+    int samplesize;
+    wav_fmt format;
+    wavfile *wav = malloc(sizeof(wavfile));
     int i;
 
-	/* Ok. At this point, we know we have a WAV file. Now we have to detect
-	 * whether we support the subtype, and we have to find the actual data
-	 * We don't (for the wav reader) need to use the buffer we used to id this
-	 * as a wav file (oldbuf)
-	 */
+    /* Ok. At this point, we know we have a WAV file. Now we have to detect
+     * whether we support the subtype, and we have to find the actual data
+     * We don't (for the wav reader) need to use the buffer we used to id this
+     * as a wav file (oldbuf)
+     */
 
-	if(!find_wav_chunk(in, "fmt ", &len))
-		return 0; /* EOF */
+    if(!find_wav_chunk(in, "fmt ", &len))
+        return 0; /* EOF */
 
-	if(len < 16) 
-	{
-		fprintf(stderr, _("Warning: Unrecognised format chunk in WAV header\n"));
-		return 0; /* Weird format chunk */
-	}
+    if(len < 16) 
+    {
+        fprintf(stderr, _("Warning: Unrecognised format chunk in WAV header\n"));
+        return 0; /* Weird format chunk */
+    }
 
-	/* A common error is to have a format chunk that is not 16 or 18 bytes
-	 * in size.  This is incorrect, but not fatal, so we only warn about 
-	 * it instead of refusing to work with the file.  Please, if you
-	 * have a program that's creating format chunks of sizes other than
-	 * 16 or 18 bytes in size, report a bug to the author.
-	 */
-	if(len!=16 && len!=18)
-		fprintf(stderr, 
-				_("Warning: INVALID format chunk in wav header.\n"
-				" Trying to read anyway (may not work)...\n"));
+    /* A common error is to have a format chunk that is not 16 or 18 bytes
+     * in size.  This is incorrect, but not fatal, so we only warn about 
+     * it instead of refusing to work with the file.  Please, if you
+     * have a program that's creating format chunks of sizes other than
+     * 16 or 18 bytes in size, report a bug to the author.
+     */
+    if(len!=16 && len!=18)
+        fprintf(stderr, 
+                _("Warning: INVALID format chunk in wav header.\n"
+                " Trying to read anyway (may not work)...\n"));
 
-	if(fread(buf,1,16,in) < 16)
-	{
-		fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n"));
-		return 0;
-	}
+    if(fread(buf,1,16,in) < 16)
+    {
+        fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n"));
+        return 0;
+    }
 
-	/* Deal with stupid broken apps. Don't use these programs.
-	 */
-	if(len - 16 > 0 && !seek_forward(in, len-16))
-	    return 0;
+    /* Deal with stupid broken apps. Don't use these programs.
+     */
+    if(len - 16 > 0 && !seek_forward(in, len-16))
+        return 0;
 
-	format.format =      READ_U16_LE(buf); 
-	format.channels =    READ_U16_LE(buf+2); 
-	format.samplerate =  READ_U32_LE(buf+4);
-	format.bytespersec = READ_U32_LE(buf+8);
-	format.align =       READ_U16_LE(buf+12);
-	format.samplesize =  READ_U16_LE(buf+14);
+    format.format =      READ_U16_LE(buf); 
+    format.channels =    READ_U16_LE(buf+2); 
+    format.samplerate =  READ_U32_LE(buf+4);
+    format.bytespersec = READ_U32_LE(buf+8);
+    format.align =       READ_U16_LE(buf+12);
+    format.samplesize =  READ_U16_LE(buf+14);
 
-	if(!find_wav_chunk(in, "data", &len))
-		return 0; /* EOF */
+    if(!find_wav_chunk(in, "data", &len))
+        return 0; /* EOF */
 
-	if(format.format == 1)
-	{
-		samplesize = format.samplesize/8;
-		opt->read_samples = wav_read;
-	}
-	else if(format.format == 3)
-	{
-		samplesize = 4;
-		opt->read_samples = wav_ieee_read;
-	}
-	else
-	{
-		fprintf(stderr, 
-				_("ERROR: Wav file is unsupported type (must be standard PCM\n"
-				" or type 3 floating point PCM\n"));
-		return 0;
-	}
+    if(format.format == 1)
+    {
+        samplesize = format.samplesize/8;
+        opt->read_samples = wav_read;
+    }
+    else if(format.format == 3)
+    {
+        samplesize = 4;
+        opt->read_samples = wav_ieee_read;
+    }
+    else
+    {
+        fprintf(stderr, 
+                _("ERROR: Wav file is unsupported type (must be standard PCM\n"
+                " or type 3 floating point PCM\n"));
+        return 0;
+    }
 
     if(format.align != format.channels * samplesize) {
         /* This is incorrect according to the spec. Warn loudly, then ignore
@@ -457,45 +457,45 @@
                     "The software that created this file is incorrect.\n"));
     }
 
-	if(format.samplesize == samplesize*8 && 
-    		(format.samplesize == 24 || format.samplesize == 16 || 
+    if(format.samplesize == samplesize*8 && 
+            (format.samplesize == 24 || format.samplesize == 16 || 
              format.samplesize == 8 ||
-	     (format.samplesize == 32 && format.format == 3)))
-	{
-		/* OK, good - we have the one supported format,
-		   now we want to find the size of the file */
-		opt->rate = format.samplerate;
-		opt->channels = format.channels;
+         (format.samplesize == 32 && format.format == 3)))
+    {
+        /* OK, good - we have the one supported format,
+           now we want to find the size of the file */
+        opt->rate = format.samplerate;
+        opt->channels = format.channels;
 
-		wav->f = in;
-		wav->samplesread = 0;
-		wav->bigendian = 0;
-		wav->channels = format.channels; /* This is in several places. The price
-											of trying to abstract stuff. */
-		wav->samplesize = format.samplesize;
+        wav->f = in;
+        wav->samplesread = 0;
+        wav->bigendian = 0;
+        wav->channels = format.channels; /* This is in several places. The price
+                                            of trying to abstract stuff. */
+        wav->samplesize = format.samplesize;
 
-		if(len)
+        if(len)
         {
-			opt->total_samples_per_channel = len/(format.channels*samplesize);
-		}
-		else
-		{
-			long pos;
-			pos = ftell(in);
-			if(fseek(in, 0, SEEK_END) == -1)
-			{
-				opt->total_samples_per_channel = 0; /* Give up */
-			}
-			else
-			{
-				opt->total_samples_per_channel = (ftell(in) - pos)/
+            opt->total_samples_per_channel = len/(format.channels*samplesize);
+        }
+        else
+        {
+            long pos;
+            pos = ftell(in);
+            if(fseek(in, 0, SEEK_END) == -1)
+            {
+                opt->total_samples_per_channel = 0; /* Give up */
+            }
+            else
+            {
+                opt->total_samples_per_channel = (ftell(in) - pos)/
                     (format.channels*samplesize);
-				fseek(in,pos, SEEK_SET);
-			}
-		}
-		wav->totalsamples = opt->total_samples_per_channel;
+                fseek(in,pos, SEEK_SET);
+            }
+        }
+        wav->totalsamples = opt->total_samples_per_channel;
 
-		opt->readdata = (void *)wav;
+        opt->readdata = (void *)wav;
         
         /* TODO: Read the extended wav header to get this right in weird cases,
          * and/or error out if neccesary. Suck. */
@@ -508,75 +508,72 @@
             /* Use a default 1-1 mapping */
             for (i=0; i < wav->channels; i++)
                 wav->channel_permute[i] = i;
-        for (i=0;i<wav->channels; i++) {
-          fprintf(stderr, "%d -> %d\n", i, wav->channel_permute[i]);
-        }
 
-		return 1;
-	}
-	else
-	{
-		fprintf(stderr, 
-				_("ERROR: Wav file is unsupported subformat (must be 8,16, or 24 bit PCM\n"
-				"or floating point PCM\n"));
-		return 0;
-	}
+        return 1;
+    }
+    else
+    {
+        fprintf(stderr, 
+                _("ERROR: Wav file is unsupported subformat (must be 8,16, or 24 bit PCM\n"
+                "or floating point PCM\n"));
+        return 0;
+    }
 }
 
 long wav_read(void *in, float **buffer, int samples)
 {
-	wavfile *f = (wavfile *)in;
-	int sampbyte = f->samplesize / 8;
-	signed char *buf = alloca(samples*sampbyte*f->channels);
-	long bytes_read = fread(buf, 1, samples*sampbyte*f->channels, f->f);
-	int i,j;
-	long realsamples;
+    wavfile *f = (wavfile *)in;
+    int sampbyte = f->samplesize / 8;
+    signed char *buf = alloca(samples*sampbyte*f->channels);
+    long bytes_read = fread(buf, 1, samples*sampbyte*f->channels, f->f);
+    int i,j;
+    long realsamples;
     int *ch_permute = f->channel_permute;
 
-	if(f->totalsamples && f->samplesread + 
-			bytes_read/(sampbyte*f->channels) > f->totalsamples) {
-		bytes_read = sampbyte*f->channels*(f->totalsamples - f->samplesread);
+    if(f->totalsamples && f->samplesread + 
+            bytes_read/(sampbyte*f->channels) > f->totalsamples) {
+        bytes_read = sampbyte*f->channels*(f->totalsamples - f->samplesread);
     }
 
-	realsamples = bytes_read/(sampbyte*f->channels);
-	f->samplesread += realsamples;
-		
-	if(f->samplesize==8)
-	{
-		unsigned char *bufu = (unsigned char *)buf;
-		for(i = 0; i < realsamples; i++)
-		{
-			for(j=0; j < f->channels; j++)
-			{
-				buffer[j][i]=((int)(bufu[i*f->channels + ch_permute[j]])-128)/128.0f;
-			}
-		}
-	}
-	else if(f->samplesize==16)
-	{
-		if(!f->bigendian)
-		{
-			for(i = 0; i < realsamples; i++)
-			{
-				for(j=0; j < f->channels; j++)
-				{
-					buffer[j][i] = ((buf[i*2*f->channels + 2*ch_permute[j] + 1]<<8) |
-							        (buf[i*2*f->channels + 2*ch_permute[j]] & 0xff))/32768.0f;
-				}
-			}
-		}
-		else
-		{
-			for(i = 0; i < realsamples; i++)
-			{
-				for(j=0; j < f->channels; j++)
-				{
-					buffer[j][i]=((buf[i*2*f->channels + 2*ch_permute[j]]<<8) |
-							      (buf[i*2*f->channels + 2*ch_permute[j] + 1] & 0xff))/32768.0f;
-				}
-			}
-		}
-	}
+    realsamples = bytes_read/(sampbyte*f->channels);
+    f->samplesread += realsamples;
+        
+    if(f->samplesize==8)
+    {
+        unsigned char *bufu = (unsigned char *)buf;
+        for(i = 0; i < realsamples; i++)
+        {
+            for(j=0; j < f->channels; j++)
+            {
+                buffer[j][i]=((int)(bufu[i*f->channels + ch_permute[j]])-128)/128.0f;
+            }
+        }
+    }
+    else if(f->samplesize==16)
+    {
+        if(!f->bigendian)
+        {
+            for(i = 0; i < realsamples; i++)
+            {
+                for(j=0; j < f->channels; j++)
+                {
+                    buffer[j][i] = ((buf[i*2*f->channels + 2*ch_permute[j] + 1]<<8) |
+                                    (buf[i*2*f->channels + 2*ch_permute[j]] & 0xff))/32768.0f;
+                }
+            }
+        }
+        else
+        {
+            for(i = 0; i < realsamples; i++)
+            {
+                for(j=0; j < f->channels; j++)
+                {
+                    buffer[j][i]=((buf[i*2*f->channels + 2*ch_permute[j]]<<8) |
+                                  (buf[i*2*f->channels + 2*ch_permute[j] + 1] & 0xff))/32768.0f;
+                }
+            }
+        }
+    }
     else if(f->samplesize==24) 
     {
         if(!f->bigendian) {
@@ -604,67 +601,67 @@
         return 0;
     }
 
-	return realsamples;
+    return realsamples;
 }
 
 long wav_ieee_read(void *in, float **buffer, int samples)
 {
-	wavfile *f = (wavfile *)in;
-	float *buf = alloca(samples*4*f->channels); /* de-interleave buffer */
-	long bytes_read = fread(buf,1,samples*4*f->channels, f->f);
-	int i,j;
-	long realsamples;
+    wavfile *f = (wavfile *)in;
+    float *buf = alloca(samples*4*f->channels); /* de-interleave buffer */
+    long bytes_read = fread(buf,1,samples*4*f->channels, f->f);
+    int i,j;
+    long realsamples;
 
 
-	if(f->totalsamples && f->samplesread +
-			bytes_read/(4*f->channels) > f->totalsamples)
-		bytes_read = 4*f->channels*(f->totalsamples - f->samplesread);
-	realsamples = bytes_read/(4*f->channels);
-	f->samplesread += realsamples;
+    if(f->totalsamples && f->samplesread +
+            bytes_read/(4*f->channels) > f->totalsamples)
+        bytes_read = 4*f->channels*(f->totalsamples - f->samplesread);
+    realsamples = bytes_read/(4*f->channels);
+    f->samplesread += realsamples;
 
-	for(i=0; i < realsamples; i++)
-		for(j=0; j < f->channels; j++)
-			buffer[j][i] = buf[i*f->channels + f->channel_permute[j]];
+    for(i=0; i < realsamples; i++)
+        for(j=0; j < f->channels; j++)
+            buffer[j][i] = buf[i*f->channels + f->channel_permute[j]];
 
-	return realsamples;
+    return realsamples;
 }
 
 
 void wav_close(void *info)
 {
-	wavfile *f = (wavfile *)info;
+    wavfile *f = (wavfile *)info;
     free(f->channel_permute);
 
-	free(f);
+    free(f);
 }
 
 int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
 {
-	wav_fmt format; /* fake wave header ;) */
-	wavfile *wav = malloc(sizeof(wavfile));
+    wav_fmt format; /* fake wave header ;) */
+    wavfile *wav = malloc(sizeof(wavfile));
     int i;
 
-	/* construct fake wav header ;) */
-	format.format =      2; 
-	format.channels =    opt->channels;
-	format.samplerate =  opt->rate;
-	format.samplesize =  opt->samplesize;
-	format.bytespersec = opt->channels * opt->rate * opt->samplesize / 8;
-	format.align =       format.bytespersec;
-	wav->f =             in;
-	wav->samplesread =   0;
-	wav->bigendian =     opt->endianness;
-	wav->channels =      format.channels;
-	wav->samplesize =    opt->samplesize;
+    /* construct fake wav header ;) */
+    format.format =      2; 
+    format.channels =    opt->channels;
+    format.samplerate =  opt->rate;
+    format.samplesize =  opt->samplesize;
+    format.bytespersec = opt->channels * opt->rate * opt->samplesize / 8;
+    format.align =       format.bytespersec;
+    wav->f =             in;
+    wav->samplesread =   0;
+    wav->bigendian =     opt->endianness;
+    wav->channels =      format.channels;
+    wav->samplesize =    opt->samplesize;
     wav->totalsamples =  0;
     wav->channel_permute = malloc(wav->channels * sizeof(int));
     for (i=0; i < wav->channels; i++)
       wav->channel_permute[i] = i;
 
-	opt->read_samples = wav_read;
-	opt->readdata = (void *)wav;
-	opt->total_samples_per_channel = 0; /* raw mode, don't bother */
-	return 1;
+    opt->read_samples = wav_read;
+    opt->readdata = (void *)wav;
+    opt->total_samples_per_channel = 0; /* raw mode, don't bother */
+    return 1;
 }
 
 typedef struct {

Modified: trunk/vorbis-tools/oggenc/audio.h
===================================================================
--- trunk/vorbis-tools/oggenc/audio.h	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/audio.h	2006-06-29 11:00:57 UTC (rev 11665)
@@ -14,41 +14,41 @@
 
 typedef struct
 {
-	int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
-	int id_data_len; /* Amount of data needed to id whether this can load the file */
-	int (*open_func)(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
-	void (*close_func)(void *);
-	char *format;
-	char *description;
+    int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
+    int id_data_len; /* Amount of data needed to id whether this can load the file */
+    int (*open_func)(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
+    void (*close_func)(void *);
+    char *format;
+    char *description;
 } input_format;
 
 
 typedef struct {
-	short format;
-	short channels;
-	int samplerate;
-	int bytespersec;
-	short align;
-	short samplesize;
+    short format;
+    short channels;
+    int samplerate;
+    int bytespersec;
+    short align;
+    short samplesize;
 } wav_fmt;
 
 typedef struct {
-	short channels;
-	short samplesize;
-	long totalsamples;
-	long samplesread;
-	FILE *f;
-	short bigendian;
+    short channels;
+    short samplesize;
+    long totalsamples;
+    long samplesread;
+    FILE *f;
+    short bigendian;
         int *channel_permute;
 } wavfile;
 
 typedef struct {
-	short channels;
-	int totalframes;
-	short samplesize;
-	int rate;
-	int offset;
-	int blocksize;
+    short channels;
+    int totalframes;
+    short samplesize;
+    int rate;
+    int offset;
+    int blocksize;
 } aiff_fmt;
 
 typedef wavfile aifffile; /* They're the same */

Modified: trunk/vorbis-tools/oggenc/easyflac.c
===================================================================
--- trunk/vorbis-tools/oggenc/easyflac.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/easyflac.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -39,43 +39,43 @@
 
 FLAC__bool EasyFLAC__is_oggflac(EasyFLAC__StreamDecoder *decoder)
 {
-	return decoder->is_oggflac;
+    return decoder->is_oggflac;
 }
 
 
 EasyFLAC__StreamDecoder *EasyFLAC__stream_decoder_new(FLAC__bool is_oggflac)
 {
-	EasyFLAC__StreamDecoder *decoder = malloc(sizeof(EasyFLAC__StreamDecoder));
+    EasyFLAC__StreamDecoder *decoder = malloc(sizeof(EasyFLAC__StreamDecoder));
 
-	if (decoder != NULL)
-	{
-		decoder->is_oggflac = is_oggflac;
-		
-		if (decoder->is_oggflac)
-			decoder->oggflac = OggFLAC__stream_decoder_new();
-		else
-			decoder->flac = FLAC__stream_decoder_new();
+    if (decoder != NULL)
+    {
+        decoder->is_oggflac = is_oggflac;
+        
+        if (decoder->is_oggflac)
+            decoder->oggflac = OggFLAC__stream_decoder_new();
+        else
+            decoder->flac = FLAC__stream_decoder_new();
 
-		if (  (decoder->is_oggflac && decoder->oggflac == NULL)
-		    ||(!decoder->is_oggflac && decoder->flac == NULL)  )
-		{
-			free(decoder);
-			decoder = NULL;
-		}
-	}
+        if (  (decoder->is_oggflac && decoder->oggflac == NULL)
+            ||(!decoder->is_oggflac && decoder->flac == NULL)  )
+        {
+            free(decoder);
+            decoder = NULL;
+        }
+    }
 
-	return decoder;
+    return decoder;
 }
 
 
 void EasyFLAC__stream_decoder_delete(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		OggFLAC__stream_decoder_delete(decoder->oggflac);
-	else
-		FLAC__stream_decoder_delete(decoder->flac);
+    if (decoder->is_oggflac)
+        OggFLAC__stream_decoder_delete(decoder->oggflac);
+    else
+        FLAC__stream_decoder_delete(decoder->flac);
 
-	free(decoder);
+    free(decoder);
 }
 
 
@@ -83,33 +83,33 @@
 
 FLAC__StreamDecoderReadStatus oggflac_read_callback(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data);
+    return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data);
 }
 
 
 FLAC__StreamDecoderWriteStatus oggflac_write_callback(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	return (*(e_decoder->callbacks.write))(e_decoder, frame, buffer, e_decoder->callbacks.client_data);
+    return (*(e_decoder->callbacks.write))(e_decoder, frame, buffer, e_decoder->callbacks.client_data);
 }
 
 
 void oggflac_metadata_callback(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	(*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data);
+    (*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data);
 }
 
 
 void oggflac_error_callback(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	(*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data);
+    (*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data);
 }
 
 
@@ -117,259 +117,259 @@
 
 FLAC__StreamDecoderReadStatus flac_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data);
+    return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data);
 }
 
 
 FLAC__StreamDecoderWriteStatus flac_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	return (*e_decoder->callbacks.write)(e_decoder, frame, buffer, e_decoder->callbacks.client_data);
+    return (*e_decoder->callbacks.write)(e_decoder, frame, buffer, e_decoder->callbacks.client_data);
 }
 
 
 void flac_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	(*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data);
+    (*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data);
 }
 
 
 void flac_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
 {
-	EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
+    EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data;
 
-	(*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data);
+    (*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data);
 }
 
 
 FLAC__bool EasyFLAC__set_read_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderReadCallback value)
 {
-	decoder->callbacks.read = value;
+    decoder->callbacks.read = value;
 
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_read_callback(decoder->oggflac, &oggflac_read_callback);
-	else
-		return FLAC__stream_decoder_set_read_callback(decoder->flac, &flac_read_callback);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_read_callback(decoder->oggflac, &oggflac_read_callback);
+    else
+        return FLAC__stream_decoder_set_read_callback(decoder->flac, &flac_read_callback);
 }
 
 
 FLAC__bool EasyFLAC__set_write_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderWriteCallback value)
 {
-	decoder->callbacks.write = value;
+    decoder->callbacks.write = value;
 
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_write_callback(decoder->oggflac, &oggflac_write_callback);
-	else
-		return FLAC__stream_decoder_set_write_callback(decoder->flac, &flac_write_callback);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_write_callback(decoder->oggflac, &oggflac_write_callback);
+    else
+        return FLAC__stream_decoder_set_write_callback(decoder->flac, &flac_write_callback);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderMetadataCallback value)
 {
-	decoder->callbacks.metadata = value;
+    decoder->callbacks.metadata = value;
 
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_callback(decoder->oggflac, &oggflac_metadata_callback);
-	else
-		return FLAC__stream_decoder_set_metadata_callback(decoder->flac, &flac_metadata_callback);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_callback(decoder->oggflac, &oggflac_metadata_callback);
+    else
+        return FLAC__stream_decoder_set_metadata_callback(decoder->flac, &flac_metadata_callback);
 }
 
 
 FLAC__bool EasyFLAC__set_error_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderErrorCallback value)
 {
-	decoder->callbacks.error = value;
+    decoder->callbacks.error = value;
 
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_error_callback(decoder->oggflac, &oggflac_error_callback);
-	else
-		return FLAC__stream_decoder_set_error_callback(decoder->flac, &flac_error_callback);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_error_callback(decoder->oggflac, &oggflac_error_callback);
+    else
+        return FLAC__stream_decoder_set_error_callback(decoder->flac, &flac_error_callback);
 }
 
 
 FLAC__bool EasyFLAC__set_client_data(EasyFLAC__StreamDecoder *decoder, void *value)
 {
-	decoder->callbacks.client_data = value;
-	
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_client_data(decoder->oggflac, decoder);
-	else
-		return FLAC__stream_decoder_set_client_data(decoder->flac, decoder);
+    decoder->callbacks.client_data = value;
+    
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_client_data(decoder->oggflac, decoder);
+    else
+        return FLAC__stream_decoder_set_client_data(decoder->flac, decoder);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_respond(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_respond(decoder->oggflac, type);
-	else
-		return FLAC__stream_decoder_set_metadata_respond(decoder->flac, type);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_respond(decoder->oggflac, type);
+    else
+        return FLAC__stream_decoder_set_metadata_respond(decoder->flac, type);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_respond_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4])
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_respond_application(decoder->oggflac, id);
-	else
-		return FLAC__stream_decoder_set_metadata_respond_application(decoder->flac, id);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_respond_application(decoder->oggflac, id);
+    else
+        return FLAC__stream_decoder_set_metadata_respond_application(decoder->flac, id);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_respond_all(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_respond_all(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_set_metadata_respond_all(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_respond_all(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_set_metadata_respond_all(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_ignore(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_ignore(decoder->oggflac, type);
-	else
-		return FLAC__stream_decoder_set_metadata_ignore(decoder->flac, type);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_ignore(decoder->oggflac, type);
+    else
+        return FLAC__stream_decoder_set_metadata_ignore(decoder->flac, type);
 }
 
 
 FLAC__bool EasyFLAC__set_metadata_ignore_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4])
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_ignore_application(decoder->oggflac, id);
-	else
-		return FLAC__stream_decoder_set_metadata_ignore_application(decoder->flac, id);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_ignore_application(decoder->oggflac, id);
+    else
+        return FLAC__stream_decoder_set_metadata_ignore_application(decoder->flac, id);
 }
 
 FLAC__bool EasyFLAC__set_metadata_ignore_all(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_set_metadata_ignore_all(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_set_metadata_ignore_all(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_set_metadata_ignore_all(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_set_metadata_ignore_all(decoder->flac);
 }
 
 
 FLAC__StreamDecoderState EasyFLAC__get_state(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_state(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_state(decoder->flac);
 }
 
 
 unsigned EasyFLAC__get_channels(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_channels(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_channels(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_channels(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_channels(decoder->flac);
 }
 
 
 FLAC__ChannelAssignment EasyFLAC__get_channel_assignment(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_channel_assignment(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_channel_assignment(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_channel_assignment(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_channel_assignment(decoder->flac);
 }
 
 
 unsigned EasyFLAC__get_bits_per_sample(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_bits_per_sample(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_bits_per_sample(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_bits_per_sample(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_bits_per_sample(decoder->flac);
 }
 
 
 unsigned EasyFLAC__get_sample_rate(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_sample_rate(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_sample_rate(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_sample_rate(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_sample_rate(decoder->flac);
 }
 
 
 unsigned EasyFLAC__get_blocksize(const EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_get_blocksize(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_get_blocksize(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_get_blocksize(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_get_blocksize(decoder->flac);
 }
 
 
 FLAC__StreamDecoderState EasyFLAC__init(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-	{
-		OggFLAC__stream_decoder_init(decoder->oggflac);
-		return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac);
-	}
-	else
-		return FLAC__stream_decoder_init(decoder->flac);
+    if (decoder->is_oggflac)
+    {
+        OggFLAC__stream_decoder_init(decoder->oggflac);
+        return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac);
+    }
+    else
+        return FLAC__stream_decoder_init(decoder->flac);
 }
 
 
 void EasyFLAC__finish(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		OggFLAC__stream_decoder_finish(decoder->oggflac);
-	else
-		FLAC__stream_decoder_finish(decoder->flac);
+    if (decoder->is_oggflac)
+        OggFLAC__stream_decoder_finish(decoder->oggflac);
+    else
+        FLAC__stream_decoder_finish(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__flush(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_flush(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_flush(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_flush(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_flush(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__reset(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_reset(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_reset(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_reset(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_reset(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__process_single(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_process_single(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_process_single(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_process_single(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_process_single(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__process_until_end_of_metadata(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_process_until_end_of_metadata(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_process_until_end_of_metadata(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_process_until_end_of_metadata(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_process_until_end_of_metadata(decoder->flac);
 }
 
 
 FLAC__bool EasyFLAC__process_until_end_of_stream(EasyFLAC__StreamDecoder *decoder)
 {
-	if (decoder->is_oggflac)
-		return OggFLAC__stream_decoder_process_until_end_of_stream(decoder->oggflac);
-	else
-		return FLAC__stream_decoder_process_until_end_of_stream(decoder->flac);
+    if (decoder->is_oggflac)
+        return OggFLAC__stream_decoder_process_until_end_of_stream(decoder->oggflac);
+    else
+        return FLAC__stream_decoder_process_until_end_of_stream(decoder->flac);
 }

Modified: trunk/vorbis-tools/oggenc/easyflac.h
===================================================================
--- trunk/vorbis-tools/oggenc/easyflac.h	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/easyflac.h	2006-06-29 11:00:57 UTC (rev 11665)
@@ -91,16 +91,16 @@
 typedef void (*EasyFLAC__StreamDecoderErrorCallback)(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
 
 struct EasyFLAC__StreamDecoder {
-	FLAC__bool is_oggflac;
-	FLAC__StreamDecoder *flac;
-	OggFLAC__StreamDecoder *oggflac;
-	struct {
-		EasyFLAC__StreamDecoderReadCallback     read;
-		EasyFLAC__StreamDecoderWriteCallback    write;
-		EasyFLAC__StreamDecoderMetadataCallback metadata;
-		EasyFLAC__StreamDecoderErrorCallback    error;
-		void *client_data;
-	} callbacks;
+    FLAC__bool is_oggflac;
+    FLAC__StreamDecoder *flac;
+    OggFLAC__StreamDecoder *oggflac;
+    struct {
+        EasyFLAC__StreamDecoderReadCallback     read;
+        EasyFLAC__StreamDecoderWriteCallback    write;
+        EasyFLAC__StreamDecoderMetadataCallback metadata;
+        EasyFLAC__StreamDecoderErrorCallback    error;
+        void *client_data;
+    } callbacks;
 };
 
 

Modified: trunk/vorbis-tools/oggenc/encode.c
===================================================================
--- trunk/vorbis-tools/oggenc/encode.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/encode.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -110,20 +110,20 @@
 int oe_encode(oe_enc_opt *opt)
 {
 
-	ogg_stream_state os;
-	ogg_page 		 og;
-	ogg_packet 		 op;
+    ogg_stream_state os;
+    ogg_page          og;
+    ogg_packet          op;
 
-	vorbis_dsp_state vd;
-	vorbis_block     vb;
-	vorbis_info      vi;
+    vorbis_dsp_state vd;
+    vorbis_block     vb;
+    vorbis_info      vi;
 
-	long samplesdone=0;
+    long samplesdone=0;
     int eos;
-	long bytes_written = 0, packetsdone=0;
-	double time_elapsed;
-	int ret=0;
-	TIMER *timer;
+    long bytes_written = 0, packetsdone=0;
+    double time_elapsed;
+    int ret=0;
+    TIMER *timer;
 
     if(opt->channels > 255) {
         fprintf(stderr, _("255 channels should be enough for anyone. (Sorry, vorbis doesn't support more)\n"));
@@ -145,16 +145,16 @@
     }
 
     opt->start_encode(opt->infilename, opt->filename, opt->bitrate, opt->quality, 
-		      opt->quality_set, opt->managed, opt->min_bitrate, opt->max_bitrate);
+              opt->quality_set, opt->managed, opt->min_bitrate, opt->max_bitrate);
     
     /* Have vorbisenc choose a mode for us */
     vorbis_info_init(&vi);
     
     if(opt->quality_set > 0){
         if(vorbis_encode_setup_vbr(&vi, opt->channels, opt->rate, opt->quality)){
-	        fprintf(stderr, _("Mode initialisation failed: invalid parameters for quality\n"));
-	        vorbis_info_clear(&vi);
-	        return 1;
+            fprintf(stderr, _("Mode initialisation failed: invalid parameters for quality\n"));
+            vorbis_info_clear(&vi);
+            return 1;
         }
 
         /* do we have optional hard bitrate restrictions? */
@@ -162,7 +162,7 @@
             long bitrate;
             struct ovectl_ratemanage2_arg ai;
 
-	    vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai);
+        vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai);
 
             /* libvorbis 1.1 (and current svn) doesn't actually fill this in,
                which looks like a bug. It'll then reject it when we call the
@@ -173,7 +173,7 @@
                get a nominal bitrate from a quality value. Well, except by doing
                a full setup... So, we do that. 
                Also, note that this won't work correctly unless you have 
-	       version 1.1.1 or later of libvorbis.
+           version 1.1.1 or later of libvorbis.
              */
 
             {
@@ -189,13 +189,13 @@
             ai.bitrate_average_damping = 1.5;
             ai.bitrate_limit_reservoir_bits = bitrate * 2;
             ai.bitrate_limit_reservoir_bias = .1;
-	
+    
             /* And now the ones we actually wanted to set */
-	        ai.bitrate_limit_min_kbps=opt->min_bitrate;
-	        ai.bitrate_limit_max_kbps=opt->max_bitrate;
-	        ai.management_active=1;
+            ai.bitrate_limit_min_kbps=opt->min_bitrate;
+            ai.bitrate_limit_max_kbps=opt->max_bitrate;
+            ai.management_active=1;
 
-	        if(vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai) == 0)
+            if(vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai) == 0)
                 fprintf(stderr, _("Set optional hard quality restrictions\n"));
             else {
                 fprintf(stderr, _("Failed to set bitrate min/max in quality mode\n"));
@@ -207,12 +207,12 @@
 
     }else {
         if(vorbis_encode_setup_managed(&vi, opt->channels, opt->rate, 
-				     opt->max_bitrate>0?opt->max_bitrate*1000:-1,
-				     opt->bitrate*1000, 
-				     opt->min_bitrate>0?opt->min_bitrate*1000:-1)){
-	        fprintf(stderr, _("Mode initialisation failed: invalid parameters for bitrate\n"));
-	        vorbis_info_clear(&vi);
-	        return 1;
+                     opt->max_bitrate>0?opt->max_bitrate*1000:-1,
+                     opt->bitrate*1000, 
+                     opt->min_bitrate>0?opt->min_bitrate*1000:-1)){
+            fprintf(stderr, _("Mode initialisation failed: invalid parameters for bitrate\n"));
+            vorbis_info_clear(&vi);
+            return 1;
         }
     }
     
@@ -234,211 +234,211 @@
     vorbis_encode_setup_init(&vi);
 
 
-	/* Now, set up the analysis engine, stream encoder, and other
-	   preparation before the encoding begins.
-	 */
+    /* Now, set up the analysis engine, stream encoder, and other
+       preparation before the encoding begins.
+     */
 
-	vorbis_analysis_init(&vd,&vi);
-	vorbis_block_init(&vd,&vb);
+    vorbis_analysis_init(&vd,&vi);
+    vorbis_block_init(&vd,&vb);
 
-	ogg_stream_init(&os, opt->serialno);
+    ogg_stream_init(&os, opt->serialno);
 
-	/* Now, build the three header packets and send through to the stream 
-	   output stage (but defer actual file output until the main encode loop) */
+    /* Now, build the three header packets and send through to the stream 
+       output stage (but defer actual file output until the main encode loop) */
 
-	{
-		ogg_packet header_main;
-		ogg_packet header_comments;
-		ogg_packet header_codebooks;
-		int result;
+    {
+        ogg_packet header_main;
+        ogg_packet header_comments;
+        ogg_packet header_codebooks;
+        int result;
 
-		/* Build the packets */
-		vorbis_analysis_headerout(&vd,opt->comments,
-				&header_main,&header_comments,&header_codebooks);
+        /* Build the packets */
+        vorbis_analysis_headerout(&vd,opt->comments,
+                &header_main,&header_comments,&header_codebooks);
 
-		/* And stream them out */
-		ogg_stream_packetin(&os,&header_main);
-		ogg_stream_packetin(&os,&header_comments);
-		ogg_stream_packetin(&os,&header_codebooks);
+        /* And stream them out */
+        ogg_stream_packetin(&os,&header_main);
+        ogg_stream_packetin(&os,&header_comments);
+        ogg_stream_packetin(&os,&header_codebooks);
 
-		while((result = ogg_stream_flush(&os, &og)))
-		{
-			if(!result) break;
-			ret = oe_write_page(&og, opt->out);
-			if(ret != og.header_len + og.body_len)
-			{
-				opt->error(_("Failed writing header to output stream\n"));
-				ret = 1;
-				goto cleanup; /* Bail and try to clean up stuff */
-			}
-		}
-	}
+        while((result = ogg_stream_flush(&os, &og)))
+        {
+            if(!result) break;
+            ret = oe_write_page(&og, opt->out);
+            if(ret != og.header_len + og.body_len)
+            {
+                opt->error(_("Failed writing header to output stream\n"));
+                ret = 1;
+                goto cleanup; /* Bail and try to clean up stuff */
+            }
+        }
+    }
 
-	eos = 0;
+    eos = 0;
 
-	/* Main encode loop - continue until end of file */
-	while(!eos)
-	{
-		float **buffer = vorbis_analysis_buffer(&vd, READSIZE);
-		long samples_read = opt->read_samples(opt->readdata, 
-				buffer, READSIZE);
+    /* Main encode loop - continue until end of file */
+    while(!eos)
+    {
+        float **buffer = vorbis_analysis_buffer(&vd, READSIZE);
+        long samples_read = opt->read_samples(opt->readdata, 
+                buffer, READSIZE);
 
-		if(samples_read ==0)
-			/* Tell the library that we wrote 0 bytes - signalling the end */
-			vorbis_analysis_wrote(&vd,0);
-		else
-		{
-			samplesdone += samples_read;
+        if(samples_read ==0)
+            /* Tell the library that we wrote 0 bytes - signalling the end */
+            vorbis_analysis_wrote(&vd,0);
+        else
+        {
+            samplesdone += samples_read;
 
-			/* Call progress update every 40 pages */
-			if(packetsdone>=40)
-			{
-				double time;
+            /* Call progress update every 40 pages */
+            if(packetsdone>=40)
+            {
+                double time;
 
-				packetsdone = 0;
-				time = timer_time(timer);
+                packetsdone = 0;
+                time = timer_time(timer);
 
-				opt->progress_update(opt->filename, opt->total_samples_per_channel, 
-						samplesdone, time);
-			}
+                opt->progress_update(opt->filename, opt->total_samples_per_channel, 
+                        samplesdone, time);
+            }
 
-			/* Tell the library how many samples (per channel) we wrote 
-			   into the supplied buffer */
-			vorbis_analysis_wrote(&vd, samples_read);
-		}
+            /* Tell the library how many samples (per channel) we wrote 
+               into the supplied buffer */
+            vorbis_analysis_wrote(&vd, samples_read);
+        }
 
-		/* While we can get enough data from the library to analyse, one
-		   block at a time... */
-		while(vorbis_analysis_blockout(&vd,&vb)==1)
-		{
+        /* While we can get enough data from the library to analyse, one
+           block at a time... */
+        while(vorbis_analysis_blockout(&vd,&vb)==1)
+        {
 
-			/* Do the main analysis, creating a packet */
-			vorbis_analysis(&vb, NULL);
-			vorbis_bitrate_addblock(&vb);
+            /* Do the main analysis, creating a packet */
+            vorbis_analysis(&vb, NULL);
+            vorbis_bitrate_addblock(&vb);
 
-			while(vorbis_bitrate_flushpacket(&vd, &op)) 
-			{
-				/* Add packet to bitstream */
-				ogg_stream_packetin(&os,&op);
-				packetsdone++;
+            while(vorbis_bitrate_flushpacket(&vd, &op)) 
+            {
+                /* Add packet to bitstream */
+                ogg_stream_packetin(&os,&op);
+                packetsdone++;
 
-				/* If we've gone over a page boundary, we can do actual output,
-				   so do so (for however many pages are available) */
+                /* If we've gone over a page boundary, we can do actual output,
+                   so do so (for however many pages are available) */
 
-				while(!eos)
-				{
-					int result = ogg_stream_pageout(&os,&og);
-					if(!result) break;
+                while(!eos)
+                {
+                    int result = ogg_stream_pageout(&os,&og);
+                    if(!result) break;
 
-					ret = oe_write_page(&og, opt->out);
-					if(ret != og.header_len + og.body_len)
-					{
-						opt->error(_("Failed writing data to output stream\n"));
-						ret = 1;
-						goto cleanup; /* Bail */
-					}
-					else
-						bytes_written += ret; 
-	
-					if(ogg_page_eos(&og))
-						eos = 1;
-				}
-			}
-		}
-	}
+                    ret = oe_write_page(&og, opt->out);
+                    if(ret != og.header_len + og.body_len)
+                    {
+                        opt->error(_("Failed writing data to output stream\n"));
+                        ret = 1;
+                        goto cleanup; /* Bail */
+                    }
+                    else
+                        bytes_written += ret; 
+    
+                    if(ogg_page_eos(&og))
+                        eos = 1;
+                }
+            }
+        }
+    }
 
-	ret = 0; /* Success, set return value to 0 since other things reuse it
-			  * for nefarious purposes. */
+    ret = 0; /* Success, set return value to 0 since other things reuse it
+              * for nefarious purposes. */
 
-	/* Cleanup time */
+    /* Cleanup time */
 cleanup:
 
-	ogg_stream_clear(&os);
+    ogg_stream_clear(&os);
 
-	vorbis_block_clear(&vb);
-	vorbis_dsp_clear(&vd);
-	vorbis_info_clear(&vi);
+    vorbis_block_clear(&vb);
+    vorbis_dsp_clear(&vd);
+    vorbis_info_clear(&vi);
 
-	time_elapsed = timer_time(timer);
-	opt->end_encode(opt->filename, time_elapsed, opt->rate, samplesdone, bytes_written);
+    time_elapsed = timer_time(timer);
+    opt->end_encode(opt->filename, time_elapsed, opt->rate, samplesdone, bytes_written);
 
-	timer_clear(timer);
+    timer_clear(timer);
 
-	return ret;
+    return ret;
 }
 
 void update_statistics_full(char *fn, long total, long done, double time)
 {
-	static char *spinner="|/-\\";
-	static int spinpoint = 0;
-	double remain_time;
-	int minutes=0,seconds=0;
-	
-	remain_time = time/((double)done/(double)total) - time;
-	minutes = ((int)remain_time)/60;
-	seconds = (int)(remain_time - (double)((int)remain_time/60)*60);
+    static char *spinner="|/-\\";
+    static int spinpoint = 0;
+    double remain_time;
+    int minutes=0,seconds=0;
+    
+    remain_time = time/((double)done/(double)total) - time;
+    minutes = ((int)remain_time)/60;
+    seconds = (int)(remain_time - (double)((int)remain_time/60)*60);
 
-	fprintf(stderr, "\r");
-	fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c "), 
-			done*100.0/total, minutes, seconds, spinner[spinpoint++%4]);
+    fprintf(stderr, "\r");
+    fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c "), 
+            done*100.0/total, minutes, seconds, spinner[spinpoint++%4]);
 }
 
 void update_statistics_notime(char *fn, long total, long done, double time)
 {
-	static char *spinner="|/-\\";
-	static int spinpoint =0;
-	
-	fprintf(stderr, "\r");
-	fprintf(stderr, _("\tEncoding [%2dm%.2ds so far] %c "), 
+    static char *spinner="|/-\\";
+    static int spinpoint =0;
+    
+    fprintf(stderr, "\r");
+    fprintf(stderr, _("\tEncoding [%2dm%.2ds so far] %c "), 
             ((int)time)/60, (int)(time - (double)((int)time/60)*60),
-			spinner[spinpoint++%4]);
+            spinner[spinpoint++%4]);
 }
 
 int oe_write_page(ogg_page *page, FILE *fp)
 {
-	int written;
-	written = fwrite(page->header,1,page->header_len, fp);
-	written += fwrite(page->body,1,page->body_len, fp);
+    int written;
+    written = fwrite(page->header,1,page->header_len, fp);
+    written += fwrite(page->body,1,page->body_len, fp);
 
-	return written;
+    return written;
 }
 
 void final_statistics(char *fn, double time, int rate, long samples, long bytes)
 {
-	double speed_ratio;
-	if(fn)
-		fprintf(stderr, _("\n\nDone encoding file \"%s\"\n"), fn);
-	else
-		fprintf(stderr, _("\n\nDone encoding.\n"));
+    double speed_ratio;
+    if(fn)
+        fprintf(stderr, _("\n\nDone encoding file \"%s\"\n"), fn);
+    else
+        fprintf(stderr, _("\n\nDone encoding.\n"));
 
-	speed_ratio = (double)samples / (double)rate / time;
-	
-	fprintf(stderr, _("\n\tFile length:  %dm %04.1fs\n"),
-			(int)(samples/rate/60),
-			samples/rate - 
-			floor(samples/rate/60)*60);
-	fprintf(stderr, _("\tElapsed time: %dm %04.1fs\n"),
-			(int)(time/60),
-			time - floor(time/60)*60);
-	fprintf(stderr, _("\tRate:         %.4f\n"), speed_ratio);
-	fprintf(stderr, _("\tAverage bitrate: %.1f kb/s\n\n"), 
-		8./1000.*((double)bytes/((double)samples/(double)rate)));
+    speed_ratio = (double)samples / (double)rate / time;
+    
+    fprintf(stderr, _("\n\tFile length:  %dm %04.1fs\n"),
+            (int)(samples/rate/60),
+            samples/rate - 
+            floor(samples/rate/60)*60);
+    fprintf(stderr, _("\tElapsed time: %dm %04.1fs\n"),
+            (int)(time/60),
+            time - floor(time/60)*60);
+    fprintf(stderr, _("\tRate:         %.4f\n"), speed_ratio);
+    fprintf(stderr, _("\tAverage bitrate: %.1f kb/s\n\n"), 
+        8./1000.*((double)bytes/((double)samples/(double)rate)));
 }
 
 void final_statistics_null(char *fn, double time, int rate, long samples, 
-		long bytes)
+        long bytes)
 {
-	/* Don't do anything, this is just a placeholder function for quiet mode */
+    /* Don't do anything, this is just a placeholder function for quiet mode */
 }
 
 void update_statistics_null(char *fn, long total, long done, double time)
 {
-	/* So is this */
+    /* So is this */
 }
 
 void encode_error(char *errmsg)
 {
-	fprintf(stderr, "\n%s\n", errmsg);
+    fprintf(stderr, "\n%s\n", errmsg);
 }
 
 static void print_brconstraints(int min, int max)
@@ -459,37 +459,37 @@
   if(bitrate>0){
     if(managed>0){
       fprintf(stderr, _("Encoding %s%s%s to \n         "
-			"%s%s%s \nat average bitrate %d kbps "),
-	      fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
-	      outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
-	      bitrate);
+            "%s%s%s \nat average bitrate %d kbps "),
+          fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
+          outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
+          bitrate);
       print_brconstraints(min,max);
       fprintf(stderr, ", \nusing full bitrate management engine\n");
     } else {
       fprintf(stderr, _("Encoding %s%s%s to \n         %s%s%s \nat approximate bitrate %d kbps (VBR encoding enabled)\n"),
-	      fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
-	    outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
-	      bitrate);
+          fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
+        outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
+          bitrate);
     }
   }else{
     if(qset>0){
       if(managed>0){
-	fprintf(stderr, _("Encoding %s%s%s to \n         %s%s%s \nat quality level %2.2f using constrained VBR "),
-		fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
-		outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
-		quality * 10);
-	print_brconstraints(min,max);
-	fprintf(stderr, "\n");
+    fprintf(stderr, _("Encoding %s%s%s to \n         %s%s%s \nat quality level %2.2f using constrained VBR "),
+        fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
+        outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
+        quality * 10);
+    print_brconstraints(min,max);
+    fprintf(stderr, "\n");
       }else{
         fprintf(stderr, _("Encoding %s%s%s to \n         %s%s%s \nat quality %2.2f\n"),
-			    fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
+                fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
                 outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
                 quality * 10);
       }
     }else{
       fprintf(stderr, _("Encoding %s%s%s to \n         %s%s%s \nusing bitrate management "),
-	      fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
-	      outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"");
+          fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
+          outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"");
       print_brconstraints(min,max);
       fprintf(stderr, "\n");
     }

Modified: trunk/vorbis-tools/oggenc/encode.h
===================================================================
--- trunk/vorbis-tools/oggenc/encode.h	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/encode.h	2006-06-29 11:00:57 UTC (rev 11665)
@@ -7,9 +7,9 @@
 typedef void TIMER;
 typedef long (*audio_read_func)(void *src, float **buffer, int samples);
 typedef void (*progress_func)(char *fn, long totalsamples, 
-		long samples, double time);
+        long samples, double time);
 typedef void (*enc_end_func)(char *fn, double time, int rate, 
-		long samples, long bytes);
+        long samples, long bytes);
 typedef void (*enc_start_func)(char *fn, char *outfn, int bitrate, 
         float quality, int qset, int managed, int min_br, int max_br);
 typedef void (*error_func)(char *errormessage);
@@ -28,9 +28,9 @@
 void start_encode_null(char *fn, char *outfn, int bitrate, float quality, int qset,
         int managed, int min, int max);
 void final_statistics(char *fn, double time, int rate, long total_samples,
-		long bytes);
+        long bytes);
 void final_statistics_null(char *fn, double time, int rate, long total_samples,
-		long bytes);
+        long bytes);
 void encode_error(char *errmsg);
 
 typedef struct {
@@ -40,89 +40,89 @@
 
 typedef struct
 {
-	char **title;
-	int title_count;
-	char **artist;
-	int artist_count;
-	char **album;
-	int album_count;
-	char **comments;
-	int comment_count;
-	char **tracknum;
-	int track_count;
-	char **dates;
-	int date_count;
-	char **genre;
-	int genre_count;
+    char **title;
+    int title_count;
+    char **artist;
+    int artist_count;
+    char **album;
+    int album_count;
+    char **comments;
+    int comment_count;
+    char **tracknum;
+    int track_count;
+    char **dates;
+    int date_count;
+    char **genre;
+    int genre_count;
     adv_opt *advopt;
     int advopt_count;
-	int copy_comments;
+    int copy_comments;
 
-	int quiet;
+    int quiet;
 
-	int rawmode;
-	int raw_samplesize;
-	int raw_samplerate;
-	int raw_channels;
+    int rawmode;
+    int raw_samplesize;
+    int raw_samplerate;
+    int raw_channels;
     int raw_endianness;
 
-	char *namefmt;
+    char *namefmt;
     char *namefmt_remove;
     char *namefmt_replace;
-	char *outfile;
+    char *outfile;
 
-	/* All 3 in kbps */
+    /* All 3 in kbps */
     int managed;
-	int min_bitrate;
-	int nominal_bitrate;
-	int max_bitrate;
+    int min_bitrate;
+    int nominal_bitrate;
+    int max_bitrate;
 
-	/* Float from 0 to 1 (low->high) */
-	float quality;
+    /* Float from 0 to 1 (low->high) */
+    float quality;
     int quality_set;
 
     int resamplefreq;
     int downmix;
     float scale;
 
-	unsigned int serial;
+    unsigned int serial;
         int fixedserial;
 } oe_options;
 
 typedef struct
 {
-	vorbis_comment *comments;
-	unsigned int serialno;
+    vorbis_comment *comments;
+    unsigned int serialno;
 
-	audio_read_func read_samples;
-	progress_func progress_update;
-	enc_end_func end_encode;
-	enc_start_func start_encode;
-	error_func error;
-	
-	void *readdata;
+    audio_read_func read_samples;
+    progress_func progress_update;
+    enc_end_func end_encode;
+    enc_start_func start_encode;
+    error_func error;
+    
+    void *readdata;
 
-	long total_samples_per_channel;
-	int channels;
-	long rate;
-	int samplesize;
+    long total_samples_per_channel;
+    int channels;
+    long rate;
+    int samplesize;
     int endianness;
     int resamplefreq;
-	int copy_comments;
+    int copy_comments;
 
-	/* Various bitrate/quality options */
+    /* Various bitrate/quality options */
     int managed;
-	int bitrate;
-	int min_bitrate;
-	int max_bitrate;
-	float quality;
+    int bitrate;
+    int min_bitrate;
+    int max_bitrate;
+    float quality;
     int quality_set;
     adv_opt *advopt;
     int advopt_count;
 
-	FILE *out;
-	char *filename;
-	char *infilename;
+    FILE *out;
+    char *filename;
+    char *infilename;
 } oe_enc_opt;
 
 

Modified: trunk/vorbis-tools/oggenc/flac.c
===================================================================
--- trunk/vorbis-tools/oggenc/flac.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/flac.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -33,263 +33,263 @@
 
 int flac_id(unsigned char *buf, int len)
 {
-	if (len < 4) return 0;
+    if (len < 4) return 0;
 
-	return memcmp(buf, "fLaC", 4) == 0;
+    return memcmp(buf, "fLaC", 4) == 0;
 }
 
 
 int oggflac_id(unsigned char *buf, int len)
 {
-	if (len < 32) return 0;
+    if (len < 32) return 0;
 
-	return memcmp(buf, "OggS", 4) == 0 && flac_id(buf+28, len - 28);
+    return memcmp(buf, "OggS", 4) == 0 && flac_id(buf+28, len - 28);
 }
 
 
 int flac_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
 {
-	flacfile *flac = malloc(sizeof(flacfile));
+    flacfile *flac = malloc(sizeof(flacfile));
 
-	flac->decoder = NULL;
-	flac->channels = 0;
-	flac->rate = 0;
-	flac->totalsamples = 0;
-	flac->comments = NULL;
-	flac->in = NULL;
-	flac->eos = 0;
+    flac->decoder = NULL;
+    flac->channels = 0;
+    flac->rate = 0;
+    flac->totalsamples = 0;
+    flac->comments = NULL;
+    flac->in = NULL;
+    flac->eos = 0;
 
-	/* Setup empty audio buffer that will be resized on first frame 
-	   callback */
-	flac->buf = NULL;
-	flac->buf_len = 0;
-	flac->buf_start = 0;
-	flac->buf_fill = 0;
+    /* Setup empty audio buffer that will be resized on first frame 
+       callback */
+    flac->buf = NULL;
+    flac->buf_len = 0;
+    flac->buf_start = 0;
+    flac->buf_fill = 0;
 
-	/* Copy old input data over */
-	flac->oldbuf = malloc(buflen);
-	flac->oldbuf_len = buflen;
-	memcpy(flac->oldbuf, oldbuf, buflen);
-	flac->oldbuf_start = 0;
+    /* Copy old input data over */
+    flac->oldbuf = malloc(buflen);
+    flac->oldbuf_len = buflen;
+    memcpy(flac->oldbuf, oldbuf, buflen);
+    flac->oldbuf_start = 0;
 
-	/* Need to save FILE pointer for read callback */
-	flac->in = in;
+    /* Need to save FILE pointer for read callback */
+    flac->in = in;
 
-	/* Setup FLAC decoder */
-	flac->decoder = EasyFLAC__stream_decoder_new(oggflac_id(oldbuf, buflen));
-	EasyFLAC__set_client_data(flac->decoder, flac);
-	EasyFLAC__set_read_callback(flac->decoder, &easyflac_read_callback);
-	EasyFLAC__set_write_callback(flac->decoder, &easyflac_write_callback);
-	EasyFLAC__set_metadata_callback(flac->decoder, &easyflac_metadata_callback);
-	EasyFLAC__set_error_callback(flac->decoder, &easyflac_error_callback);
-	EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO);
-	EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
-	EasyFLAC__init(flac->decoder);
-	
-	/* Callback will set the total samples and sample rate */
-	EasyFLAC__process_until_end_of_metadata(flac->decoder);
+    /* Setup FLAC decoder */
+    flac->decoder = EasyFLAC__stream_decoder_new(oggflac_id(oldbuf, buflen));
+    EasyFLAC__set_client_data(flac->decoder, flac);
+    EasyFLAC__set_read_callback(flac->decoder, &easyflac_read_callback);
+    EasyFLAC__set_write_callback(flac->decoder, &easyflac_write_callback);
+    EasyFLAC__set_metadata_callback(flac->decoder, &easyflac_metadata_callback);
+    EasyFLAC__set_error_callback(flac->decoder, &easyflac_error_callback);
+    EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO);
+    EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
+    EasyFLAC__init(flac->decoder);
+    
+    /* Callback will set the total samples and sample rate */
+    EasyFLAC__process_until_end_of_metadata(flac->decoder);
 
-	/* Callback will set the number of channels and resize the 
-	   audio buffer */
-	EasyFLAC__process_single(flac->decoder);
-	
-	/* Copy format info for caller */
-	opt->rate = flac->rate;
-	opt->channels = flac->channels;
-	/* flac->total_samples_per_channel was already set by metadata
-	   callback when metadata was processed. */
-	opt->total_samples_per_channel = flac->totalsamples;
-	/* Copy Vorbis-style comments from FLAC file (read in metadata 
-	   callback)*/
-	if (flac->comments != NULL && opt->copy_comments)
-		copy_comments(opt->comments, &flac->comments->data.vorbis_comment);
-	opt->read_samples = flac_read;
-	opt->readdata = (void *)flac;
+    /* Callback will set the number of channels and resize the 
+       audio buffer */
+    EasyFLAC__process_single(flac->decoder);
+    
+    /* Copy format info for caller */
+    opt->rate = flac->rate;
+    opt->channels = flac->channels;
+    /* flac->total_samples_per_channel was already set by metadata
+       callback when metadata was processed. */
+    opt->total_samples_per_channel = flac->totalsamples;
+    /* Copy Vorbis-style comments from FLAC file (read in metadata 
+       callback)*/
+    if (flac->comments != NULL && opt->copy_comments)
+        copy_comments(opt->comments, &flac->comments->data.vorbis_comment);
+    opt->read_samples = flac_read;
+    opt->readdata = (void *)flac;
 
-	return 1;
+    return 1;
 }
 
 
 long flac_read(void *in, float **buffer, int samples)
 {
-	flacfile *flac = (flacfile *)in;
-	long realsamples = 0;
-	FLAC__bool ret;
-	int i,j;
-	while (realsamples < samples)
-	{
-		if (flac->buf_fill > 0)
-		{
-			int copy = flac->buf_fill < (samples - realsamples) ?
-				flac->buf_fill : (samples - realsamples);
-			
-			for (i = 0; i < flac->channels; i++)
-				for (j = 0; j < copy; j++)
-					buffer[i][j+realsamples] = 
-						flac->buf[i][j+flac->buf_start];
-			flac->buf_start += copy;
-			flac->buf_fill -= copy;
-			realsamples += copy;
-		}
-		else if (!flac->eos)
-		{
-			ret = EasyFLAC__process_single(flac->decoder);
-			if (!ret ||
-			    EasyFLAC__get_state(flac->decoder)
-			    == FLAC__STREAM_DECODER_END_OF_STREAM)
-				flac->eos = 1;  /* Bail out! */
-		} else
-			break;
-	}
+    flacfile *flac = (flacfile *)in;
+    long realsamples = 0;
+    FLAC__bool ret;
+    int i,j;
+    while (realsamples < samples)
+    {
+        if (flac->buf_fill > 0)
+        {
+            int copy = flac->buf_fill < (samples - realsamples) ?
+                flac->buf_fill : (samples - realsamples);
+            
+            for (i = 0; i < flac->channels; i++)
+                for (j = 0; j < copy; j++)
+                    buffer[i][j+realsamples] = 
+                        flac->buf[i][j+flac->buf_start];
+            flac->buf_start += copy;
+            flac->buf_fill -= copy;
+            realsamples += copy;
+        }
+        else if (!flac->eos)
+        {
+            ret = EasyFLAC__process_single(flac->decoder);
+            if (!ret ||
+                EasyFLAC__get_state(flac->decoder)
+                == FLAC__STREAM_DECODER_END_OF_STREAM)
+                flac->eos = 1;  /* Bail out! */
+        } else
+            break;
+    }
 
-	return realsamples;
+    return realsamples;
 }
 
 
 void flac_close(void *info)
 {
-	int i;
-	flacfile *flac =  (flacfile *) info;
+    int i;
+    flacfile *flac =  (flacfile *) info;
 
-	for (i = 0; i < flac->channels; i++)
-		free(flac->buf[i]);
+    for (i = 0; i < flac->channels; i++)
+        free(flac->buf[i]);
 
-	free(flac->buf);
-	free(flac->oldbuf);
-	free(flac->comments);
-	EasyFLAC__finish(flac->decoder);
-	EasyFLAC__stream_decoder_delete(flac->decoder);
-	free(flac);
+    free(flac->buf);
+    free(flac->oldbuf);
+    free(flac->comments);
+    EasyFLAC__finish(flac->decoder);
+    EasyFLAC__stream_decoder_delete(flac->decoder);
+    free(flac);
 }
 
 
 FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
 {
-	flacfile *flac = (flacfile *) client_data;
-	int i = 0;
-	int oldbuf_fill = flac->oldbuf_len - flac->oldbuf_start;
-	
-	/* Immediately return if errors occured */
-	if(feof(flac->in))
-	{
-		*bytes = 0;
-		return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
-	}
-	else if(ferror(flac->in))
-	{
-		*bytes = 0;
-		return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
-	}
+    flacfile *flac = (flacfile *) client_data;
+    int i = 0;
+    int oldbuf_fill = flac->oldbuf_len - flac->oldbuf_start;
+    
+    /* Immediately return if errors occured */
+    if(feof(flac->in))
+    {
+        *bytes = 0;
+        return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+    }
+    else if(ferror(flac->in))
+    {
+        *bytes = 0;
+        return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+    }
 
 
-	if(oldbuf_fill > 0) 
-	{
-		int copy;
-		
-		copy = oldbuf_fill < (*bytes - i) ? oldbuf_fill : (*bytes - i);
-		memcpy(buffer + i, flac->oldbuf, copy);
-		i += copy;
-		flac->oldbuf_start += copy;
-	}
-	
-	if(i < *bytes)
-		i += fread(buffer+i, sizeof(FLAC__byte), *bytes - i, flac->in);
+    if(oldbuf_fill > 0) 
+    {
+        int copy;
+        
+        copy = oldbuf_fill < (*bytes - i) ? oldbuf_fill : (*bytes - i);
+        memcpy(buffer + i, flac->oldbuf, copy);
+        i += copy;
+        flac->oldbuf_start += copy;
+    }
+    
+    if(i < *bytes)
+        i += fread(buffer+i, sizeof(FLAC__byte), *bytes - i, flac->in);
 
-	*bytes = i;
-	
-	return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;	 
+    *bytes = i;
+    
+    return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;     
 }
 
 FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
 {
-	flacfile *flac = (flacfile *) client_data;
-	int samples = frame->header.blocksize;
-	int channels = frame->header.channels;
-	int bits_per_sample = frame->header.bits_per_sample;
-	int i, j;
+    flacfile *flac = (flacfile *) client_data;
+    int samples = frame->header.blocksize;
+    int channels = frame->header.channels;
+    int bits_per_sample = frame->header.bits_per_sample;
+    int i, j;
 
-	resize_buffer(flac, channels, samples);
+    resize_buffer(flac, channels, samples);
 
-	for (i = 0; i < channels; i++)
-		for (j = 0; j < samples; j++)
-			flac->buf[i][j] = buffer[i][j] / 
-				 (float) (1 << (bits_per_sample - 1));
+    for (i = 0; i < channels; i++)
+        for (j = 0; j < samples; j++)
+            flac->buf[i][j] = buffer[i][j] / 
+                 (float) (1 << (bits_per_sample - 1));
 
-	flac->buf_start = 0;
-	flac->buf_fill = samples;
+    flac->buf_start = 0;
+    flac->buf_fill = samples;
  
-	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+    return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
 }
 
 void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
 {
-	flacfile *flac = (flacfile *) client_data;
+    flacfile *flac = (flacfile *) client_data;
 
-	switch (metadata->type)
-	{
-	case FLAC__METADATA_TYPE_STREAMINFO:
-		flac->totalsamples = metadata->data.stream_info.total_samples;
-		flac->rate = metadata->data.stream_info.sample_rate;
-		break;
+    switch (metadata->type)
+    {
+    case FLAC__METADATA_TYPE_STREAMINFO:
+        flac->totalsamples = metadata->data.stream_info.total_samples;
+        flac->rate = metadata->data.stream_info.sample_rate;
+        break;
 
-	case FLAC__METADATA_TYPE_VORBIS_COMMENT:
-		flac->comments = FLAC__metadata_object_clone(metadata);
-		break;
-	default:
-		break;
-	}
+    case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+        flac->comments = FLAC__metadata_object_clone(metadata);
+        break;
+    default:
+        break;
+    }
 }
 
 void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
 {
-	flacfile *flac = (flacfile *) client_data;
+    flacfile *flac = (flacfile *) client_data;
 
 }
 
 
 void resize_buffer(flacfile *flac, int newchannels, int newsamples)
 {
-	int i;
+    int i;
 
-	if (newchannels == flac->channels && newsamples == flac->buf_len)
-	{
-		flac->buf_start = 0;
-		flac->buf_fill = 0;
-		return;
-	}
+    if (newchannels == flac->channels && newsamples == flac->buf_len)
+    {
+        flac->buf_start = 0;
+        flac->buf_fill = 0;
+        return;
+    }
 
 
-	/* Not the most efficient approach, but it is easy to follow */
-	if(newchannels != flac->channels)
-	{
-		/* Deallocate all of the sample vectors */
-		for (i = 0; i < flac->channels; i++)
-			free(flac->buf[i]);
+    /* Not the most efficient approach, but it is easy to follow */
+    if(newchannels != flac->channels)
+    {
+        /* Deallocate all of the sample vectors */
+        for (i = 0; i < flac->channels; i++)
+            free(flac->buf[i]);
 
-		flac->buf = realloc(flac->buf, sizeof(float*) * newchannels);
-		flac->channels = newchannels;
+        flac->buf = realloc(flac->buf, sizeof(float*) * newchannels);
+        flac->channels = newchannels;
 
-	}
+    }
 
-	for (i = 0; i < newchannels; i++)
-		flac->buf[i] = malloc(sizeof(float) * newsamples);
+    for (i = 0; i < newchannels; i++)
+        flac->buf[i] = malloc(sizeof(float) * newsamples);
 
-	flac->buf_len = newsamples;
-	flac->buf_start = 0;
-	flac->buf_fill = 0;
+    flac->buf_len = newsamples;
+    flac->buf_start = 0;
+    flac->buf_fill = 0;
 }
 
 void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments)
 {
-	int i;
+    int i;
 
-	for (i = 0; i < f_comments->num_comments; i++)
-	{
-		char *comment = malloc(f_comments->comments[i].length + 1);
-		memset(comment, '\0', f_comments->comments[i].length + 1);
-		strncpy(comment, f_comments->comments[i].entry, f_comments->comments[i].length);
-		vorbis_comment_add(v_comments, comment);
-		free(comment);
-	}
+    for (i = 0; i < f_comments->num_comments; i++)
+    {
+        char *comment = malloc(f_comments->comments[i].length + 1);
+        memset(comment, '\0', f_comments->comments[i].length + 1);
+        strncpy(comment, f_comments->comments[i].entry, f_comments->comments[i].length);
+        vorbis_comment_add(v_comments, comment);
+        free(comment);
+    }
 }
 

Modified: trunk/vorbis-tools/oggenc/flac.h
===================================================================
--- trunk/vorbis-tools/oggenc/flac.h	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/flac.h	2006-06-29 11:00:57 UTC (rev 11665)
@@ -8,27 +8,27 @@
 #include "easyflac.h"
 
 typedef struct {
-	EasyFLAC__StreamDecoder *decoder;
-	short channels;
-	int rate;
-	long totalsamples; /* per channel, of course */
+    EasyFLAC__StreamDecoder *decoder;
+    short channels;
+    int rate;
+    long totalsamples; /* per channel, of course */
 
-	FLAC__StreamMetadata *comments;
+    FLAC__StreamMetadata *comments;
 
-	FILE *in;  /* Cache the FILE pointer so the FLAC read callback can use it */
-	int eos;  /* End of stream read */
+    FILE *in;  /* Cache the FILE pointer so the FLAC read callback can use it */
+    int eos;  /* End of stream read */
 
 
-	/* Buffer for decoded audio */
-	float **buf;  /* channels by buf_len array */
-	int buf_len;
-	int buf_start; /* Offset to start of audio data */
-	int buf_fill; /* Number of bytes of audio data in buffer */
+    /* Buffer for decoded audio */
+    float **buf;  /* channels by buf_len array */
+    int buf_len;
+    int buf_start; /* Offset to start of audio data */
+    int buf_fill; /* Number of bytes of audio data in buffer */
 
-	/* Buffer for input data we already read in the id phase */
-	unsigned char *oldbuf;
-	int oldbuf_len;
-	int oldbuf_start;
+    /* Buffer for input data we already read in the id phase */
+    unsigned char *oldbuf;
+    int oldbuf_len;
+    int oldbuf_start;
 } flacfile;
 
 

Modified: trunk/vorbis-tools/oggenc/oggenc.c
===================================================================
--- trunk/vorbis-tools/oggenc/oggenc.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/oggenc.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -35,239 +35,239 @@
 #define CHUNK 4096 /* We do reads, etc. in multiples of this */
 
 struct option long_options[] = {
-	{"quiet",0,0,'Q'},
-	{"help",0,0,'h'},
-	{"comment",1,0,'c'},
-	{"artist",1,0,'a'},
-	{"album",1,0,'l'},
-	{"title",1,0,'t'},
+    {"quiet",0,0,'Q'},
+    {"help",0,0,'h'},
+    {"comment",1,0,'c'},
+    {"artist",1,0,'a'},
+    {"album",1,0,'l'},
+    {"title",1,0,'t'},
     {"genre",1,0,'G'},
-	{"names",1,0,'n'},
+    {"names",1,0,'n'},
     {"name-remove",1,0,'X'},
     {"name-replace",1,0,'P'},
-	{"output",1,0,'o'},
-	{"version",0,0,'v'},
-	{"raw",0,0,'r'},
-	{"raw-bits",1,0,'B'},
-	{"raw-chan",1,0,'C'},
-	{"raw-rate",1,0,'R'},
+    {"output",1,0,'o'},
+    {"version",0,0,'v'},
+    {"raw",0,0,'r'},
+    {"raw-bits",1,0,'B'},
+    {"raw-chan",1,0,'C'},
+    {"raw-rate",1,0,'R'},
     {"raw-endianness",1,0, 0},
-	{"bitrate",1,0,'b'},
-	{"min-bitrate",1,0,'m'},
-	{"max-bitrate",1,0,'M'},
-	{"quality",1,0,'q'},
-	{"date",1,0,'d'},
-	{"tracknum",1,0,'N'},
-	{"serial",1,0,'s'},
+    {"bitrate",1,0,'b'},
+    {"min-bitrate",1,0,'m'},
+    {"max-bitrate",1,0,'M'},
+    {"quality",1,0,'q'},
+    {"date",1,0,'d'},
+    {"tracknum",1,0,'N'},
+    {"serial",1,0,'s'},
     {"managed", 0, 0, 0},
     {"resample",1,0,0},
     {"downmix", 0,0,0},
     {"scale", 1, 0, 0}, 
     {"advanced-encode-option", 1, 0, 0},
-	{"discard-comments", 0, 0, 0},
-	{NULL,0,0,0}
+    {"discard-comments", 0, 0, 0},
+    {NULL,0,0,0}
 };
-	
+    
 static char *generate_name_string(char *format, char *remove_list, 
         char *replace_list, char *artist, char *title, char *album, 
         char *track, char *date, char *genre);
 static void parse_options(int argc, char **argv, oe_options *opt);
 static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum, 
-		char **artist,char **album, char **title, char **tracknum, char **date,
+        char **artist,char **album, char **title, char **tracknum, char **date,
         char **genre);
 static void usage(void);
 
 int main(int argc, char **argv)
 {
-	/* Default values */
-	oe_options opt = {NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
-			  0, NULL, 0, NULL, 0, NULL, 0, 1, 0, 0,16,44100,2, 0, NULL,
-			  DEFAULT_NAMEFMT_REMOVE, DEFAULT_NAMEFMT_REPLACE, 
-			  NULL, 0, -1,-1,-1,.3,-1,0, 0,0.f, 0, 0}; 
+    /* Default values */
+    oe_options opt = {NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
+              0, NULL, 0, NULL, 0, NULL, 0, 1, 0, 0,16,44100,2, 0, NULL,
+              DEFAULT_NAMEFMT_REMOVE, DEFAULT_NAMEFMT_REPLACE, 
+              NULL, 0, -1,-1,-1,.3,-1,0, 0,0.f, 0, 0}; 
 
-	int i;
+    int i;
 
-	char **infiles;
-	int numfiles;
-	int errors=0;
+    char **infiles;
+    int numfiles;
+    int errors=0;
 
-	setlocale(LC_ALL, "");
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	textdomain(PACKAGE);
+    setlocale(LC_ALL, "");
+    bindtextdomain(PACKAGE, LOCALEDIR);
+    textdomain(PACKAGE);
 
-	parse_options(argc, argv, &opt);
+    parse_options(argc, argv, &opt);
 
-	if(optind >= argc)
-	{
-		fprintf(stderr, _("%s%s\nERROR: No input files specified. Use -h for help.\n"), VERSION_STRING, COPYRIGHT);
-		return 1;
-	}
-	else
-	{
-		infiles = argv + optind;
-		numfiles = argc - optind;
-	}
+    if(optind >= argc)
+    {
+        fprintf(stderr, _("%s%s\nERROR: No input files specified. Use -h for help.\n"), VERSION_STRING, COPYRIGHT);
+        return 1;
+    }
+    else
+    {
+        infiles = argv + optind;
+        numfiles = argc - optind;
+    }
 
-	/* Now, do some checking for illegal argument combinations */
+    /* Now, do some checking for illegal argument combinations */
 
-	for(i = 0; i < numfiles; i++)
-	{
-		if(!strcmp(infiles[i], "-") && numfiles > 1)
-		{
-			fprintf(stderr, _("ERROR: Multiple files specified when using stdin\n"));
-			exit(1);
-		}
-	}
+    for(i = 0; i < numfiles; i++)
+    {
+        if(!strcmp(infiles[i], "-") && numfiles > 1)
+        {
+            fprintf(stderr, _("ERROR: Multiple files specified when using stdin\n"));
+            exit(1);
+        }
+    }
 
-	if(numfiles > 1 && opt.outfile)
-	{
-		fprintf(stderr, _("ERROR: Multiple input files with specified output filename: suggest using -n\n"));
-		exit(1);
-	}
+    if(numfiles > 1 && opt.outfile)
+    {
+        fprintf(stderr, _("ERROR: Multiple input files with specified output filename: suggest using -n\n"));
+        exit(1);
+    }
 
-	if(!opt.fixedserial)
-	{
-		/* We randomly pick a serial number. This is then incremented for each file */
-		srand(time(NULL));
-		opt.serial = rand();
-	}
+    if(!opt.fixedserial)
+    {
+        /* We randomly pick a serial number. This is then incremented for each file */
+        srand(time(NULL));
+        opt.serial = rand();
+    }
 
-	for(i = 0; i < numfiles; i++)
-	{
-		/* Once through the loop for each file */
+    for(i = 0; i < numfiles; i++)
+    {
+        /* Once through the loop for each file */
 
-		oe_enc_opt      enc_opts;
-		vorbis_comment  vc;
-		char *out_fn = NULL;
-		FILE *in, *out = NULL;
-		int foundformat = 0;
-		int closeout = 0, closein = 0;
-		char *artist=NULL, *album=NULL, *title=NULL, *track=NULL;
+        oe_enc_opt      enc_opts;
+        vorbis_comment  vc;
+        char *out_fn = NULL;
+        FILE *in, *out = NULL;
+        int foundformat = 0;
+        int closeout = 0, closein = 0;
+        char *artist=NULL, *album=NULL, *title=NULL, *track=NULL;
         char *date=NULL, *genre=NULL;
-		input_format *format;
+        input_format *format;
 
-		/* Set various encoding defaults */
+        /* Set various encoding defaults */
 
-		enc_opts.serialno = opt.serial++;
-		enc_opts.progress_update = update_statistics_full;
+        enc_opts.serialno = opt.serial++;
+        enc_opts.progress_update = update_statistics_full;
         enc_opts.start_encode = start_encode_full;
-		enc_opts.end_encode = final_statistics;
-		enc_opts.error = encode_error;
-		enc_opts.comments = &vc;
-		enc_opts.copy_comments = opt.copy_comments;
+        enc_opts.end_encode = final_statistics;
+        enc_opts.error = encode_error;
+        enc_opts.comments = &vc;
+        enc_opts.copy_comments = opt.copy_comments;
 
-		/* OK, let's build the vorbis_comments structure */
-		build_comments(&vc, &opt, i, &artist, &album, &title, &track, 
+        /* OK, let's build the vorbis_comments structure */
+        build_comments(&vc, &opt, i, &artist, &album, &title, &track, 
                 &date, &genre);
 
-		if(!strcmp(infiles[i], "-"))
-		{
-			setbinmode(stdin);
-			in = stdin;
+        if(!strcmp(infiles[i], "-"))
+        {
+            setbinmode(stdin);
+            in = stdin;
             infiles[i] = NULL;
-			if(!opt.outfile)
-			{
-				setbinmode(stdout);
-				out = stdout;
-			}
-		}
-		else
-		{
-			in = fopen(infiles[i], "rb");
+            if(!opt.outfile)
+            {
+                setbinmode(stdout);
+                out = stdout;
+            }
+        }
+        else
+        {
+            in = fopen(infiles[i], "rb");
 
-			if(in == NULL)
-			{
-				fprintf(stderr, _("ERROR: Cannot open input file \"%s\": %s\n"), infiles[i], strerror(errno));
-				free(out_fn);
-				errors++;
-				continue;
-			}
+            if(in == NULL)
+            {
+                fprintf(stderr, _("ERROR: Cannot open input file \"%s\": %s\n"), infiles[i], strerror(errno));
+                free(out_fn);
+                errors++;
+                continue;
+            }
 
-			closein = 1;
-		}
+            closein = 1;
+        }
 
-		/* Now, we need to select an input audio format - we do this before opening
-		   the output file so that we don't end up with a 0-byte file if the input
-		   file can't be read */
+        /* Now, we need to select an input audio format - we do this before opening
+           the output file so that we don't end up with a 0-byte file if the input
+           file can't be read */
 
-		if(opt.rawmode)
-		{
+        if(opt.rawmode)
+        {
             input_format raw_format = {NULL, 0, raw_open, wav_close, "raw", 
                 N_("RAW file reader")};
 
-			enc_opts.rate=opt.raw_samplerate;
-			enc_opts.channels=opt.raw_channels;
-			enc_opts.samplesize=opt.raw_samplesize;
+            enc_opts.rate=opt.raw_samplerate;
+            enc_opts.channels=opt.raw_channels;
+            enc_opts.samplesize=opt.raw_samplesize;
             enc_opts.endianness=opt.raw_endianness;
             
             format = &raw_format;
             format->open_func(in, &enc_opts, NULL, 0);
-			foundformat=1;
-		}
-		else
-		{
-			format = open_audio_file(in, &enc_opts);
-			if(format)
-			{
+            foundformat=1;
+        }
+        else
+        {
+            format = open_audio_file(in, &enc_opts);
+            if(format)
+            {
                 if(!opt.quiet)
-				    fprintf(stderr, _("Opening with %s module: %s\n"), 
-					    	format->format, format->description);
-				foundformat=1;
-			}
+                    fprintf(stderr, _("Opening with %s module: %s\n"), 
+                            format->format, format->description);
+                foundformat=1;
+            }
 
-		}
+        }
 
-		if(!foundformat)
-		{
-			fprintf(stderr, _("ERROR: Input file \"%s\" is not a supported format\n"), infiles[i]?infiles[i]:"(stdin)");
-    		if(closein)
-				fclose(in);
-			errors++;
-			continue;
-		}
+        if(!foundformat)
+        {
+            fprintf(stderr, _("ERROR: Input file \"%s\" is not a supported format\n"), infiles[i]?infiles[i]:"(stdin)");
+            if(closein)
+                fclose(in);
+            errors++;
+            continue;
+        }
 
-		/* Ok. We can read the file - so now open the output file */
+        /* Ok. We can read the file - so now open the output file */
 
-		if(opt.outfile && !strcmp(opt.outfile, "-"))
-		{
-			setbinmode(stdout);
-			out = stdout;
-		}
-		else if(out == NULL)
-		{
-			if(opt.outfile)
-			{
-				out_fn = strdup(opt.outfile);
-			}
-			else if(opt.namefmt)
-			{
-				out_fn = generate_name_string(opt.namefmt, opt.namefmt_remove, 
+        if(opt.outfile && !strcmp(opt.outfile, "-"))
+        {
+            setbinmode(stdout);
+            out = stdout;
+        }
+        else if(out == NULL)
+        {
+            if(opt.outfile)
+            {
+                out_fn = strdup(opt.outfile);
+            }
+            else if(opt.namefmt)
+            {
+                out_fn = generate_name_string(opt.namefmt, opt.namefmt_remove, 
                         opt.namefmt_replace, artist, title, album, track,date,
                         genre);
-			}
+            }
             /* This bit was widely derided in mid-2002, so it's been removed */
             /*
-			else if(opt.title)
-			{
-				out_fn = malloc(strlen(title) + 5);
-				strcpy(out_fn, title);
-				strcat(out_fn, ".ogg");
-			}
+            else if(opt.title)
+            {
+                out_fn = malloc(strlen(title) + 5);
+                strcpy(out_fn, title);
+                strcat(out_fn, ".ogg");
+            }
             */
-			else if(infiles[i])
-			{
-				/* Create a filename from existing filename, replacing extension with .ogg */
-				char *start, *end;
+            else if(infiles[i])
+            {
+                /* Create a filename from existing filename, replacing extension with .ogg */
+                char *start, *end;
 
-				start = infiles[i];
-				end = strrchr(infiles[i], '.');
-				end = end?end:(start + strlen(infiles[i])+1);
-			
-				out_fn = malloc(end - start + 5);
-				strncpy(out_fn, start, end-start);
-				out_fn[end-start] = 0;
-				strcat(out_fn, ".ogg");
-			}
+                start = infiles[i];
+                end = strrchr(infiles[i], '.');
+                end = end?end:(start + strlen(infiles[i])+1);
+            
+                out_fn = malloc(end - start + 5);
+                strncpy(out_fn, start, end-start);
+                out_fn[end-start] = 0;
+                strcat(out_fn, ".ogg");
+            }
             else {
                 fprintf(stderr, _("WARNING: No filename, defaulting to \"default.ogg\"\n"));
                 out_fn = strdup("default.ogg");
@@ -277,10 +277,10 @@
             if(create_directories(out_fn)) {
                 if(closein)
                     fclose(in);
-				fprintf(stderr, _("ERROR: Could not create required subdirectories for output filename \"%s\"\n"), out_fn);
-				errors++;
-				free(out_fn);
-				continue;
+                fprintf(stderr, _("ERROR: Could not create required subdirectories for output filename \"%s\"\n"), out_fn);
+                errors++;
+                free(out_fn);
+                continue;
             }
 
             if(infiles[i] && !strcmp(infiles[i], out_fn)) {
@@ -290,30 +290,30 @@
                 continue;
             }
 
-			out = fopen(out_fn, "wb");
-			if(out == NULL)
-			{
-				if(closein)
-					fclose(in);
-				fprintf(stderr, _("ERROR: Cannot open output file \"%s\": %s\n"), out_fn, strerror(errno));
-				errors++;
-				free(out_fn);
-				continue;
-			}	
-			closeout = 1;
-		}
+            out = fopen(out_fn, "wb");
+            if(out == NULL)
+            {
+                if(closein)
+                    fclose(in);
+                fprintf(stderr, _("ERROR: Cannot open output file \"%s\": %s\n"), out_fn, strerror(errno));
+                errors++;
+                free(out_fn);
+                continue;
+            }    
+            closeout = 1;
+        }
 
-		/* Now, set the rest of the options */
-		enc_opts.out = out;
-		enc_opts.comments = &vc;
-		enc_opts.filename = out_fn;
-		enc_opts.infilename = infiles[i];
+        /* Now, set the rest of the options */
+        enc_opts.out = out;
+        enc_opts.comments = &vc;
+        enc_opts.filename = out_fn;
+        enc_opts.infilename = infiles[i];
         enc_opts.managed = opt.managed;
-		enc_opts.bitrate = opt.nominal_bitrate; 
-		enc_opts.min_bitrate = opt.min_bitrate;
-		enc_opts.max_bitrate = opt.max_bitrate;
-		enc_opts.quality = opt.quality;
-		enc_opts.quality_set = opt.quality_set;
+        enc_opts.bitrate = opt.nominal_bitrate; 
+        enc_opts.min_bitrate = opt.min_bitrate;
+        enc_opts.max_bitrate = opt.max_bitrate;
+        enc_opts.quality = opt.quality;
+        enc_opts.quality_set = opt.quality_set;
         enc_opts.advopt = opt.advopt;
         enc_opts.advopt_count = opt.advopt_count;
 
@@ -347,18 +347,18 @@
         }
 
 
-		if(!enc_opts.total_samples_per_channel)
-			enc_opts.progress_update = update_statistics_notime;
+        if(!enc_opts.total_samples_per_channel)
+            enc_opts.progress_update = update_statistics_notime;
 
-		if(opt.quiet)
-		{
+        if(opt.quiet)
+        {
             enc_opts.start_encode = start_encode_null;
-			enc_opts.progress_update = update_statistics_null;
-			enc_opts.end_encode = final_statistics_null;
-		}
+            enc_opts.progress_update = update_statistics_null;
+            enc_opts.end_encode = final_statistics_null;
+        }
 
-		if(oe_encode(&enc_opts))
-			errors++;
+        if(oe_encode(&enc_opts))
+            errors++;
 
         if(opt.scale > 0)
             clear_scaler(&enc_opts);
@@ -368,40 +368,40 @@
             clear_resample(&enc_opts);
 clear_all:
 
-		if(out_fn) free(out_fn);
+        if(out_fn) free(out_fn);
         if(opt.outfile) free(opt.outfile);
-		vorbis_comment_clear(&vc);
-		format->close_func(enc_opts.readdata);
+        vorbis_comment_clear(&vc);
+        format->close_func(enc_opts.readdata);
 
-		if(closein)
-			fclose(in);
-		if(closeout)
-			fclose(out);
-	}/* Finished this file, loop around to next... */
+        if(closein)
+            fclose(in);
+        if(closeout)
+            fclose(out);
+    }/* Finished this file, loop around to next... */
 
-	return errors?1:0;
+    return errors?1:0;
 
 }
 
 static void usage(void)
 {
-	fprintf(stdout, 
-		_("%s%s\n"
-		"Usage: oggenc [options] input.wav [...]\n"
-		"\n"
-		"OPTIONS:\n"
-		" General:\n"
-		" -Q, --quiet          Produce no output to stderr\n"
-		" -h, --help           Print this help text\n"
+    fprintf(stdout, 
+        _("%s%s\n"
+        "Usage: oggenc [options] input.wav [...]\n"
+        "\n"
+        "OPTIONS:\n"
+        " General:\n"
+        " -Q, --quiet          Produce no output to stderr\n"
+        " -h, --help           Print this help text\n"
         " -v, --version        Print the version number\n"
-		" -r, --raw            Raw mode. Input files are read directly as PCM data\n"
-		" -B, --raw-bits=n     Set bits/sample for raw input. Default is 16\n"
-		" -C, --raw-chan=n     Set number of channels for raw input. Default is 2\n"
-		" -R, --raw-rate=n     Set samples/sec for raw input. Default is 44100\n"
+        " -r, --raw            Raw mode. Input files are read directly as PCM data\n"
+        " -B, --raw-bits=n     Set bits/sample for raw input. Default is 16\n"
+        " -C, --raw-chan=n     Set number of channels for raw input. Default is 2\n"
+        " -R, --raw-rate=n     Set samples/sec for raw input. Default is 44100\n"
         " --raw-endianness     1 for bigendian, 0 for little (defaults to 0)\n"
-		" -b, --bitrate        Choose a nominal bitrate to encode at. Attempt\n"
-		"                      to encode at a bitrate averaging this. Takes an\n"
-		"                      argument in kbps. By default, this produces a VBR\n"
+        " -b, --bitrate        Choose a nominal bitrate to encode at. Attempt\n"
+        "                      to encode at a bitrate averaging this. Takes an\n"
+        "                      argument in kbps. By default, this produces a VBR\n"
         "                      encoding, equivalent to using -q or --quality.\n"
         "                      See the --managed option to use a managed bitrate\n"
         "                      targetting the selected bitrate.\n"
@@ -410,12 +410,12 @@
         "                      but encoding will be much slower. Don't use it unless\n"
         "                      you have a strong need for detailed control over\n"
         "                      bitrate, such as for streaming.\n"
-		" -m, --min-bitrate    Specify a minimum bitrate (in kbps). Useful for\n"
-		"                      encoding for a fixed-size channel. Using this will\n"
+        " -m, --min-bitrate    Specify a minimum bitrate (in kbps). Useful for\n"
+        "                      encoding for a fixed-size channel. Using this will\n"
         "                      automatically enable managed bitrate mode (see\n"
         "                      --managed).\n"
-		" -M, --max-bitrate    Specify a maximum bitrate in kbps. Useful for\n"
-		"                      streaming applications. Using this will automatically\n"
+        " -M, --max-bitrate    Specify a maximum bitrate in kbps. Useful for\n"
+        "                      streaming applications. Using this will automatically\n"
         "                      enable managed bitrate mode (see --managed).\n"
         " --advanced-encode-option option=value\n"
         "                      Sets an advanced encoder option to the given value.\n"
@@ -423,26 +423,26 @@
         "                      in the man page supplied with this program. They are\n"
         "                      for advanced users only, and should be used with\n"
         "                      caution.\n"
-		" -q, --quality        Specify quality, between -1 (very low) and 10 (very\n"
+        " -q, --quality        Specify quality, between -1 (very low) and 10 (very\n"
         "                      high), instead of specifying a particular bitrate.\n"
-		"                      This is the normal mode of operation.\n"
+        "                      This is the normal mode of operation.\n"
         "                      Fractional qualities (e.g. 2.75) are permitted\n"
         "                      The default quality level is 3.\n"
         " --resample n         Resample input data to sampling rate n (Hz)\n"
         " --downmix            Downmix stereo to mono. Only allowed on stereo\n"
         "                      input.\n"
-		" -s, --serial         Specify a serial number for the stream. If encoding\n"
-		"                      multiple files, this will be incremented for each\n"
-		"                      stream after the first.\n"
-		" --discard-comments   Prevents comments in FLAC and Ogg FLAC files from\n"
-		"                      being copied to the output Ogg Vorbis file.\n"
-		"\n"
-		" Naming:\n"
-		" -o, --output=fn      Write file to fn (only valid in single-file mode)\n"
-		" -n, --names=string   Produce filenames as this string, with %%a, %%t, %%l,\n"
-		"                      %%n, %%d replaced by artist, title, album, track number,\n"
-		"                      and date, respectively (see below for specifying these).\n"
-		"                      %%%% gives a literal %%.\n"
+        " -s, --serial         Specify a serial number for the stream. If encoding\n"
+        "                      multiple files, this will be incremented for each\n"
+        "                      stream after the first.\n"
+        " --discard-comments   Prevents comments in FLAC and Ogg FLAC files from\n"
+        "                      being copied to the output Ogg Vorbis file.\n"
+        "\n"
+        " Naming:\n"
+        " -o, --output=fn      Write file to fn (only valid in single-file mode)\n"
+        " -n, --names=string   Produce filenames as this string, with %%a, %%t, %%l,\n"
+        "                      %%n, %%d replaced by artist, title, album, track number,\n"
+        "                      and date, respectively (see below for specifying these).\n"
+        "                      %%%% gives a literal %%.\n"
         " -X, --name-remove=s  Remove the specified characters from parameters to the\n"
         "                      -n format string. Useful to ensure legal filenames.\n"
         " -P, --name-replace=s Replace characters removed by --name-remove with the\n"
@@ -451,36 +451,36 @@
         "                      characters are just removed.\n"
         "                      Default settings for the above two arguments are platform\n"
         "                      specific.\n"
-		" -c, --comment=c      Add the given string as an extra comment. This may be\n"
-		"                      used multiple times. The argument should be in the\n"
+        " -c, --comment=c      Add the given string as an extra comment. This may be\n"
+        "                      used multiple times. The argument should be in the\n"
         "                      format \"tag=value\".\n"
-		" -d, --date           Date for track (usually date of performance)\n"
-		" -N, --tracknum       Track number for this track\n"
-		" -t, --title          Title for this track\n"
-		" -l, --album          Name of album\n"
-		" -a, --artist         Name of artist\n"
+        " -d, --date           Date for track (usually date of performance)\n"
+        " -N, --tracknum       Track number for this track\n"
+        " -t, --title          Title for this track\n"
+        " -l, --album          Name of album\n"
+        " -a, --artist         Name of artist\n"
         " -G, --genre          Genre of track\n"
-		"                      If multiple input files are given, then multiple\n"
-		"                      instances of the previous five arguments will be used,\n"
-		"                      in the order they are given. If fewer titles are\n"
-		"                      specified than files, OggEnc will print a warning, and\n"
-		"                      reuse the final one for the remaining files. If fewer\n"
-		"                      track numbers are given, the remaining files will be\n"
-		"                      unnumbered. For the others, the final tag will be reused\n"
-		"                      for all others without warning (so you can specify a date\n"
-		"                      once, for example, and have it used for all the files)\n"
-		"\n"
-		"INPUT FILES:\n"
-		" OggEnc input files must currently be 24, 16, or 8 bit PCM WAV, AIFF, or AIFF/C\n"
-		" files, 32 bit IEEE floating point WAV, and optionally FLAC or Ogg FLAC. Files\n"
+        "                      If multiple input files are given, then multiple\n"
+        "                      instances of the previous five arguments will be used,\n"
+        "                      in the order they are given. If fewer titles are\n"
+        "                      specified than files, OggEnc will print a warning, and\n"
+        "                      reuse the final one for the remaining files. If fewer\n"
+        "                      track numbers are given, the remaining files will be\n"
+        "                      unnumbered. For the others, the final tag will be reused\n"
+        "                      for all others without warning (so you can specify a date\n"
+        "                      once, for example, and have it used for all the files)\n"
+        "\n"
+        "INPUT FILES:\n"
+        " OggEnc input files must currently be 24, 16, or 8 bit PCM WAV, AIFF, or AIFF/C\n"
+        " files, 32 bit IEEE floating point WAV, and optionally FLAC or Ogg FLAC. Files\n"
                 "  may be mono or stereo (or more channels) and any sample rate.\n"
-		" Alternatively, the --raw option may be used to use a raw PCM data file, which\n"
-		" must be 16 bit stereo little-endian PCM ('headerless wav'), unless additional\n"
-		" parameters for raw mode are specified.\n"
-		" You can specify taking the file from stdin by using - as the input filename.\n"
-		" In this mode, output is to stdout unless an output filename is specified\n"
-		" with -o\n"
-		"\n"), VERSION_STRING, COPYRIGHT);
+        " Alternatively, the --raw option may be used to use a raw PCM data file, which\n"
+        " must be 16 bit stereo little-endian PCM ('headerless wav'), unless additional\n"
+        " parameters for raw mode are specified.\n"
+        " You can specify taking the file from stdin by using - as the input filename.\n"
+        " In this mode, output is to stdout unless an output filename is specified\n"
+        " with -o\n"
+        "\n"), VERSION_STRING, COPYRIGHT);
 }
 
 static int strncpy_filtered(char *dst, char *src, int len, char *remove_list, 
@@ -524,104 +524,104 @@
         char *replace_list, char *artist, char *title, char *album, 
         char *track, char *date, char *genre)
 {
-	char *buffer;
-	char next;
-	char *string;
-	int used=0;
-	int buflen;
+    char *buffer;
+    char next;
+    char *string;
+    int used=0;
+    int buflen;
 
-	buffer = calloc(CHUNK+1,1);
-	buflen = CHUNK;
+    buffer = calloc(CHUNK+1,1);
+    buflen = CHUNK;
 
-	while(*format && used < buflen)
-	{
-		next = *format++;
+    while(*format && used < buflen)
+    {
+        next = *format++;
 
-		if(next == '%')
-		{
-			switch(*format++)
-			{
-				case '%':
-					*(buffer+(used++)) = '%';
-					break;
-				case 'a':
-					string = artist?artist:_("(none)");
-					used += strncpy_filtered(buffer+used, string, buflen-used, 
+        if(next == '%')
+        {
+            switch(*format++)
+            {
+                case '%':
+                    *(buffer+(used++)) = '%';
+                    break;
+                case 'a':
+                    string = artist?artist:_("(none)");
+                    used += strncpy_filtered(buffer+used, string, buflen-used, 
                             remove_list, replace_list);
-					break;
-				case 'd':
-					string = date?date:_("(none)");
-					used += strncpy_filtered(buffer+used, string, buflen-used,
+                    break;
+                case 'd':
+                    string = date?date:_("(none)");
+                    used += strncpy_filtered(buffer+used, string, buflen-used,
                             remove_list, replace_list);
-					break;
+                    break;
                 case 'g':
                     string = genre?genre:_("(none)");
                     used += strncpy_filtered(buffer+used, string, buflen-used,
                             remove_list, replace_list);
                     break;
-				case 't':
-					string = title?title:_("(none)");
-					used += strncpy_filtered(buffer+used, string, buflen-used,
+                case 't':
+                    string = title?title:_("(none)");
+                    used += strncpy_filtered(buffer+used, string, buflen-used,
                             remove_list, replace_list);
-					break;
-				case 'l':
-					string = album?album:_("(none)");
-					used += strncpy_filtered(buffer+used, string, buflen-used,
+                    break;
+                case 'l':
+                    string = album?album:_("(none)");
+                    used += strncpy_filtered(buffer+used, string, buflen-used,
                             remove_list, replace_list);
-					break;
-				case 'n':
-					string = track?track:_("(none)");
-					used += strncpy_filtered(buffer+used, string, buflen-used,
+                    break;
+                case 'n':
+                    string = track?track:_("(none)");
+                    used += strncpy_filtered(buffer+used, string, buflen-used,
                             remove_list, replace_list);
-					break;
-				default:
-					fprintf(stderr, _("WARNING: Ignoring illegal escape character '%c' in name format\n"), *(format - 1));
-					break;
-			}
-		}
-		else
-			*(buffer + (used++)) = next;
-	}
+                    break;
+                default:
+                    fprintf(stderr, _("WARNING: Ignoring illegal escape character '%c' in name format\n"), *(format - 1));
+                    break;
+            }
+        }
+        else
+            *(buffer + (used++)) = next;
+    }
 
-	return buffer;
+    return buffer;
 }
 
 static void parse_options(int argc, char **argv, oe_options *opt)
 {
-	int ret;
-	int option_index = 1;
+    int ret;
+    int option_index = 1;
 
-	while((ret = getopt_long(argc, argv, "A:a:b:B:c:C:d:G:hl:m:M:n:N:o:P:q:QrR:s:t:vX:", 
-					long_options, &option_index)) != -1)
-	{
-		switch(ret)
-		{
-			case 0:
+    while((ret = getopt_long(argc, argv, "A:a:b:B:c:C:d:G:hl:m:M:n:N:o:P:q:QrR:s:t:vX:", 
+                    long_options, &option_index)) != -1)
+    {
+        switch(ret)
+        {
+            case 0:
                 if(!strcmp(long_options[option_index].name, "managed")) {
-		            if(!opt->managed){
+                    if(!opt->managed){
                         if(!opt->quiet)
-            		        fprintf(stderr, 
+                            fprintf(stderr, 
                                     _("Enabling bitrate management engine\n"));
                         opt->managed = 1;
-        		    }
+                    }
                 }
                 else if(!strcmp(long_options[option_index].name, 
                             "raw-endianness")) {
-				    if (opt->rawmode != 1)
-    				{
-	    				opt->rawmode = 1;
-		    			fprintf(stderr, _("WARNING: Raw endianness specified for non-raw data. Assuming input is raw.\n"));
-			    	}
-				    if(sscanf(optarg, "%d", &opt->raw_endianness) != 1) {
+                    if (opt->rawmode != 1)
+                    {
+                        opt->rawmode = 1;
+                        fprintf(stderr, _("WARNING: Raw endianness specified for non-raw data. Assuming input is raw.\n"));
+                    }
+                    if(sscanf(optarg, "%d", &opt->raw_endianness) != 1) {
                         fprintf(stderr, _("WARNING: Couldn't read endianness argument \"%s\"\n"), optarg);
-    					opt->raw_endianness = 0;
+                        opt->raw_endianness = 0;
                     }
                 }
                 else if(!strcmp(long_options[option_index].name,
                             "resample")) {
-				    if(sscanf(optarg, "%d", &opt->resamplefreq) != 1) {
+                    if(sscanf(optarg, "%d", &opt->resamplefreq) != 1) {
                         fprintf(stderr, _("WARNING: Couldn't read resampling frequency \"%s\"\n"), optarg);
-    					opt->resamplefreq = 0;
+                        opt->resamplefreq = 0;
                     }
                     if(opt->resamplefreq < 100) /* User probably specified it
                                                    in kHz accidently */
@@ -634,7 +634,7 @@
                 }
                 else if(!strcmp(long_options[option_index].name, "scale")) {
                     opt->scale = atof(optarg);
-				    if(sscanf(optarg, "%f", &opt->scale) != 1) {
+                    if(sscanf(optarg, "%f", &opt->scale) != 1) {
                         opt->scale = 0;
                         fprintf(stderr, _("Warning: Couldn't parse scaling factor \"%s\"\n"), 
                                 optarg);
@@ -657,252 +657,252 @@
                     opt->advopt[opt->advopt_count - 1].val = val;
                 }
                 else if(!strcmp(long_options[option_index].name, "discard-comments")) {
-		  opt->copy_comments = 0;
-		}
+          opt->copy_comments = 0;
+        }
 
                 else {
-				    fprintf(stderr, _("Internal error parsing command line options\n"));
-				    exit(1);
+                    fprintf(stderr, _("Internal error parsing command line options\n"));
+                    exit(1);
                 }
 
-				break;
-			case 'a':
-				opt->artist = realloc(opt->artist, (++opt->artist_count)*sizeof(char *));
-				opt->artist[opt->artist_count - 1] = strdup(optarg);
-				break;
-			case 'c':
+                break;
+            case 'a':
+                opt->artist = realloc(opt->artist, (++opt->artist_count)*sizeof(char *));
+                opt->artist[opt->artist_count - 1] = strdup(optarg);
+                break;
+            case 'c':
                 if(strchr(optarg, '=') == NULL) {
                     fprintf(stderr, _("Warning: Illegal comment used (\"%s\"), ignoring.\n"), optarg);
                     break;
                 }
-				opt->comments = realloc(opt->comments, (++opt->comment_count)*sizeof(char *));
-				opt->comments[opt->comment_count - 1] = strdup(optarg);
-				break;
-			case 'd':
-				opt->dates = realloc(opt->dates, (++opt->date_count)*sizeof(char *));
-				opt->dates[opt->date_count - 1] = strdup(optarg);
-				break;
+                opt->comments = realloc(opt->comments, (++opt->comment_count)*sizeof(char *));
+                opt->comments[opt->comment_count - 1] = strdup(optarg);
+                break;
+            case 'd':
+                opt->dates = realloc(opt->dates, (++opt->date_count)*sizeof(char *));
+                opt->dates[opt->date_count - 1] = strdup(optarg);
+                break;
             case 'G':
                 opt->genre = realloc(opt->genre, (++opt->genre_count)*sizeof(char *));
                 opt->genre[opt->genre_count - 1] = strdup(optarg);
                 break;
-			case 'h':
-				usage();
-				exit(0);
-				break;
-			case 'l':
-				opt->album = realloc(opt->album, (++opt->album_count)*sizeof(char *));
-				opt->album[opt->album_count - 1] = strdup(optarg);
-				break;
-			case 's':
-				/* Would just use atoi(), but that doesn't deal with unsigned
-				 * ints. Damn */
-				if(sscanf(optarg, "%u", &opt->serial) != 1)
-					opt->serial = 0; /* Failed, so just set to zero */
+            case 'h':
+                usage();
+                exit(0);
+                break;
+            case 'l':
+                opt->album = realloc(opt->album, (++opt->album_count)*sizeof(char *));
+                opt->album[opt->album_count - 1] = strdup(optarg);
+                break;
+            case 's':
+                /* Would just use atoi(), but that doesn't deal with unsigned
+                 * ints. Damn */
+                if(sscanf(optarg, "%u", &opt->serial) != 1)
+                    opt->serial = 0; /* Failed, so just set to zero */
                                 else
                                     opt->fixedserial = 1;
-				break;
-			case 't':
-				opt->title = realloc(opt->title, (++opt->title_count)*sizeof(char *));
-				opt->title[opt->title_count - 1] = strdup(optarg);
-				break;
-			case 'b':
-   				if(sscanf(optarg, "%d", &opt->nominal_bitrate)
-    					!= 1) {
-	    			fprintf(stderr, _("Warning: nominal bitrate \"%s\" not recognised\n"), optarg);
-		    		opt->nominal_bitrate = -1;
-				}
+                break;
+            case 't':
+                opt->title = realloc(opt->title, (++opt->title_count)*sizeof(char *));
+                opt->title[opt->title_count - 1] = strdup(optarg);
+                break;
+            case 'b':
+                   if(sscanf(optarg, "%d", &opt->nominal_bitrate)
+                        != 1) {
+                    fprintf(stderr, _("Warning: nominal bitrate \"%s\" not recognised\n"), optarg);
+                    opt->nominal_bitrate = -1;
+                }
 
-				break;
-			case 'm':
-				if(sscanf(optarg, "%d", &opt->min_bitrate)
-						!= 1) {
-					fprintf(stderr, _("Warning: minimum bitrate \"%s\" not recognised\n"), optarg);
-					opt->min_bitrate = -1;
-				}
-				if(!opt->managed){
-				  if(!opt->quiet)
-				    fprintf(stderr, 
-					    _("Enabling bitrate management engine\n"));
-				  opt->managed = 1;
-				}
-				break;
-			case 'M':
-				if(sscanf(optarg, "%d", &opt->max_bitrate)
-						!= 1) {
-					fprintf(stderr, _("Warning: maximum bitrate \"%s\" not recognised\n"), optarg);
-					opt->max_bitrate = -1;
-				}
-				if(!opt->managed){
-				  if(!opt->quiet)
-				    fprintf(stderr, 
-					    _("Enabling bitrate management engine\n"));
-				  opt->managed = 1;
-				}
-				break;
-			case 'q':
-				if(sscanf(optarg, "%f", &opt->quality) != 1) {
-					fprintf(stderr, _("Quality option \"%s\" not recognised, ignoring\n"), optarg);
-					break;
-				}
-				opt->quality_set=1;
-				opt->quality *= 0.1;
-				if(opt->quality > 1.0f)
-				{
-					opt->quality = 1.0f;
-					fprintf(stderr, _("WARNING: quality setting too high, setting to maximum quality.\n"));
-				}
-				break;
-			case 'n':
-				if(opt->namefmt)
-				{
-					fprintf(stderr, _("WARNING: Multiple name formats specified, using final\n"));
-					free(opt->namefmt);
-				}
-				opt->namefmt = strdup(optarg);
-				break;
+                break;
+            case 'm':
+                if(sscanf(optarg, "%d", &opt->min_bitrate)
+                        != 1) {
+                    fprintf(stderr, _("Warning: minimum bitrate \"%s\" not recognised\n"), optarg);
+                    opt->min_bitrate = -1;
+                }
+                if(!opt->managed){
+                  if(!opt->quiet)
+                    fprintf(stderr, 
+                        _("Enabling bitrate management engine\n"));
+                  opt->managed = 1;
+                }
+                break;
+            case 'M':
+                if(sscanf(optarg, "%d", &opt->max_bitrate)
+                        != 1) {
+                    fprintf(stderr, _("Warning: maximum bitrate \"%s\" not recognised\n"), optarg);
+                    opt->max_bitrate = -1;
+                }
+                if(!opt->managed){
+                  if(!opt->quiet)
+                    fprintf(stderr, 
+                        _("Enabling bitrate management engine\n"));
+                  opt->managed = 1;
+                }
+                break;
+            case 'q':
+                if(sscanf(optarg, "%f", &opt->quality) != 1) {
+                    fprintf(stderr, _("Quality option \"%s\" not recognised, ignoring\n"), optarg);
+                    break;
+                }
+                opt->quality_set=1;
+                opt->quality *= 0.1;
+                if(opt->quality > 1.0f)
+                {
+                    opt->quality = 1.0f;
+                    fprintf(stderr, _("WARNING: quality setting too high, setting to maximum quality.\n"));
+                }
+                break;
+            case 'n':
+                if(opt->namefmt)
+                {
+                    fprintf(stderr, _("WARNING: Multiple name formats specified, using final\n"));
+                    free(opt->namefmt);
+                }
+                opt->namefmt = strdup(optarg);
+                break;
             case 'X':
-				if(opt->namefmt_remove && opt->namefmt_remove != 
+                if(opt->namefmt_remove && opt->namefmt_remove != 
                         DEFAULT_NAMEFMT_REMOVE)
-				{
-					fprintf(stderr, _("WARNING: Multiple name format filters specified, using final\n"));
-					free(opt->namefmt_remove);
-				}
-				opt->namefmt_remove = strdup(optarg);
-				break;
+                {
+                    fprintf(stderr, _("WARNING: Multiple name format filters specified, using final\n"));
+                    free(opt->namefmt_remove);
+                }
+                opt->namefmt_remove = strdup(optarg);
+                break;
             case 'P':
-				if(opt->namefmt_replace && opt->namefmt_replace != 
+                if(opt->namefmt_replace && opt->namefmt_replace != 
                         DEFAULT_NAMEFMT_REPLACE)
                 {
-					fprintf(stderr, _("WARNING: Multiple name format filter replacements specified, using final\n"));
-					free(opt->namefmt_replace);
-				}
-				opt->namefmt_replace = strdup(optarg);
-				break;
-			case 'o':
-				if(opt->outfile)
-				{
-					fprintf(stderr, _("WARNING: Multiple output files specified, suggest using -n\n"));
-					free(opt->outfile);
-				}
-				opt->outfile = strdup(optarg);
-				break;
-			case 'Q':
-				opt->quiet = 1;
-				break;
-			case 'r':
-				opt->rawmode = 1;
-				break;
-			case 'v':
-				fprintf(stdout, VERSION_STRING);
-				exit(0);
-				break;
-			case 'B':
-				if (opt->rawmode != 1)
-				{
-					opt->rawmode = 1;
-					fprintf(stderr, _("WARNING: Raw bits/sample specified for non-raw data. Assuming input is raw.\n"));
-				}
-				if(sscanf(optarg, "%u", &opt->raw_samplesize) != 1)
-				{
-					opt->raw_samplesize = 16; /* Failed, so just set to 16 */
-					fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n"));
-				}
-				if((opt->raw_samplesize != 8) && (opt->raw_samplesize != 16))
-				{
-					fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n"));
-				}
-				break;
-			case 'C':
-				if (opt->rawmode != 1)
-				{
-					opt->rawmode = 1;
-					fprintf(stderr, _("WARNING: Raw channel count specified for non-raw data. Assuming input is raw.\n"));
-				}
-				if(sscanf(optarg, "%u", &opt->raw_channels) != 1)
-				{
-					opt->raw_channels = 2; /* Failed, so just set to 2 */
-					fprintf(stderr, _("WARNING: Invalid channel count specified, assuming 2.\n"));
-				}
-				break;
-			case 'N':
-				opt->tracknum = realloc(opt->tracknum, (++opt->track_count)*sizeof(char *));
-				opt->tracknum[opt->track_count - 1] = strdup(optarg);
-				break;
-			case 'R':
-				if (opt->rawmode != 1)
-				{
-					opt->rawmode = 1;
-					fprintf(stderr, _("WARNING: Raw sample rate specified for non-raw data. Assuming input is raw.\n"));
-				}
-				if(sscanf(optarg, "%u", &opt->raw_samplerate) != 1)
-				{
-					opt->raw_samplerate = 44100; /* Failed, so just set to 44100 */
-					fprintf(stderr, _("WARNING: Invalid sample rate specified, assuming 44100.\n"));
-				}
-				break;
-			case '?':
-				fprintf(stderr, _("WARNING: Unknown option specified, ignoring->\n"));
-				break;
-			default:
-				usage();
-				exit(0);
-		}
-	}
+                    fprintf(stderr, _("WARNING: Multiple name format filter replacements specified, using final\n"));
+                    free(opt->namefmt_replace);
+                }
+                opt->namefmt_replace = strdup(optarg);
+                break;
+            case 'o':
+                if(opt->outfile)
+                {
+                    fprintf(stderr, _("WARNING: Multiple output files specified, suggest using -n\n"));
+                    free(opt->outfile);
+                }
+                opt->outfile = strdup(optarg);
+                break;
+            case 'Q':
+                opt->quiet = 1;
+                break;
+            case 'r':
+                opt->rawmode = 1;
+                break;
+            case 'v':
+                fprintf(stdout, VERSION_STRING);
+                exit(0);
+                break;
+            case 'B':
+                if (opt->rawmode != 1)
+                {
+                    opt->rawmode = 1;
+                    fprintf(stderr, _("WARNING: Raw bits/sample specified for non-raw data. Assuming input is raw.\n"));
+                }
+                if(sscanf(optarg, "%u", &opt->raw_samplesize) != 1)
+                {
+                    opt->raw_samplesize = 16; /* Failed, so just set to 16 */
+                    fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n"));
+                }
+                if((opt->raw_samplesize != 8) && (opt->raw_samplesize != 16))
+                {
+                    fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n"));
+                }
+                break;
+            case 'C':
+                if (opt->rawmode != 1)
+                {
+                    opt->rawmode = 1;
+                    fprintf(stderr, _("WARNING: Raw channel count specified for non-raw data. Assuming input is raw.\n"));
+                }
+                if(sscanf(optarg, "%u", &opt->raw_channels) != 1)
+                {
+                    opt->raw_channels = 2; /* Failed, so just set to 2 */
+                    fprintf(stderr, _("WARNING: Invalid channel count specified, assuming 2.\n"));
+                }
+                break;
+            case 'N':
+                opt->tracknum = realloc(opt->tracknum, (++opt->track_count)*sizeof(char *));
+                opt->tracknum[opt->track_count - 1] = strdup(optarg);
+                break;
+            case 'R':
+                if (opt->rawmode != 1)
+                {
+                    opt->rawmode = 1;
+                    fprintf(stderr, _("WARNING: Raw sample rate specified for non-raw data. Assuming input is raw.\n"));
+                }
+                if(sscanf(optarg, "%u", &opt->raw_samplerate) != 1)
+                {
+                    opt->raw_samplerate = 44100; /* Failed, so just set to 44100 */
+                    fprintf(stderr, _("WARNING: Invalid sample rate specified, assuming 44100.\n"));
+                }
+                break;
+            case '?':
+                fprintf(stderr, _("WARNING: Unknown option specified, ignoring->\n"));
+                break;
+            default:
+                usage();
+                exit(0);
+        }
+    }
 
 }
 
 static void add_tag(vorbis_comment *vc, oe_options *opt,char *name, char *value)
 {
-	char *utf8;
-	if(utf8_encode(value, &utf8) >= 0)
-	{
-		if(name == NULL)
-			vorbis_comment_add(vc, utf8);
-		else
-			vorbis_comment_add_tag(vc, name, utf8);
-		free(utf8);
-	}
-	else
-		fprintf(stderr, _("Couldn't convert comment to UTF-8, cannot add\n"));
+    char *utf8;
+    if(utf8_encode(value, &utf8) >= 0)
+    {
+        if(name == NULL)
+            vorbis_comment_add(vc, utf8);
+        else
+            vorbis_comment_add_tag(vc, name, utf8);
+        free(utf8);
+    }
+    else
+        fprintf(stderr, _("Couldn't convert comment to UTF-8, cannot add\n"));
 }
 
 static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum, 
-		char **artist, char **album, char **title, char **tracknum, 
+        char **artist, char **album, char **title, char **tracknum, 
         char **date, char **genre)
 {
-	int i;
+    int i;
 
-	vorbis_comment_init(vc);
+    vorbis_comment_init(vc);
 
-	for(i = 0; i < opt->comment_count; i++)
-		add_tag(vc, opt, NULL, opt->comments[i]);
+    for(i = 0; i < opt->comment_count; i++)
+        add_tag(vc, opt, NULL, opt->comments[i]);
 
-	if(opt->title_count)
-	{
-		if(filenum >= opt->title_count)
-		{
-			if(!opt->quiet)
-				fprintf(stderr, _("WARNING: Insufficient titles specified, defaulting to final title.\n"));
-			i = opt->title_count-1;
-		}
-		else
-			i = filenum;
+    if(opt->title_count)
+    {
+        if(filenum >= opt->title_count)
+        {
+            if(!opt->quiet)
+                fprintf(stderr, _("WARNING: Insufficient titles specified, defaulting to final title.\n"));
+            i = opt->title_count-1;
+        }
+        else
+            i = filenum;
 
-		*title = opt->title[i];
-		add_tag(vc, opt, "title", opt->title[i]);
-	}
+        *title = opt->title[i];
+        add_tag(vc, opt, "title", opt->title[i]);
+    }
 
-	if(opt->artist_count)
-	{
-		if(filenum >= opt->artist_count)
-			i = opt->artist_count-1;
-		else
-			i = filenum;
-	
-		*artist = opt->artist[i];
-		add_tag(vc, opt, "artist", opt->artist[i]);
-	}
+    if(opt->artist_count)
+    {
+        if(filenum >= opt->artist_count)
+            i = opt->artist_count-1;
+        else
+            i = filenum;
+    
+        *artist = opt->artist[i];
+        add_tag(vc, opt, "artist", opt->artist[i]);
+    }
 
     if(opt->genre_count)
     {
@@ -915,35 +915,35 @@
         add_tag(vc, opt, "genre", opt->genre[i]);
     }
 
-	if(opt->date_count)
-	{
-		if(filenum >= opt->date_count)
-			i = opt->date_count-1;
-		else
-			i = filenum;
-	
-		*date = opt->dates[i];
-		add_tag(vc, opt, "date", opt->dates[i]);
-	}
-	
-	if(opt->album_count)
-	{
-		if(filenum >= opt->album_count)
-		{
-			i = opt->album_count-1;
-		}
-		else
-			i = filenum;
+    if(opt->date_count)
+    {
+        if(filenum >= opt->date_count)
+            i = opt->date_count-1;
+        else
+            i = filenum;
+    
+        *date = opt->dates[i];
+        add_tag(vc, opt, "date", opt->dates[i]);
+    }
+    
+    if(opt->album_count)
+    {
+        if(filenum >= opt->album_count)
+        {
+            i = opt->album_count-1;
+        }
+        else
+            i = filenum;
 
-		*album = opt->album[i];	
-		add_tag(vc, opt, "album", opt->album[i]);
-	}
+        *album = opt->album[i];    
+        add_tag(vc, opt, "album", opt->album[i]);
+    }
 
-	if(filenum < opt->track_count)
-	{
-		i = filenum;
-		*tracknum = opt->tracknum[i];
-		add_tag(vc, opt, "tracknumber", opt->tracknum[i]);
-	}
+    if(filenum < opt->track_count)
+    {
+        i = filenum;
+        *tracknum = opt->tracknum[i];
+        add_tag(vc, opt, "tracknumber", opt->tracknum[i]);
+    }
 }
 

Modified: trunk/vorbis-tools/oggenc/platform.c
===================================================================
--- trunk/vorbis-tools/oggenc/platform.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/platform.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -27,21 +27,21 @@
 
 void setbinmode(FILE *f)
 {
-	_setmode( _fileno(f), _O_BINARY );
+    _setmode( _fileno(f), _O_BINARY );
 }
 #endif /* win32 */
 
 #ifdef __EMX__
 void setbinmode(FILE *f) 
 {
-	        _fsetmode( f, "b");
+            _fsetmode( f, "b");
 }
 #endif
 
 #if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)
 void setbinmode(FILE *f)
 {
-	setmode(fileno(f), O_BINARY);
+    setmode(fileno(f), O_BINARY);
 }
 #endif
 
@@ -49,18 +49,18 @@
 #if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__)
 void *timer_start(void)
 {
-	time_t *start = malloc(sizeof(time_t));
-	time(start);
-	return (void *)start;
+    time_t *start = malloc(sizeof(time_t));
+    time(start);
+    return (void *)start;
 }
 
 double timer_time(void *timer)
 {
-	time_t now = time(NULL);
-	time_t start = *((time_t *)timer);
+    time_t now = time(NULL);
+    time_t start = *((time_t *)timer);
 
     if(now-start)
-    	return (double)(now-start);
+        return (double)(now-start);
     else
         return 1; /* To avoid division by zero later, for very short inputs */
 }
@@ -68,7 +68,7 @@
 
 void timer_clear(void *timer)
 {
-	free((time_t *)timer);
+    free((time_t *)timer);
 }
 
 #else /* unix. Or at least win32 */
@@ -78,25 +78,25 @@
 
 void *timer_start(void)
 {
-	struct timeval *start = malloc(sizeof(struct timeval));
-	gettimeofday(start, NULL);
-	return (void *)start;
+    struct timeval *start = malloc(sizeof(struct timeval));
+    gettimeofday(start, NULL);
+    return (void *)start;
 }
 
 double timer_time(void *timer)
 {
-	struct timeval now;
-	struct timeval start = *((struct timeval *)timer);
+    struct timeval now;
+    struct timeval start = *((struct timeval *)timer);
 
-	gettimeofday(&now, NULL);
+    gettimeofday(&now, NULL);
 
-	return (double)now.tv_sec - (double)start.tv_sec + 
-		((double)now.tv_usec - (double)start.tv_usec)/1000000.0;
+    return (double)now.tv_sec - (double)start.tv_sec + 
+        ((double)now.tv_usec - (double)start.tv_usec)/1000000.0;
 }
 
 void timer_clear(void *timer)
 {
-	free((time_t *)timer);
+    free((time_t *)timer);
 }
 
 #endif

Modified: trunk/vorbis-tools/oggenc/resample.c
===================================================================
--- trunk/vorbis-tools/oggenc/resample.c	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/resample.c	2006-06-29 11:00:57 UTC (rev 11665)
@@ -15,427 +15,427 @@
 
 static int hcf(int arg1, int arg2)
 {
-	int mult = 1;
+    int mult = 1;
 
-	while (~(arg1 | arg2) & 1)
-		arg1 >>= 1, arg2 >>= 1, mult <<= 1;
+    while (~(arg1 | arg2) & 1)
+        arg1 >>= 1, arg2 >>= 1, mult <<= 1;
 
-	while (arg1 > 0)
-	{
-		if (~(arg1 & arg2) & 1)
-		{
-			arg1 >>= (~arg1 & 1);
-			arg2 >>= (~arg2 & 1);
-		}
-		else if (arg1 < arg2)
-			arg2 = (arg2 - arg1) >> 1;
-		else
-			arg1 = (arg1 - arg2) >> 1;
-	}
+    while (arg1 > 0)
+    {
+        if (~(arg1 & arg2) & 1)
+        {
+            arg1 >>= (~arg1 & 1);
+            arg2 >>= (~arg2 & 1);
+        }
+        else if (arg1 < arg2)
+            arg2 = (arg2 - arg1) >> 1;
+        else
+            arg1 = (arg1 - arg2) >> 1;
+    }
 
-	return arg2 * mult;
+    return arg2 * mult;
 }
 
 
 static void filt_sinc(float *dest, int N, int step, double fc, double gain, int width)
 {
-	double s = fc / step;
-	int mid, x;
-	float *endpoint = dest + N,
-		*base = dest,
-		*origdest = dest;
-	
-	assert(width <= N);
+    double s = fc / step;
+    int mid, x;
+    float *endpoint = dest + N,
+        *base = dest,
+        *origdest = dest;
+    
+    assert(width <= N);
 
-	if ((N & 1) == 0)
-	{
-		*dest = 0.0;
-		dest += width;
-		if (dest >= endpoint)
-			dest = ++base;
-		N--;
-	}
+    if ((N & 1) == 0)
+    {
+        *dest = 0.0;
+        dest += width;
+        if (dest >= endpoint)
+            dest = ++base;
+        N--;
+    }
 
-	mid = N / 2;
-	x = -mid;
+    mid = N / 2;
+    x = -mid;
 
-	while (N--)
-	{
-		*dest = (x ? sin(x * M_PI * s) / (x * M_PI) * step : fc) * gain;
-		x++;
-		dest += width;
-		if (dest >= endpoint)
-			dest = ++base;
-	}
-	assert(dest == origdest + width);
+    while (N--)
+    {
+        *dest = (x ? sin(x * M_PI * s) / (x * M_PI) * step : fc) * gain;
+        x++;
+        dest += width;
+        if (dest >= endpoint)
+            dest = ++base;
+    }
+    assert(dest == origdest + width);
 }
 
 
 static double I_zero(double x)
 {
-	int n = 0;
-	double u = 1.0,
-		s = 1.0,
-		t;
+    int n = 0;
+    double u = 1.0,
+        s = 1.0,
+        t;
 
-	do
-	{
-		n += 2;
-		t = x / n;
-		u *= t * t;
-		s += u;
-	} while (u > 1e-21 * s);
+    do
+    {
+        n += 2;
+        t = x / n;
+        u *= t * t;
+        s += u;
+    } while (u > 1e-21 * s);
 
-	return s;
+    return s;
 }
 
 
 static void win_kaiser(float *dest, int N, double alpha, int width)
 {
-	double I_alpha, midsq;
-	int x;
-	float *endpoint = dest + N,
-		*base = dest,
-		*origdest = dest;
+    double I_alpha, midsq;
+    int x;
+    float *endpoint = dest + N,
+        *base = dest,
+        *origdest = dest;
 
-	assert(width <= N);
+    assert(width <= N);
 
-	if ((N & 1) == 0)
-	{
-		*dest = 0.0;
-		dest += width;
-		if (dest >= endpoint)
-			dest = ++base;
-		N--;
-	}
+    if ((N & 1) == 0)
+    {
+        *dest = 0.0;
+        dest += width;
+        if (dest >= endpoint)
+            dest = ++base;
+        N--;
+    }
 
-	x = -(N / 2);
-	midsq = (double)(x - 1) * (double)(x - 1);
-	I_alpha = I_zero(alpha);
+    x = -(N / 2);
+    midsq = (double)(x - 1) * (double)(x - 1);
+    I_alpha = I_zero(alpha);
 
-	while (N--)
-	{
-		*dest *= I_zero(alpha * sqrt(1.0 - ((double)x * (double)x) / midsq)) / I_alpha;
-		x++;
-		dest += width;
-		if (dest >= endpoint)
-			dest = ++base;
-	}
-	assert(dest == origdest + width);
+    while (N--)
+    {
+        *dest *= I_zero(alpha * sqrt(1.0 - ((double)x * (double)x) / midsq)) / I_alpha;
+        x++;
+        dest += width;
+        if (dest >= endpoint)
+            dest = ++base;
+    }
+    assert(dest == origdest + width);
 }
 
 
 int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...)
 {
-	double beta = 16.0,
-		cutoff = 0.80,
-		gain = 1.0;
-	int taps = 45;
+    double beta = 16.0,
+        cutoff = 0.80,
+        gain = 1.0;
+    int taps = 45;
 
-	int factor;
+    int factor;
 
-	assert(state);
-	assert(channels > 0);
-	assert(outfreq > 0);
-	assert(infreq > 0);
-	assert(taps > 0);
+    assert(state);
+    assert(channels > 0);
+    assert(outfreq > 0);
+    assert(infreq > 0);
+    assert(taps > 0);
 
-	if (state == NULL || channels <= 0 || outfreq <= 0 || infreq <= 0 || taps <= 0)
-		return -1;
+    if (state == NULL || channels <= 0 || outfreq <= 0 || infreq <= 0 || taps <= 0)
+        return -1;
 
-	if (op1 != RES_END)
-	{
-		va_list argp;
-		va_start(argp, op1);
-		do
-		{
-			switch (op1)
-			{
-			case RES_GAIN:
-				gain = va_arg(argp, double);
-				break;
+    if (op1 != RES_END)
+    {
+        va_list argp;
+        va_start(argp, op1);
+        do
+        {
+            switch (op1)
+            {
+            case RES_GAIN:
+                gain = va_arg(argp, double);
+                break;
 
-			case RES_CUTOFF:
-				cutoff = va_arg(argp, double);
-				assert(cutoff > 0.01 && cutoff <= 1.0);
-				break;
+            case RES_CUTOFF:
+                cutoff = va_arg(argp, double);
+                assert(cutoff > 0.01 && cutoff <= 1.0);
+                break;
 
-			case RES_TAPS:
-				taps = va_arg(argp, int);
-				assert(taps > 2 && taps < 1000);
-				break;
-				
-			case RES_BETA:
-				beta = va_arg(argp, double);
-				assert(beta > 2.0);
-				break;
-			default:
-				assert("arglist" == "valid");
-				return -1;
-			}
-			op1 = va_arg(argp, res_parameter);
-		} while (op1 != RES_END);
-		va_end(argp);
-	}
+            case RES_TAPS:
+                taps = va_arg(argp, int);
+                assert(taps > 2 && taps < 1000);
+                break;
+                
+            case RES_BETA:
+                beta = va_arg(argp, double);
+                assert(beta > 2.0);
+                break;
+            default:
+                assert("arglist" == "valid");
+                return -1;
+            }
+            op1 = va_arg(argp, res_parameter);
+        } while (op1 != RES_END);
+        va_end(argp);
+    }
 
-	factor = hcf(infreq, outfreq);
-	outfreq /= factor;
-	infreq /= factor;
+    factor = hcf(infreq, outfreq);
+    outfreq /= factor;
+    infreq /= factor;
 
-	/* adjust to rational values for downsampling */
-	if (outfreq < infreq)
-	{
-		/* push the cutoff frequency down to the output frequency */
-		cutoff = cutoff * outfreq / infreq; 
+    /* adjust to rational values for downsampling */
+    if (outfreq < infreq)
+    {
+        /* push the cutoff frequency down to the output frequency */
+        cutoff = cutoff * outfreq / infreq; 
 
         /* compensate for the sharper roll-off requirement
          * by using a bigger hammer */
         taps = taps * infreq/outfreq;
-	}
+    }
 
-	assert(taps >= (infreq + outfreq - 1) / outfreq);
+    assert(taps >= (infreq + outfreq - 1) / outfreq);
 
-	if ((state->table = calloc(outfreq * taps, sizeof(float))) == NULL)
-		return -1;
-	if ((state->pool = calloc(channels * taps, sizeof(SAMPLE))) == NULL)
-	{
-		free(state->table);
-		state->table = NULL;
-		return -1;
-	}
+    if ((state->table = calloc(outfreq * taps, sizeof(float))) == NULL)
+        return -1;
+    if ((state->pool = calloc(channels * taps, sizeof(SAMPLE))) == NULL)
+    {
+        free(state->table);
+        state->table = NULL;
+        return -1;
+    }
 
-	state->poolfill = taps / 2 + 1;
-	state->channels = channels;
-	state->outfreq = outfreq;
-	state->infreq = infreq;
-	state->taps = taps;
-	state->offset = 0;
+    state->poolfill = taps / 2 + 1;
+    state->channels = channels;
+    state->outfreq = outfreq;
+    state->infreq = infreq;
+    state->taps = taps;
+    state->offset = 0;
 
-	filt_sinc(state->table, outfreq * taps, outfreq, cutoff, gain, taps);
-	win_kaiser(state->table, outfreq * taps, beta, taps);
+    filt_sinc(state->table, outfreq * taps, outfreq, cutoff, gain, taps);
+    win_kaiser(state->table, outfreq * taps, beta, taps);
 
-	return 0;
+    return 0;
 }
 
 
 static SAMPLE sum(float const *scale, int count, SAMPLE const *source, SAMPLE const *trigger, SAMPLE const *reset, int srcstep)
 {
-	float total = 0.0;
+    float total = 0.0;
 
-	while (count--)
-	{
-		total += *source * *scale;
+    while (count--)
+    {
+        total += *source * *scale;
 
-		if (source == trigger)
-			source = reset, srcstep = 1;
-		source -= srcstep;
-		scale++;
-	}
+        if (source == trigger)
+            source = reset, srcstep = 1;
+        source -= srcstep;
+        scale++;
+    }
 
-	return total;
+    return total;
 }
 
 
 static int push(res_state const * const state, SAMPLE *pool, int * const poolfill, int * const offset, SAMPLE *dest, int dststep, SAMPLE const *source, int srcstep, size_t srclen)
 {
-	SAMPLE	* const destbase = dest,
-		*poolhead = pool + *poolfill,
-		*poolend = pool + state->taps,
-		*newpool = pool;
-	SAMPLE const *refill, *base, *endpoint;
-	int	lencheck;
+    SAMPLE    * const destbase = dest,
+        *poolhead = pool + *poolfill,
+        *poolend = pool + state->taps,
+        *newpool = pool;
+    SAMPLE const *refill, *base, *endpoint;
+    int    lencheck;
 
 
-	assert(state);
-	assert(pool);
-	assert(poolfill);
-	assert(dest);
-	assert(source);
+    assert(state);
+    assert(pool);
+    assert(poolfill);
+    assert(dest);
+    assert(source);
 
-	assert(state->poolfill != -1);
-	
-	lencheck = res_push_check(state, srclen);
+    assert(state->poolfill != -1);
+    
+    lencheck = res_push_check(state, srclen);
 
-	/* fill the pool before diving in */
-	while (poolhead < poolend && srclen > 0)
-	{
-		*poolhead++ = *source;
-		source += srcstep;
-		srclen--;
-	}
+    /* fill the pool before diving in */
+    while (poolhead < poolend && srclen > 0)
+    {
+        *poolhead++ = *source;
+        source += srcstep;
+        srclen--;
+    }
 
-	if (srclen <= 0)
-		return 0;
+    if (srclen <= 0)
+        return 0;
 
-	base = source;
-	endpoint = source + srclen * srcstep;
+    base = source;
+    endpoint = source + srclen * srcstep;
 
-	while (source < endpoint)
-	{
-		*dest = sum(state->table + *offset * state->taps, state->taps, source, base, poolend, srcstep);
-		dest += dststep;
-		*offset += state->infreq;
-		while (*offset >= state->outfreq)
-		{
-			*offset -= state->outfreq;
-			source += srcstep;
-		}
-	}
+    while (source < endpoint)
+    {
+        *dest = sum(state->table + *offset * state->taps, state->taps, source, base, poolend, srcstep);
+        dest += dststep;
+        *offset += state->infreq;
+        while (*offset >= state->outfreq)
+        {
+            *offset -= state->outfreq;
+            source += srcstep;
+        }
+    }
 
-	assert(dest == destbase + lencheck * dststep);
+    assert(dest == destbase + lencheck * dststep);
 
-	/* pretend that source has that underrun data we're not going to get */
-	srclen += (source - endpoint) / srcstep;
+    /* pretend that source has that underrun data we're not going to get */
+    srclen += (source - endpoint) / srcstep;
 
-	/* if we didn't get enough to completely replace the pool, then shift things about a bit */
-	if (srclen < state->taps)
-	{
-		refill = pool + srclen;
-		while (refill < poolend)
-			*newpool++ = *refill++;
+    /* if we didn't get enough to completely replace the pool, then shift things about a bit */
+    if (srclen < state->taps)
+    {
+        refill = pool + srclen;
+        while (refill < poolend)
+            *newpool++ = *refill++;
 
-		refill = source - srclen * srcstep;
-	}
-	else
-		refill = source - state->taps * srcstep;
+        refill = source - srclen * srcstep;
+    }
+    else
+        refill = source - state->taps * srcstep;
 
-	/* pull in fresh pool data */
-	while (refill < endpoint)
-	{
-		*newpool++ = *refill;
-		refill += srcstep;
-	}
+    /* pull in fresh pool data */
+    while (refill < endpoint)
+    {
+        *newpool++ = *refill;
+        refill += srcstep;
+    }
 
-	assert(newpool > pool);
-	assert(newpool <= poolend);
+    assert(newpool > pool);
+    assert(newpool <= poolend);
 
-	*poolfill = newpool - pool;
+    *poolfill = newpool - pool;
 
-	return (dest - destbase) / dststep;
+    return (dest - destbase) / dststep;
 }
 
 
 int res_push_max_input(res_state const * const state, size_t maxoutput)
 {
-	return maxoutput * state->infreq / state->outfreq;
+    return maxoutput * state->infreq / state->outfreq;
 }
 
 
 int res_push_check(res_state const * const state, size_t srclen)
 {
-	if (state->poolfill < state->taps)
-		srclen -= state->taps - state->poolfill;
+    if (state->poolfill < state->taps)
+        srclen -= state->taps - state->poolfill;
 
-	return (srclen * state->outfreq - state->offset + state->infreq - 1) / state->infreq;
+    return (srclen * state->outfreq - state->offset + state->infreq - 1) / state->infreq;
 }
 
 
 int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen)
 {
-	int result = -1, poolfill = -1, offset = -1, i;
+    int result = -1, poolfill = -1, offset = -1, i;
 
-	assert(state);
-	assert(dstlist);
-	assert(srclist);
-	assert(state->poolfill >= 0);
+    assert(state);
+    assert(dstlist);
+    assert(srclist);
+    assert(state->poolfill >= 0);
 
-	for (i = 0; i < state->channels; i++)
-	{
-		poolfill = state->poolfill;
-		offset = state->offset;
-		result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, srclist[i], 1, srclen);
-	}
-	state->poolfill = poolfill;
-	state->offset = offset;
+    for (i = 0; i < state->channels; i++)
+    {
+        poolfill = state->poolfill;
+        offset = state->offset;
+        result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, srclist[i], 1, srclen);
+    }
+    state->poolfill = poolfill;
+    state->offset = offset;
 
-	return result;
+    return result;
 }
 
 
 int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen)
 {
-	int result = -1, poolfill = -1, offset = -1, i;
-	
-	assert(state);
-	assert(dest);
-	assert(source);
-	assert(state->poolfill >= 0);
+    int result = -1, poolfill = -1, offset = -1, i;
+    
+    assert(state);
+    assert(dest);
+    assert(source);
+    assert(state->poolfill >= 0);
 
-	for (i = 0; i < state->channels; i++)
-	{
-		poolfill = state->poolfill;
-		offset = state->offset;
-		result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, source + i, state->channels, srclen);
-	}
-	state->poolfill = poolfill;
-	state->offset = offset;
+    for (i = 0; i < state->channels; i++)
+    {
+        poolfill = state->poolfill;
+        offset = state->offset;
+        result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, source + i, state->channels, srclen);
+    }
+    state->poolfill = poolfill;
+    state->offset = offset;
 
-	return result;
+    return result;
 }
 
 
 int res_drain(res_state *state, SAMPLE **dstlist)
 {
-	SAMPLE *tail;
-	int result = -1, poolfill = -1, offset = -1, i;
+    SAMPLE *tail;
+    int result = -1, poolfill = -1, offset = -1, i;
 
-	assert(state);
-	assert(dstlist);
-	assert(state->poolfill >= 0);
+    assert(state);
+    assert(dstlist);
+    assert(state->poolfill >= 0);
 
-	if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL)
-		return -1;
+    if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL)
+        return -1;
 
-	for (i = 0; i < state->channels; i++)
-	{
-		poolfill = state->poolfill;
-		offset = state->offset;
-		result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, tail, 1, state->taps / 2 - 1);
-	}
-		
-	free(tail);
+    for (i = 0; i < state->channels; i++)
+    {
+        poolfill = state->poolfill;
+        offset = state->offset;
+        result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, tail, 1, state->taps / 2 - 1);
+    }
+        
+    free(tail);
 
-	state->poolfill = -1;
+    state->poolfill = -1;
 
-	return result;
+    return result;
 }
 
 
 int res_drain_interleaved(res_state *state, SAMPLE *dest)
 {
-	SAMPLE *tail;
-	int result = -1, poolfill = -1, offset = -1, i;
+    SAMPLE *tail;
+    int result = -1, poolfill = -1, offset = -1, i;
 
-	assert(state);
-	assert(dest);
-	assert(state->poolfill >= 0);
+    assert(state);
+    assert(dest);
+    assert(state->poolfill >= 0);
 
-	if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL)
-		return -1;
+    if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL)
+        return -1;
 
-	for (i = 0; i < state->channels; i++)
-	{
-		poolfill = state->poolfill;
-		offset = state->offset;
-		result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, tail, 1, state->taps / 2 - 1);
-	}
-		
-	free(tail);
+    for (i = 0; i < state->channels; i++)
+    {
+        poolfill = state->poolfill;
+        offset = state->offset;
+        result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, tail, 1, state->taps / 2 - 1);
+    }
+        
+    free(tail);
 
-	state->poolfill = -1;
+    state->poolfill = -1;
 
-	return result;
+    return result;
 }
 
 
 void res_clear(res_state *state)
 {
-	assert(state);
-	assert(state->table);
-	assert(state->pool);
+    assert(state);
+    assert(state->table);
+    assert(state->pool);
 
-	free(state->table);
-	free(state->pool);
-	memset(state, 0, sizeof(*state));
+    free(state->table);
+    free(state->pool);
+    memset(state, 0, sizeof(*state));
 }
 

Modified: trunk/vorbis-tools/oggenc/resample.h
===================================================================
--- trunk/vorbis-tools/oggenc/resample.h	2006-06-28 16:23:12 UTC (rev 11664)
+++ trunk/vorbis-tools/oggenc/resample.h	2006-06-29 11:00:57 UTC (rev 11665)
@@ -7,14 +7,14 @@
  * A resampler
  *
  * reference:
- * 	'Digital Filters', third edition, by R. W. Hamming  ISBN 0-486-65088-X
+ *     'Digital Filters', third edition, by R. W. Hamming  ISBN 0-486-65088-X
  *
  * history:
- *	2002-05-31	ready for the world (or some small section thereof)
+ *    2002-05-31    ready for the world (or some small section thereof)
  *
  *
  * TOOD:
- * 	zero-crossing clipping in coefficient table
+ *     zero-crossing clipping in coefficient table
  */
 
 #ifndef _RESAMPLE_H_INCLUDED
@@ -24,22 +24,22 @@
 
 typedef struct
 {
-	unsigned int channels, infreq, outfreq, taps;
-	float *table;
-	SAMPLE *pool;
+    unsigned int channels, infreq, outfreq, taps;
+    float *table;
+    SAMPLE *pool;
 
-	/* dynamic bits */
-	int poolfill;
-	int offset;
+    /* dynamic bits */
+    int poolfill;
+    int offset;
 } res_state;
 
 typedef enum
 {
-	RES_END,
-	RES_GAIN,	/* (double)1.0 */
-	RES_CUTOFF,	/* (double)0.80 */ 
-	RES_TAPS,	/* (int)45 */
-	RES_BETA	/* (double)16.0 */
+    RES_END,
+    RES_GAIN,    /* (double)1.0 */
+    RES_CUTOFF,    /* (double)0.80 */ 
+    RES_TAPS,    /* (int)45 */
+    RES_BETA    /* (double)16.0 */
 } res_parameter;
 
 int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...);



More information about the commits mailing list