shithub: sox

Download patch

ref: 79ac68a959429941f41e35cc16c16ac0087cef03
parent: bfbd4adf5cb81d037eef717b6a199c554748bca4
author: robs <robs>
date: Sat Jun 2 15:01:26 EDT 2007

sox namespace cleanups

--- a/src/8svx.c
+++ b/src/8svx.c
@@ -20,13 +20,13 @@
         FILE *ch[4];
 }*svx_t;
 
-static void svxwriteheader(ft_t, sox_size_t);
+static void svxwriteheader(sox_format_t *, sox_size_t);
 
 /*======================================================================*/
 /*                         8SVXSTARTREAD                                */
 /*======================================================================*/
 
-static int sox_svxstartread(ft_t ft)
+static int sox_svxstartread(sox_format_t * ft)
 {
         svx_t p = (svx_t ) ft->priv;
 
@@ -193,7 +193,7 @@
 /*======================================================================*/
 /*                         8SVXREAD                                     */
 /*======================================================================*/
-static sox_size_t sox_svxread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp)
+static sox_size_t sox_svxread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp)
 {
         unsigned char datum;
         size_t done = 0, i;
@@ -217,7 +217,7 @@
 /*======================================================================*/
 /*                         8SVXSTOPREAD                                 */
 /*======================================================================*/
-static int sox_svxstopread(ft_t ft)
+static int sox_svxstopread(sox_format_t * ft)
 {
         size_t i;
 
@@ -233,7 +233,7 @@
 /*======================================================================*/
 /*                         8SVXSTARTWRITE                               */
 /*======================================================================*/
-static int sox_svxstartwrite(ft_t ft)
+static int sox_svxstartwrite(sox_format_t * ft)
 {
         svx_t p = (svx_t ) ft->priv;
         size_t i;
@@ -261,7 +261,7 @@
 /*                         8SVXWRITE                                    */
 /*======================================================================*/
 
-static sox_size_t sox_svxwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_svxwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
         svx_t p = (svx_t ) ft->priv;
 
@@ -285,7 +285,7 @@
 /*                         8SVXSTOPWRITE                                */
 /*======================================================================*/
 
-static int sox_svxstopwrite(ft_t ft)
+static int sox_svxstopwrite(sox_format_t * ft)
 {
         svx_t p = (svx_t ) ft->priv;
 
@@ -325,7 +325,7 @@
 /*                         8SVXWRITEHEADER                              */
 /*======================================================================*/
 #define SVXHEADERSIZE 100
-static void svxwriteheader(ft_t ft, sox_size_t nsamples)
+static void svxwriteheader(sox_format_t * ft, sox_size_t nsamples)
 {
         sox_size_t formsize =  nsamples + SVXHEADERSIZE - 8;
 
@@ -365,7 +365,7 @@
   NULL
 };
 
-static sox_format_t sox_svx_format = {
+static sox_format_handler_t sox_svx_format = {
   svxnames,
   SOX_FILE_BIG_END,
   sox_svxstartread,
@@ -377,9 +377,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_svx_format_fn(void);
+const sox_format_handler_t *sox_svx_format_fn(void);
 
-const sox_format_t *sox_svx_format_fn(void)
+const sox_format_handler_t *sox_svx_format_fn(void)
 {
     return &sox_svx_format;
 }
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -119,7 +119,7 @@
  *                 rates but the codecs allows any user specified rate.
  ******************************************************************************/
 
-static int adpcm_start(ft_t ft, adpcm_io_t state, sox_encoding_t type)
+static int adpcm_start(sox_format_t * ft, adpcm_io_t state, sox_encoding_t type)
 {
   /* setup file info */
   state->file.buf = (char *) xmalloc(sox_bufsiz);
@@ -131,12 +131,12 @@
   return sox_rawstart(ft, sox_true, sox_false, type, SOX_SIZE_16BIT);
 }
 
-int sox_adpcm_oki_start(ft_t ft, adpcm_io_t state)
+int sox_adpcm_oki_start(sox_format_t * ft, adpcm_io_t state)
 {
   return adpcm_start(ft, state, SOX_ENCODING_OKI_ADPCM);
 }
 
-int sox_adpcm_ima_start(ft_t ft, adpcm_io_t state)
+int sox_adpcm_ima_start(sox_format_t * ft, adpcm_io_t state)
 {
   return adpcm_start(ft, state, SOX_ENCODING_IMA_ADPCM);
 }
@@ -155,7 +155,7 @@
  * Notes      : 
  ******************************************************************************/
 
-sox_size_t sox_adpcm_read(ft_t ft, adpcm_io_t state, sox_ssample_t * buffer, sox_size_t len)
+sox_size_t sox_adpcm_read(sox_format_t * ft, adpcm_io_t state, sox_ssample_t * buffer, sox_size_t len)
 {
   sox_size_t n;
   uint8_t byte;
@@ -180,7 +180,7 @@
  * Notes      : 
  ******************************************************************************/
 
-int sox_adpcm_stopread(ft_t ft UNUSED, adpcm_io_t state)
+int sox_adpcm_stopread(sox_format_t * ft UNUSED, adpcm_io_t state)
 {
   free(state->file.buf);
 
@@ -202,7 +202,7 @@
  * Notes      : 
  ******************************************************************************/
 
-sox_size_t sox_adpcm_write(ft_t ft, adpcm_io_t state, const sox_ssample_t * buffer, sox_size_t length)
+sox_size_t sox_adpcm_write(sox_format_t * ft, adpcm_io_t state, const sox_ssample_t * buffer, sox_size_t length)
 {
   sox_size_t count = 0;
   uint8_t byte = state->store.byte;
@@ -248,7 +248,7 @@
  * Notes      : 1. Called directly for writing framed formats
  ******************************************************************************/
 
-void sox_adpcm_flush(ft_t ft, adpcm_io_t state)
+void sox_adpcm_flush(sox_format_t * ft, adpcm_io_t state)
 {
   uint8_t byte = state->store.byte;
   uint8_t flag = state->store.flag;
@@ -277,7 +277,7 @@
  * Notes      : 
  ******************************************************************************/
 
-int sox_adpcm_stopwrite(ft_t ft, adpcm_io_t state)
+int sox_adpcm_stopwrite(sox_format_t * ft, adpcm_io_t state)
 {
   sox_adpcm_flush(ft, state);
 
--- a/src/adpcms.h
+++ b/src/adpcms.h
@@ -36,10 +36,10 @@
 
 /* Format methods */
 void sox_adpcm_reset(adpcm_io_t state, sox_encoding_t type);
-int sox_adpcm_oki_start(ft_t ft, adpcm_io_t state);
-int sox_adpcm_ima_start(ft_t ft, adpcm_io_t state);
-sox_size_t sox_adpcm_read(ft_t ft, adpcm_io_t state, sox_ssample_t *buffer, sox_size_t len);
-int sox_adpcm_stopread(ft_t ft, adpcm_io_t state);
-sox_size_t sox_adpcm_write(ft_t ft, adpcm_io_t state, const sox_ssample_t *buffer, sox_size_t length);
-void sox_adpcm_flush(ft_t ft, adpcm_io_t state);
-int sox_adpcm_stopwrite(ft_t ft, adpcm_io_t state);
+int sox_adpcm_oki_start(sox_format_t * ft, adpcm_io_t state);
+int sox_adpcm_ima_start(sox_format_t * ft, adpcm_io_t state);
+sox_size_t sox_adpcm_read(sox_format_t * ft, adpcm_io_t state, sox_ssample_t *buffer, sox_size_t len);
+int sox_adpcm_stopread(sox_format_t * ft, adpcm_io_t state);
+sox_size_t sox_adpcm_write(sox_format_t * ft, adpcm_io_t state, const sox_ssample_t *buffer, sox_size_t length);
+void sox_adpcm_flush(sox_format_t * ft, adpcm_io_t state);
+int sox_adpcm_stopwrite(sox_format_t * ft, adpcm_io_t state);
--- a/src/aifc-fmt.c
+++ b/src/aifc-fmt.c
@@ -18,7 +18,7 @@
   NULL
 };
 
-static sox_format_t sox_aifc_format = {
+static sox_format_handler_t sox_aifc_format = {
   aifcnames,
   SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_aiffstartread,
@@ -30,9 +30,9 @@
   sox_aiffseek
 };
 
-const sox_format_t *sox_aifc_format_fn(void);
+const sox_format_handler_t *sox_aifc_format_fn(void);
 
-const sox_format_t *sox_aifc_format_fn(void)
+const sox_format_handler_t *sox_aifc_format_fn(void)
 {
     return &sox_aifc_format;
 }
--- a/src/aiff-fmt.c
+++ b/src/aiff-fmt.c
@@ -18,7 +18,7 @@
   NULL
 };
 
-static sox_format_t sox_aiff_format = {
+static sox_format_handler_t sox_aiff_format = {
   aiffnames,
   SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_aiffstartread,
@@ -30,9 +30,9 @@
   sox_aiffseek
 };
 
-const sox_format_t *sox_aiff_format_fn(void);
+const sox_format_handler_t *sox_aiff_format_fn(void);
 
-const sox_format_t *sox_aiff_format_fn(void)
+const sox_format_handler_t *sox_aiff_format_fn(void)
 {
     return &sox_aiff_format;
 }
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -30,15 +30,15 @@
 #endif
 
 /* forward declarations */
-static double read_ieee_extended(ft_t);
-static int aiffwriteheader(ft_t, sox_size_t);
-static int aifcwriteheader(ft_t, sox_size_t);
-static void write_ieee_extended(ft_t, double);
+static double read_ieee_extended(sox_format_t *);
+static int aiffwriteheader(sox_format_t *, sox_size_t);
+static int aifcwriteheader(sox_format_t *, sox_size_t);
+static void write_ieee_extended(sox_format_t *, double);
 static double ConvertFromIeeeExtended(unsigned char*);
 static void ConvertToIeeeExtended(double, char *);
-static int textChunk(char **text, char *chunkDescription, ft_t ft);
-static int commentChunk(char **text, char *chunkDescription, ft_t ft);
-static void reportInstrument(ft_t ft);
+static int textChunk(char **text, char *chunkDescription, sox_format_t * ft);
+static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft);
+static void reportInstrument(sox_format_t * ft);
 
 /* Private data used by writer */
 typedef struct aiffpriv {
@@ -47,7 +47,7 @@
     sox_size_t dataStart; /* need to for seeking */
 } *aiff_t;
 
-int sox_aiffseek(ft_t ft, sox_size_t offset) 
+int sox_aiffseek(sox_format_t * ft, sox_size_t offset) 
 {
     aiff_t aiff = (aiff_t ) ft->priv;
     sox_size_t new_offset, channel_block, alignment;
@@ -72,7 +72,7 @@
     return(ft->sox_errno);
 }
 
-int sox_aiffstartread(ft_t ft) 
+int sox_aiffstartread(sox_format_t * ft) 
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         char buf[5];
@@ -491,7 +491,7 @@
 }
 
 /* print out the MIDI key allocations, loop points, directions etc */
-static void reportInstrument(ft_t ft)
+static void reportInstrument(sox_format_t * ft)
 {
   unsigned loopNum;
 
@@ -517,7 +517,7 @@
 }
 
 /* Process a text chunk, allocate memory, display it if verbose and return */
-static int textChunk(char **text, char *chunkDescription, ft_t ft) 
+static int textChunk(char **text, char *chunkDescription, sox_format_t * ft) 
 {
   uint32_t chunksize;
   sox_readdw(ft, &chunksize);
@@ -546,7 +546,7 @@
 /* Comment lengths are words, not double words, and we can have several, so
    we use a special function, not textChunk().;
  */
-static int commentChunk(char **text, char *chunkDescription, ft_t ft)
+static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft)
 {
   uint32_t chunksize;
   unsigned short numComments;
@@ -604,7 +604,7 @@
   return(SOX_SUCCESS);
 }
 
-sox_size_t sox_aiffread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+sox_size_t sox_aiffread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         sox_ssize_t done;
@@ -618,7 +618,7 @@
         return done;
 }
 
-int sox_aiffstopread(ft_t ft) 
+int sox_aiffstopread(sox_format_t * ft) 
 {
         char buf[5];
         uint32_t chunksize;
@@ -661,7 +661,7 @@
    Strictly spoken this is not legal, but the playaiff utility
    will still be able to play the resulting file. */
 
-int sox_aiffstartwrite(ft_t ft)
+int sox_aiffstartwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         int rc;
@@ -691,7 +691,7 @@
         return(aiffwriteheader(ft, 0x7f000000 / (ft->signal.size*ft->signal.channels)));
 }
 
-sox_size_t sox_aiffwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+sox_size_t sox_aiffwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         aiff->nsamples += len;
@@ -699,7 +699,7 @@
         return(len);
 }
 
-int sox_aiffstopwrite(ft_t ft)
+int sox_aiffstopwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         int rc;
@@ -732,7 +732,7 @@
         return(aiffwriteheader(ft, aiff->nsamples / ft->signal.channels));
 }
 
-static int aiffwriteheader(ft_t ft, sox_size_t nframes)
+static int aiffwriteheader(sox_format_t * ft, sox_size_t nframes)
 {
         int hsize =
                 8 /*COMM hdr*/ + 18 /*COMM chunk*/ +
@@ -873,7 +873,7 @@
         return(SOX_SUCCESS);
 }
 
-int sox_aifcstartwrite(ft_t ft)
+int sox_aifcstartwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         int rc;
@@ -903,7 +903,7 @@
         return(aifcwriteheader(ft, 0x7f000000 / (ft->signal.size*ft->signal.channels)));
 }
 
-int sox_aifcstopwrite(ft_t ft)
+int sox_aifcstopwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
         int rc;
@@ -936,7 +936,7 @@
         return(aifcwriteheader(ft, aiff->nsamples / ft->signal.channels));
 }
 
-static int aifcwriteheader(ft_t ft, sox_size_t nframes)
+static int aifcwriteheader(sox_format_t * ft, sox_size_t nframes)
 {
         unsigned hsize =
                 12 /*FVER*/ + 8 /*COMM hdr*/ + 18+4+1+15 /*COMM chunk*/ +
@@ -995,7 +995,7 @@
         return(SOX_SUCCESS);
 }
 
-static double read_ieee_extended(ft_t ft)
+static double read_ieee_extended(sox_format_t * ft)
 {
         char buf[10];
         if (sox_readbuf(ft, buf, 10) != 10)
@@ -1006,7 +1006,7 @@
         return ConvertFromIeeeExtended((unsigned char *)buf);
 }
 
-static void write_ieee_extended(ft_t ft, double x)
+static void write_ieee_extended(sox_format_t * ft, double x)
 {
         char buf[10];
         ConvertToIeeeExtended(x, buf);
--- a/src/aiff.h
+++ b/src/aiff.h
@@ -15,12 +15,12 @@
  * the consequences of using this software.
  */
 
-int sox_aiffseek(ft_t ft, sox_size_t offset);
-int sox_aiffstartread(ft_t ft);
-sox_size_t sox_aiffread(ft_t ft, sox_ssample_t *buf, sox_size_t len);
-int sox_aiffstopread(ft_t ft);
-int sox_aiffstartwrite(ft_t ft);
-sox_size_t sox_aiffwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len);
-int sox_aiffstopwrite(ft_t ft);
-int sox_aifcstartwrite(ft_t ft);
-int sox_aifcstopwrite(ft_t ft);
+int sox_aiffseek(sox_format_t * ft, sox_size_t offset);
+int sox_aiffstartread(sox_format_t * ft);
+sox_size_t sox_aiffread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
+int sox_aiffstopread(sox_format_t * ft);
+int sox_aiffstartwrite(sox_format_t * ft);
+sox_size_t sox_aiffwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len);
+int sox_aiffstopwrite(sox_format_t * ft);
+int sox_aifcstartwrite(sox_format_t * ft);
+int sox_aifcstopwrite(sox_format_t * ft);
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -20,7 +20,7 @@
     snd_pcm_uframes_t frames_this_period;
 } *alsa_priv_t;
 
-static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt)
+static int get_format(sox_format_t * ft, snd_pcm_format_mask_t *fmask, int *fmt)
 {
     if (ft->signal.size == -1)
         ft->signal.size = SOX_SIZE_16BIT;
@@ -172,7 +172,7 @@
     return 0;
 }
 
-static int sox_alsasetup(ft_t ft, snd_pcm_stream_t mode)
+static int sox_alsasetup(sox_format_t * ft, snd_pcm_stream_t mode)
 {
     int fmt = SND_PCM_FORMAT_S16;
     int err;
@@ -421,7 +421,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int sox_alsastartread(ft_t ft)
+static int sox_alsastartread(sox_format_t * ft)
 {
     return sox_alsasetup(ft, SND_PCM_STREAM_CAPTURE);
 }
@@ -464,7 +464,7 @@
     }
 }
 
-static sox_size_t sox_alsaread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp)
+static sox_size_t sox_alsaread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp)
 {
     sox_size_t len;
     int err;
@@ -533,7 +533,7 @@
     return len;
 }
 
-static int sox_alsastopread(ft_t ft)
+static int sox_alsastopread(sox_format_t * ft)
 {
     alsa_priv_t alsa = (alsa_priv_t)ft->priv;
 
@@ -544,7 +544,7 @@
     return SOX_SUCCESS;
 }
 
-static int sox_alsastartwrite(ft_t ft)
+static int sox_alsastartwrite(sox_format_t * ft)
 {
     return sox_alsasetup(ft, SND_PCM_STREAM_PLAYBACK);
 }
@@ -585,7 +585,7 @@
     }
 }
 
-static sox_size_t sox_alsawrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp)
+static sox_size_t sox_alsawrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp)
 {
     sox_size_t osamp, done;
     alsa_priv_t alsa = (alsa_priv_t)ft->priv;
@@ -656,7 +656,7 @@
 }
 
 
-static int sox_alsastopwrite(ft_t ft)
+static int sox_alsastopwrite(sox_format_t * ft)
 {
     alsa_priv_t alsa = (alsa_priv_t)ft->priv;
 
@@ -694,7 +694,7 @@
   NULL
 };
 
-static sox_format_t sox_alsa_format = {
+static sox_format_handler_t sox_alsa_format = {
   alsanames,
   SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
   sox_alsastartread,
@@ -706,9 +706,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_alsa_format_fn(void);
+const sox_format_handler_t *sox_alsa_format_fn(void);
 
-const sox_format_t *sox_alsa_format_fn(void)
+const sox_format_handler_t *sox_alsa_format_fn(void)
 {
     return &sox_alsa_format;
 }
--- a/src/amr.h
+++ b/src/amr.h
@@ -30,7 +30,7 @@
 
 assert_static(sizeof(struct amr) <= SOX_MAX_FILE_PRIVSIZE, AMR_PRIV_TOO_BIG);
 
-static sox_size_t decode_1_frame(ft_t ft)
+static sox_size_t decode_1_frame(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
   int block_size_1;
@@ -45,7 +45,7 @@
   return 0;
 }
 
-static void encode_1_frame(ft_t ft)
+static void encode_1_frame(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
   unsigned char coded[AMR_CODED_MAX];
@@ -52,7 +52,7 @@
   fwrite(coded, 1, (unsigned)E_IF_encode(amr->state, amr->mode, amr->pcm, coded, 1), ft->fp);
 }
 
-static void set_format(ft_t ft)
+static void set_format(sox_format_t * ft)
 {
   ft->signal.rate = AMR_RATE;
   ft->signal.size = SOX_SIZE_16BIT;
@@ -60,7 +60,7 @@
   ft->signal.channels = 1;
 }
 
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
   char buffer[sizeof(magic)];
@@ -79,7 +79,7 @@
   return SOX_SUCCESS;
 }
 
-static sox_size_t read(ft_t ft, sox_ssample_t * buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t * buf, sox_size_t len)
 {
   amr_t amr = (amr_t) ft->priv;
   sox_size_t done;
@@ -94,7 +94,7 @@
   return done;
 }
 
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
   D_IF_exit(amr->state);
@@ -101,7 +101,7 @@
   return SOX_SUCCESS;
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
 
@@ -121,7 +121,7 @@
   return SOX_SUCCESS;
 }
 
-static sox_size_t write(ft_t ft, const sox_ssample_t * buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t * buf, sox_size_t len)
 {
   amr_t amr = (amr_t) ft->priv;
   sox_size_t done;
@@ -136,7 +136,7 @@
   return done;
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   amr_t amr = (amr_t) ft->priv;
 
@@ -150,12 +150,12 @@
   return SOX_SUCCESS;
 }
 
-const sox_format_t *AMR_FORMAT_FN(void);
+const sox_format_handler_t *AMR_FORMAT_FN(void);
 
-const sox_format_t *AMR_FORMAT_FN(void)
+const sox_format_handler_t *AMR_FORMAT_FN(void)
 {
   static char const * names[] = {AMR_NAMES, NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, 0,
     startread, read, stopread,
     startwrite, write, stopwrite,
--- a/src/ao.c
+++ b/src/ao.c
@@ -30,13 +30,13 @@
   ao_sample_format format;
 } *ao_priv_t;
 
-static int startread(UNUSED ft_t ft)
+static int startread(UNUSED sox_format_t * ft)
 {
   sox_fail("Cannot read from libao driver");
   return SOX_EOF;
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   ao_priv_t ao = (ao_priv_t)ft->priv;
 
@@ -58,7 +58,7 @@
   return SOX_SUCCESS;
 }
 
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   ao_priv_t ao = (ao_priv_t)ft->priv;
 
@@ -68,7 +68,7 @@
   return len;
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   ao_priv_t ao = (ao_priv_t)ft->priv;
 
@@ -87,7 +87,7 @@
   NULL
 };
 
-static sox_format_t sox_ao_format = {
+static sox_format_handler_t sox_ao_format = {
   aonames,
   SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
   startread,
@@ -99,9 +99,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_ao_format_fn(void);
+const sox_format_handler_t *sox_ao_format_fn(void);
 
-const sox_format_t *sox_ao_format_fn(void)
+const sox_format_handler_t *sox_ao_format_fn(void)
 {
     return &sox_ao_format;
 }
--- a/src/au.c
+++ b/src/au.c
@@ -60,7 +60,7 @@
         int in_bits;
 } *au_t;
 
-static void auwriteheader(ft_t ft, sox_size_t data_size);
+static void auwriteheader(sox_format_t * ft, sox_size_t data_size);
 
 static int sox_auencodingandsize(uint32_t sun_encoding, sox_encoding_t * encoding, int * size)
 {
@@ -108,7 +108,7 @@
     return(SOX_SUCCESS);
 }
 
-static int sox_auseek(ft_t ft, sox_size_t offset) 
+static int sox_auseek(sox_format_t * ft, sox_size_t offset) 
 {
     au_t au = (au_t ) ft->priv;
 
@@ -138,7 +138,7 @@
     return(ft->sox_errno);
 }
 
-static int sox_austartread(ft_t ft) 
+static int sox_austartread(sox_format_t * ft) 
 {
         /* The following 6 variables represent a Sun sound header on disk.
            The numbers are written as big-endians.
@@ -290,7 +290,7 @@
    if it is not, the unspecified size remains in the header
    (this is legal). */
 
-static int sox_austartwrite(ft_t ft) 
+static int sox_austartwrite(sox_format_t * ft) 
 {
         au_t p = (au_t ) ft->priv;
         int rc;
@@ -310,7 +310,7 @@
  * Returns 1 if there is residual input, returns -1 if eof, else returns 0.
  * (Adapted from Sun's decode.c.)
  */
-static int unpack_input(ft_t ft, unsigned char *code)
+static int unpack_input(sox_format_t * ft, unsigned char *code)
 {
         au_t p = (au_t ) ft->priv;
         unsigned char           in_byte;
@@ -329,7 +329,7 @@
         return (p->in_bits > 0);
 }
 
-static sox_size_t sox_auread(ft_t ft, sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_auread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t samp)
 {
         au_t p = (au_t ) ft->priv;
         unsigned char code;
@@ -347,7 +347,7 @@
         return done;
 }
 
-static sox_size_t sox_auwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_auwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t samp)
 {
         au_t p = (au_t ) ft->priv;
         p->data_size += samp * ft->signal.size;
@@ -354,7 +354,7 @@
         return(sox_rawwrite(ft, buf, samp));
 }
 
-static int sox_austopwrite(ft_t ft)
+static int sox_austopwrite(sox_format_t * ft)
 {
         au_t p = (au_t ) ft->priv;
         int rc;
@@ -399,7 +399,7 @@
         return sun_encoding;
 }
 
-static void auwriteheader(ft_t ft, sox_size_t data_size)
+static void auwriteheader(sox_format_t * ft, sox_size_t data_size)
 {
         uint32_t magic;
         uint32_t hdr_size;
@@ -480,7 +480,7 @@
   NULL
 };
 
-static sox_format_t sox_au_format = {
+static sox_format_handler_t sox_au_format = {
   aunames,
   SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_austartread,
@@ -492,9 +492,9 @@
   sox_auseek
 };
 
-const sox_format_t *sox_au_format_fn(void);
+const sox_format_handler_t *sox_au_format_fn(void);
 
-const sox_format_t *sox_au_format_fn(void)
+const sox_format_handler_t *sox_au_format_fn(void)
 {
     return &sox_au_format;
 }
--- a/src/auto.c
+++ b/src/auto.c
@@ -17,7 +17,7 @@
 #include "sox_i.h"
 #include <string.h>
 
-static int sox_autostartread(ft_t ft)
+static int sox_autostartread(sox_format_t * ft)
 {
     char *type = NULL;
     char header[256];
@@ -164,10 +164,10 @@
 
     sox_debug("Detected file format type: %s", type);
     set_endianness_if_not_already_set(ft);
-    return ft->h->startread? (* ft->h->startread)(ft) : SOX_SUCCESS;
+    return ft->handler->startread? (* ft->handler->startread)(ft) : SOX_SUCCESS;
 }
 
-static int sox_autostartwrite(ft_t ft) 
+static int sox_autostartwrite(sox_format_t * ft) 
 {
         sox_fail_errno(ft,SOX_EFMT,"Type AUTO can only be used for input!");
         return(SOX_EOF);
@@ -178,7 +178,7 @@
   NULL
 };
 
-static sox_format_t sox_auto_format = {
+static sox_format_handler_t sox_auto_format = {
   autonames,
   SOX_FILE_DEVICE | SOX_FILE_PHONY,
   sox_autostartread,
@@ -190,9 +190,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_auto_format_fn(void);
+const sox_format_handler_t *sox_auto_format_fn(void);
 
-const sox_format_t *sox_auto_format_fn(void)
+const sox_format_handler_t *sox_auto_format_fn(void)
 {
     return &sox_auto_format;
 }
--- a/src/avr.c
+++ b/src/avr.c
@@ -63,7 +63,7 @@
  */
 
 
-static int sox_avrstartread(ft_t ft) 
+static int sox_avrstartread(sox_format_t * ft) 
 {
   avr_t avr = (avr_t)ft->priv;
   int rc;
@@ -141,7 +141,7 @@
   return(SOX_SUCCESS);
 }
 
-static int sox_avrstartwrite(ft_t ft) 
+static int sox_avrstartwrite(sox_format_t * ft) 
 {
   avr_t avr = (avr_t)ft->priv;
   int rc;
@@ -246,7 +246,7 @@
   return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_avrwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp) 
+static sox_size_t sox_avrwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp) 
 {
   avr_t avr = (avr_t)ft->priv;
 
@@ -255,7 +255,7 @@
   return (sox_rawwrite (ft, buf, nsamp));
 }
 
-static int sox_avrstopwrite(ft_t ft) 
+static int sox_avrstopwrite(sox_format_t * ft) 
 {
   avr_t avr = (avr_t)ft->priv;
   int rc;
@@ -282,7 +282,7 @@
   NULL
 };
 
-static sox_format_t sox_avr_format = {
+static sox_format_handler_t sox_avr_format = {
   avrnames,
   SOX_FILE_BIG_END,
   sox_avrstartread,
@@ -294,9 +294,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_avr_format_fn(void);
+const sox_format_handler_t *sox_avr_format_fn(void);
 
-const sox_format_t *sox_avr_format_fn(void)
+const sox_format_handler_t *sox_avr_format_fn(void)
 {
     return &sox_avr_format;
 }
--- a/src/cdr.c
+++ b/src/cdr.c
@@ -39,7 +39,7 @@
  *      mono/stereo/quad.
  */
 
-static int sox_cdrstartread(ft_t ft) 
+static int sox_cdrstartread(sox_format_t * ft) 
 {
         int rc;
 
@@ -71,7 +71,7 @@
  * Return number of samples read.
  */
 
-static sox_size_t sox_cdrread(ft_t ft, sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_cdrread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len) 
 {
 
         return sox_rawread(ft, buf, len);
@@ -81,13 +81,13 @@
  * Do anything required when you stop reading samples.  
  * Don't close input file! 
  */
-static int sox_cdrstopread(ft_t ft) 
+static int sox_cdrstopread(sox_format_t * ft) 
 {
         /* Needed because of rawread() */
         return sox_rawstopread(ft);
 }
 
-static int sox_cdrstartwrite(ft_t ft) 
+static int sox_cdrstartwrite(sox_format_t * ft) 
 {
         cdr_t cdr = (cdr_t) ft->priv;
         int rc;
@@ -107,7 +107,7 @@
         return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_cdrwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_cdrwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len) 
 {
         cdr_t cdr = (cdr_t) ft->priv;
 
@@ -121,7 +121,7 @@
  * samples.  We write -32768 for each sample to pad it out.
  */
 
-static int sox_cdrstopwrite(ft_t ft) 
+static int sox_cdrstopwrite(sox_format_t * ft) 
 {
         cdr_t cdr = (cdr_t) ft->priv;
         int padsamps = SECTORSIZE - (cdr->samples % SECTORSIZE);
@@ -149,7 +149,7 @@
   NULL
 };
 
-static sox_format_t sox_cdr_format = {
+static sox_format_handler_t sox_cdr_format = {
   cdrnames,
   SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_cdrstartread,
@@ -161,9 +161,9 @@
   sox_rawseek
 };
 
-const sox_format_t *sox_cdr_format_fn(void);
+const sox_format_handler_t *sox_cdr_format_fn(void);
 
-const sox_format_t *sox_cdr_format_fn(void)
+const sox_format_handler_t *sox_cdr_format_fn(void)
 {
     return &sox_cdr_format;
 }
--- a/src/cvsd-fmt.c
+++ b/src/cvsd-fmt.c
@@ -31,7 +31,7 @@
   NULL
 };
 
-static sox_format_t sox_cvsd_format = {
+static sox_format_handler_t sox_cvsd_format = {
   cvsdnames,
   0,
   sox_cvsdstartread,
@@ -43,9 +43,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_cvsd_format_fn(void);
+const sox_format_handler_t *sox_cvsd_format_fn(void);
 
-const sox_format_t *sox_cvsd_format_fn(void)
+const sox_format_handler_t *sox_cvsd_format_fn(void)
 {
     return &sox_cvsd_format;
 }
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -111,7 +111,7 @@
  */
 /* ---------------------------------------------------------------------- */
 
-static void cvsdstartcommon(ft_t ft)
+static void cvsdstartcommon(sox_format_t * ft)
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         
@@ -151,7 +151,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_cvsdstartread(ft_t ft) 
+int sox_cvsdstartread(sox_format_t * ft) 
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         float *fp1;
@@ -177,7 +177,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_cvsdstartwrite(ft_t ft) 
+int sox_cvsdstartwrite(sox_format_t * ft) 
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         float *fp1;
@@ -199,7 +199,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_cvsdstopwrite(ft_t ft)
+int sox_cvsdstopwrite(sox_format_t * ft)
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
 
@@ -215,7 +215,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_cvsdstopread(ft_t ft)
+int sox_cvsdstopread(sox_format_t * ft)
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
 
@@ -227,7 +227,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-sox_size_t sox_cvsdread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp) 
+sox_size_t sox_cvsdread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp) 
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         sox_size_t done = 0;
@@ -283,7 +283,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-sox_size_t sox_cvsdwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp) 
+sox_size_t sox_cvsdwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp) 
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         sox_size_t done = 0;
@@ -365,7 +365,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-static int dvms_read_header(ft_t ft, struct dvms_header *hdr)
+static int dvms_read_header(sox_format_t * ft, struct dvms_header *hdr)
 {
         unsigned char hdrbuf[DVMS_HEADER_LEN];
         unsigned char *pch = hdrbuf;
@@ -410,7 +410,7 @@
 /*
  * note! file must be seekable
  */
-static int dvms_write_header(ft_t ft, struct dvms_header *hdr)
+static int dvms_write_header(sox_format_t * ft, struct dvms_header *hdr)
 {
         unsigned char hdrbuf[DVMS_HEADER_LEN];
         unsigned char *pch = hdrbuf;
@@ -453,7 +453,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-static void make_dvms_hdr(ft_t ft, struct dvms_header *hdr)
+static void make_dvms_hdr(sox_format_t * ft, struct dvms_header *hdr)
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
         size_t len;
@@ -479,7 +479,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_dvmsstartread(ft_t ft) 
+int sox_dvmsstartread(sox_format_t * ft) 
 {
         struct dvms_header hdr;
         int rc;
@@ -516,7 +516,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_dvmsstartwrite(ft_t ft) 
+int sox_dvmsstartwrite(sox_format_t * ft) 
 {
         struct dvms_header hdr;
         int rc;
@@ -540,7 +540,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-int sox_dvmsstopwrite(ft_t ft)
+int sox_dvmsstopwrite(sox_format_t * ft)
 {
         struct dvms_header hdr;
         int rc;
--- a/src/cvsd.h
+++ b/src/cvsd.h
@@ -21,13 +21,13 @@
  *
  */
 
-int sox_cvsdstartread(ft_t ft);
-int sox_cvsdstartwrite(ft_t ft);
-sox_size_t sox_cvsdread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp);
-sox_size_t sox_cvsdwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp);
-int sox_cvsdstopread(ft_t ft);
-int sox_cvsdstopwrite(ft_t ft);
+int sox_cvsdstartread(sox_format_t * ft);
+int sox_cvsdstartwrite(sox_format_t * ft);
+sox_size_t sox_cvsdread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp);
+sox_size_t sox_cvsdwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp);
+int sox_cvsdstopread(sox_format_t * ft);
+int sox_cvsdstopwrite(sox_format_t * ft);
 
-int sox_dvmsstartread(ft_t ft);
-int sox_dvmsstartwrite(ft_t ft);
-int sox_dvmsstopwrite(ft_t ft);
+int sox_dvmsstartread(sox_format_t * ft);
+int sox_dvmsstartwrite(sox_format_t * ft);
+int sox_dvmsstopwrite(sox_format_t * ft);
--- a/src/dat.c
+++ b/src/dat.c
@@ -22,7 +22,7 @@
     char prevline[LINEWIDTH]; 
 } *dat_t;
 
-static int sox_datstartread(ft_t ft)
+static int sox_datstartread(sox_format_t * ft)
 {
     char inpstr[LINEWIDTH];
     long rate;
@@ -58,7 +58,7 @@
     return (SOX_SUCCESS);
 }
 
-static int sox_datstartwrite(ft_t ft)
+static int sox_datstartwrite(sox_format_t * ft)
 {
     dat_t dat = (dat_t) ft->priv;
     char s[LINEWIDTH];
@@ -76,7 +76,7 @@
     return (SOX_SUCCESS);
 }
 
-static sox_size_t sox_datread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp)
+static sox_size_t sox_datread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp)
 {
     char inpstr[LINEWIDTH];
     int  inpPtr = 0;
@@ -123,7 +123,7 @@
     return (done);
 }
 
-static sox_size_t sox_datwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp)
+static sox_size_t sox_datwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp)
 {
     dat_t dat = (dat_t) ft->priv;
     sox_size_t done = 0;
@@ -157,7 +157,7 @@
   NULL
 };
 
-static sox_format_t sox_dat_format = {
+static sox_format_handler_t sox_dat_format = {
   datnames,
   0,
   sox_datstartread,
@@ -169,9 +169,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_dat_format_fn(void);
+const sox_format_handler_t *sox_dat_format_fn(void);
 
-const sox_format_t *sox_dat_format_fn(void)
+const sox_format_handler_t *sox_dat_format_fn(void)
 {
     return &sox_dat_format;
 }
--- a/src/dvms-fmt.c
+++ b/src/dvms-fmt.c
@@ -31,7 +31,7 @@
   NULL
 };
 
-static sox_format_t sox_dvms_format = {
+static sox_format_handler_t sox_dvms_format = {
   dvmsnames,
   0,
   sox_dvmsstartread,
@@ -43,9 +43,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_dvms_format_fn(void);
+const sox_format_handler_t *sox_dvms_format_fn(void);
 
-const sox_format_t *sox_dvms_format_fn(void)
+const sox_format_handler_t *sox_dvms_format_fn(void)
 {
     return &sox_dvms_format;
 }
--- a/src/ffmpeg.c
+++ b/src/ffmpeg.c
@@ -148,7 +148,7 @@
   }
 }
 
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
   AVFormatParameters params;
@@ -212,7 +212,7 @@
  * Read up to len samples of type sox_sample_t from file into buf[].
  * Return number of samples read.
  */
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
   AVPacket *pkt = &ffmpeg->audio_pkt;
@@ -241,7 +241,7 @@
 /*
  * Close file for ffmpeg (this doesn't close the file handle)
  */
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
 
@@ -258,7 +258,7 @@
 /*
  * add an audio output stream
  */
-static AVStream *add_audio_stream(ft_t ft, AVFormatContext *oc, enum CodecID codec_id)
+static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id)
 {
   AVCodecContext *c;
   AVStream *st;
@@ -326,7 +326,7 @@
   return SOX_SUCCESS;
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
 
@@ -397,7 +397,7 @@
  * Write up to len samples of type sox_sample_t from buf[] into file.
  * Return number of samples written.
  */
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
   sox_size_t nread = 0, nwritten = 0;
@@ -440,7 +440,7 @@
 /*
  * Close file for ffmpeg (this doesn't close the file handle)
  */
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   ffmpeg_t ffmpeg = (ffmpeg_t)ft->priv;
   unsigned i;
@@ -486,7 +486,7 @@
 };
 
 /* Format descriptor */
-static sox_format_t sox_ffmpeg_format = {
+static sox_format_handler_t sox_ffmpeg_format = {
   names,
   SOX_FILE_NOSTDIO,
   startread,
@@ -498,9 +498,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_ffmpeg_format_fn(void);
+const sox_format_handler_t *sox_ffmpeg_format_fn(void);
 
-const sox_format_t *sox_ffmpeg_format_fn(void)
+const sox_format_handler_t *sox_ffmpeg_format_fn(void)
 {
   return &sox_ffmpeg_format;
 }
--- a/src/flac.c
+++ b/src/flac.c
@@ -66,8 +66,8 @@
 
 static void FLAC__decoder_metadata_callback(FLAC__StreamDecoder const * const flac, FLAC__StreamMetadata const * const metadata, void * const client_data)
 {
-  ft_t format = (ft_t) client_data;
-  Decoder * decoder = (Decoder *) format->priv;
+  sox_format_t * ft = (sox_format_t *) client_data;
+  Decoder * decoder = (Decoder *) ft->priv;
 
   (void) flac;
 
@@ -83,7 +83,7 @@
     if (metadata->data.vorbis_comment.num_comments == 0)
       return;
 
-    if (format->comment != NULL) {
+    if (ft->comment != NULL) {
       sox_warn("FLAC: multiple Vorbis comment block ignored");
       return;
     }
@@ -91,12 +91,12 @@
     for (i = 0; i < metadata->data.vorbis_comment.num_comments; ++i)
       comment_size += metadata->data.vorbis_comment.comments[i].length + 1;
 
-    format->comment = (char *) xcalloc(comment_size, sizeof(char));
+    ft->comment = (char *) xcalloc(comment_size, sizeof(char));
 
     for (i = 0; i < metadata->data.vorbis_comment.num_comments; ++i) {
-      strcat(format->comment, (char const *) metadata->data.vorbis_comment.comments[i].entry);
+      strcat(ft->comment, (char const *) metadata->data.vorbis_comment.comments[i].entry);
       if (i != metadata->data.vorbis_comment.num_comments - 1)
-        strcat(format->comment, "\n");
+        strcat(ft->comment, "\n");
     }
   }
 }
@@ -105,11 +105,11 @@
 
 static void FLAC__decoder_error_callback(FLAC__StreamDecoder const * const flac, FLAC__StreamDecoderErrorStatus const status, void * const client_data)
 {
-  ft_t format = (ft_t) client_data;
+  sox_format_t * ft = (sox_format_t *) client_data;
 
   (void) flac;
 
-  sox_fail_errno(format, SOX_EINVAL, "%s", FLAC__StreamDecoderErrorStatusString[status]);
+  sox_fail_errno(ft, SOX_EINVAL, "%s", FLAC__StreamDecoderErrorStatusString[status]);
 }
 
 
@@ -116,13 +116,13 @@
 
 static FLAC__StreamDecoderWriteStatus FLAC__frame_decode_callback(FLAC__StreamDecoder const * const flac, FLAC__Frame const * const frame, FLAC__int32 const * const buffer[], void * const client_data)
 {
-  ft_t format = (ft_t) client_data;
-  Decoder * decoder = (Decoder *) format->priv;
+  sox_format_t * ft = (sox_format_t *) client_data;
+  Decoder * decoder = (Decoder *) ft->priv;
 
   (void) flac;
 
   if (frame->header.bits_per_sample != decoder->bits_per_sample || frame->header.channels != decoder->channels || frame->header.sample_rate != decoder->sample_rate) {
-    sox_fail_errno(format, SOX_EINVAL, "FLAC ERROR: parameters differ between frame and header");
+    sox_fail_errno(ft, SOX_EINVAL, "FLAC ERROR: parameters differ between frame and header");
     return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
   }
 
@@ -134,14 +134,14 @@
 
 
 
-static int start_read(ft_t const format)
+static int start_read(sox_format_t * const ft)
 {
-  Decoder * decoder = (Decoder *) format->priv;
+  Decoder * decoder = (Decoder *) ft->priv;
 
   memset(decoder, 0, sizeof(*decoder));
   decoder->flac = FLAC__stream_decoder_new();
   if (decoder->flac == NULL) {
-    sox_fail_errno(format, SOX_ENOMEM, "FLAC ERROR creating the decoder instance");
+    sox_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the decoder instance");
     return SOX_EOF;
   }
 
@@ -148,28 +148,28 @@
   FLAC__stream_decoder_set_md5_checking(decoder->flac, sox_true);
   FLAC__stream_decoder_set_metadata_respond_all(decoder->flac);
 #if FLAC_API_VERSION_CURRENT <= 7
-  FLAC__file_decoder_set_filename(decoder->flac, format->filename);
+  FLAC__file_decoder_set_filename(decoder->flac, ft->filename);
   FLAC__file_decoder_set_write_callback(decoder->flac, FLAC__frame_decode_callback);
   FLAC__file_decoder_set_metadata_callback(decoder->flac, FLAC__decoder_metadata_callback);
   FLAC__file_decoder_set_error_callback(decoder->flac, FLAC__decoder_error_callback);
-  FLAC__file_decoder_set_client_data(decoder->flac, format);
+  FLAC__file_decoder_set_client_data(decoder->flac, ft);
   if (FLAC__file_decoder_init(decoder->flac) != FLAC__FILE_DECODER_OK) {
 #else
   if (FLAC__stream_decoder_init_file(
     decoder->flac,
-    format->filename,
+    ft->filename,
     FLAC__frame_decode_callback,
     FLAC__decoder_metadata_callback,
     FLAC__decoder_error_callback,
-    format) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
+    ft) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
 #endif
-    sox_fail_errno(format, SOX_EHDR, "FLAC ERROR initialising decoder");
+    sox_fail_errno(ft, SOX_EHDR, "FLAC ERROR initialising decoder");
     return SOX_EOF;
   }
 
 
   if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder->flac)) {
-    sox_fail_errno(format, SOX_EHDR, "FLAC ERROR whilst decoding metadata");
+    sox_fail_errno(ft, SOX_EHDR, "FLAC ERROR whilst decoding metadata");
     return SOX_EOF;
   }
 
@@ -178,22 +178,22 @@
 #else
   if (FLAC__stream_decoder_get_state(decoder->flac) > FLAC__STREAM_DECODER_END_OF_STREAM) {
 #endif
-    sox_fail_errno(format, SOX_EHDR, "FLAC ERROR during metadata decoding");
+    sox_fail_errno(ft, SOX_EHDR, "FLAC ERROR during metadata decoding");
     return SOX_EOF;
   }
 
-  format->signal.encoding = SOX_ENCODING_FLAC;
-  format->signal.rate = decoder->sample_rate;
-  format->signal.size = decoder->bits_per_sample >> 3;
-  format->signal.channels = decoder->channels;
-  format->length = decoder->total_samples * decoder->channels;
+  ft->signal.encoding = SOX_ENCODING_FLAC;
+  ft->signal.rate = decoder->sample_rate;
+  ft->signal.size = decoder->bits_per_sample >> 3;
+  ft->signal.channels = decoder->channels;
+  ft->length = decoder->total_samples * decoder->channels;
   return SOX_SUCCESS;
 }
 
 
-static sox_size_t read(ft_t const format, sox_ssample_t * sampleBuffer, sox_size_t const requested)
+static sox_size_t read(sox_format_t * const ft, sox_ssample_t * sampleBuffer, sox_size_t const requested)
 {
-  Decoder * decoder = (Decoder *) format->priv;
+  Decoder * decoder = (Decoder *) ft->priv;
   size_t actual = 0;
 
   while (!decoder->eof && actual < requested) {
@@ -221,9 +221,9 @@
 
 
 
-static int stop_read(ft_t const format)
+static int stop_read(sox_format_t * const ft)
 {
-  Decoder * decoder = (Decoder *) format->priv;
+  Decoder * decoder = (Decoder *) ft->priv;
 
   if (!FLAC__stream_decoder_finish(decoder->flac) && decoder->eof)
     sox_warn("FLAC decoder MD5 checksum mismatch.");
@@ -254,10 +254,10 @@
 
 static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
 {
-  ft_t const format = (ft_t) client_data;
+  sox_format_t * const ft = (sox_format_t *) client_data;
   (void) flac, (void) samples, (void) current_frame;
 
-  return sox_writebuf(format, buffer, bytes) == bytes ? FLAC__STREAM_ENCODER_WRITE_STATUS_OK : FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+  return sox_writebuf(ft, buffer, bytes) == bytes ? FLAC__STREAM_ENCODER_WRITE_STATUS_OK : FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
 }
 
 
@@ -272,11 +272,11 @@
 #if FLAC_API_VERSION_CURRENT >= 8
 static FLAC__StreamEncoderSeekStatus flac_stream_encoder_seek_callback(FLAC__StreamEncoder const * encoder, FLAC__uint64 absolute_byte_offset, void * client_data)
 {
-  ft_t const format = (ft_t) client_data;
+  sox_format_t * const ft = (sox_format_t *) client_data;
   (void) encoder;
-  if (!format->seekable)
+  if (!ft->seekable)
     return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
-  else if (sox_seeki(format, (sox_size_t)absolute_byte_offset, SEEK_SET) != SOX_SUCCESS)
+  else if (sox_seeki(ft, (sox_size_t)absolute_byte_offset, SEEK_SET) != SOX_SUCCESS)
     return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
   else
     return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
@@ -286,12 +286,12 @@
 
 static FLAC__StreamEncoderTellStatus flac_stream_encoder_tell_callback(FLAC__StreamEncoder const * encoder, FLAC__uint64 * absolute_byte_offset, void * client_data)
 {
-  ft_t const format = (ft_t) client_data;
+  sox_format_t * const ft = (sox_format_t *) client_data;
   off_t pos;
   (void) encoder;
-  if (!format->seekable)
+  if (!ft->seekable)
     return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
-  else if ((pos = ftello(format->fp)) < 0)
+  else if ((pos = ftello(ft->fp)) < 0)
     return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
   else {
     *absolute_byte_offset = (FLAC__uint64)pos;
@@ -302,15 +302,15 @@
 
 
 
-static int start_write(ft_t const format)
+static int start_write(sox_format_t * const ft)
 {
-  Encoder * encoder = (Encoder *) format->priv;
+  Encoder * encoder = (Encoder *) ft->priv;
   FLAC__StreamEncoderState status;
 
   memset(encoder, 0, sizeof(*encoder));
   encoder->flac = FLAC__stream_encoder_new();
   if (encoder->flac == NULL) {
-    sox_fail_errno(format, SOX_ENOMEM, "FLAC ERROR creating the encoder instance");
+    sox_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder instance");
     return SOX_EOF;
   }
   encoder->decoded_samples = xmalloc(sox_bufsiz * sizeof(FLAC__int32));
@@ -337,11 +337,11 @@
     };
     unsigned compression_level = array_length(options) - 1; /* Default to "best" */
 
-    if (format->signal.compression != HUGE_VAL) {
-      compression_level = format->signal.compression;
-      if (compression_level != format->signal.compression || 
+    if (ft->signal.compression != HUGE_VAL) {
+      compression_level = ft->signal.compression;
+      if (compression_level != ft->signal.compression || 
           compression_level >= array_length(options)) {
-        sox_fail_errno(format, SOX_EINVAL,
+        sox_fail_errno(ft, SOX_EINVAL,
                    "FLAC compression level must be a whole number from 0 to %i",
                    array_length(options) - 1);
         return SOX_EOF;
@@ -357,7 +357,7 @@
     SET_OPTION(max_lpc_order);
     SET_OPTION(max_residual_partition_order);
     SET_OPTION(min_residual_partition_order);
-    if (format->signal.channels == 2) {
+    if (ft->signal.channels == 2) {
       SET_OPTION(do_mid_side_stereo);
       SET_OPTION(loose_mid_side_stereo);
     }
@@ -365,17 +365,17 @@
   }
 
   /* FIXME: FLAC should not need to know about this oddity */
-  if (format->signal.encoding < SOX_ENCODING_SIZE_IS_WORD)
-    format->signal.size = SOX_SIZE_16BIT;
-  format->signal.encoding = SOX_ENCODING_FLAC;
+  if (ft->signal.encoding < SOX_ENCODING_SIZE_IS_WORD)
+    ft->signal.size = SOX_SIZE_16BIT;
+  ft->signal.encoding = SOX_ENCODING_FLAC;
 
-  encoder->bits_per_sample = (format->signal.size > 4 ? 4 : format->signal.size) << 3;
+  encoder->bits_per_sample = (ft->signal.size > 4 ? 4 : ft->signal.size) << 3;
 
   sox_report("FLAC encoding at %i bits per sample", encoder->bits_per_sample);
 
-  FLAC__stream_encoder_set_channels(encoder->flac, format->signal.channels);
+  FLAC__stream_encoder_set_channels(encoder->flac, ft->signal.channels);
   FLAC__stream_encoder_set_bits_per_sample(encoder->flac, encoder->bits_per_sample);
-  FLAC__stream_encoder_set_sample_rate(encoder->flac, format->signal.rate);
+  FLAC__stream_encoder_set_sample_rate(encoder->flac, ft->signal.rate);
 
   { /* Check if rate is streamable: */
     static const unsigned streamable_rates[] =
@@ -383,7 +383,7 @@
     size_t i;
     sox_bool streamable = sox_false;
     for (i = 0; !streamable && i < array_length(streamable_rates); ++i)
-       streamable = (streamable_rates[i] == format->signal.rate);
+       streamable = (streamable_rates[i] == ft->signal.rate);
     if (!streamable) {
       sox_report("FLAC: non-standard rate; output may not be streamable");
       FLAC__stream_encoder_set_streamable_subset(encoder->flac, sox_false);
@@ -390,23 +390,23 @@
     }
   }
 
-  if (format->length != 0) {
-    FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)format->length);
+  if (ft->length != 0) {
+    FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)ft->length);
 
     encoder->metadata[encoder->num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE);
     if (encoder->metadata[encoder->num_metadata] == NULL) {
-      sox_fail_errno(format, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table template");
+      sox_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table template");
       return SOX_EOF;
     }
     {
 #if FLAC_API_VERSION_CURRENT >= 8
-      if (!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(encoder->metadata[encoder->num_metadata], 10 * format->signal.rate, (FLAC__uint64)(format->length/format->signal.channels))) {
+      if (!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(encoder->metadata[encoder->num_metadata], 10 * ft->signal.rate, (FLAC__uint64)(ft->length/ft->signal.channels))) {
 #else
-      sox_size_t samples = 10 * format->signal.rate;
-      sox_size_t total_samples = format->length/format->signal.channels;
+      sox_size_t samples = 10 * ft->signal.rate;
+      sox_size_t total_samples = ft->length/ft->signal.channels;
       if (!FLAC__metadata_object_seektable_template_append_spaced_points(encoder->metadata[encoder->num_metadata], total_samples / samples + (total_samples % samples != 0), (FLAC__uint64)total_samples)) {
 #endif
-        sox_fail_errno(format, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table points");
+        sox_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table points");
         return SOX_EOF;
       }
     }
@@ -414,7 +414,7 @@
     ++encoder->num_metadata;
   }
 
-  if (format->comment != NULL && * format->comment != '\0') {
+  if (ft->comment != NULL && * ft->comment != '\0') {
     FLAC__StreamMetadata_VorbisComment_Entry entry;
     char * comments, * comment, * end_of_comment;
 
@@ -421,14 +421,14 @@
     encoder->metadata[encoder->num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
 
     /* Check if there is a FIELD=value pair already in the comment; if not, add one */
-    if (strchr(format->comment, '=') == NULL) {
+    if (strchr(ft->comment, '=') == NULL) {
       static const char prepend[] = "COMMENT=";
-      comments = xmalloc(strlen(format->comment) + sizeof(prepend));
+      comments = xmalloc(strlen(ft->comment) + sizeof(prepend));
       strcpy(comments, prepend);
-      strcat(comments, format->comment);
+      strcat(comments, ft->comment);
     }
     else
-      comments = strdup(format->comment);
+      comments = strdup(ft->comment);
 
     comment = comments;
 
@@ -454,15 +454,15 @@
 #if FLAC_API_VERSION_CURRENT <= 7
   FLAC__stream_encoder_set_write_callback(encoder->flac, flac_stream_encoder_write_callback);
   FLAC__stream_encoder_set_metadata_callback(encoder->flac, flac_stream_encoder_metadata_callback);
-  FLAC__stream_encoder_set_client_data(encoder->flac, format);
+  FLAC__stream_encoder_set_client_data(encoder->flac, ft);
   status = FLAC__stream_encoder_init(encoder->flac);
 #else
   status = FLAC__stream_encoder_init_stream(encoder->flac, flac_stream_encoder_write_callback,
-      flac_stream_encoder_seek_callback, flac_stream_encoder_tell_callback, flac_stream_encoder_metadata_callback, format);
+      flac_stream_encoder_seek_callback, flac_stream_encoder_tell_callback, flac_stream_encoder_metadata_callback, ft);
 #endif
 
   if (status != FLAC__STREAM_ENCODER_OK) {
-    sox_fail_errno(format, SOX_EINVAL, "%s", FLAC__StreamEncoderStateString[status]);
+    sox_fail_errno(ft, SOX_EINVAL, "%s", FLAC__StreamEncoderStateString[status]);
     return SOX_EOF;
   }
   return SOX_SUCCESS;
@@ -470,28 +470,28 @@
 
 
 
-static sox_size_t write(ft_t const format, sox_ssample_t const * const sampleBuffer, sox_size_t const len)
+static sox_size_t write(sox_format_t * const ft, sox_ssample_t const * const sampleBuffer, sox_size_t const len)
 {
-  Encoder * encoder = (Encoder *) format->priv;
+  Encoder * encoder = (Encoder *) ft->priv;
   unsigned i;
 
   for (i = 0; i < len; ++i) {
     switch (encoder->bits_per_sample) {
-      case  8: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_8BIT(sampleBuffer[i], format->clips); break;
-      case 16: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_16BIT(sampleBuffer[i], format->clips); break;
-      case 24: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_24BIT(sampleBuffer[i],format->clips); break;
-      case 32: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_32BIT(sampleBuffer[i],format->clips); break;
+      case  8: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_8BIT(sampleBuffer[i], ft->clips); break;
+      case 16: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_16BIT(sampleBuffer[i], ft->clips); break;
+      case 24: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_24BIT(sampleBuffer[i],ft->clips); break;
+      case 32: encoder->decoded_samples[i] = SOX_SAMPLE_TO_SIGNED_32BIT(sampleBuffer[i],ft->clips); break;
     }
   }
-  FLAC__stream_encoder_process_interleaved(encoder->flac, encoder->decoded_samples, len / format->signal.channels);
+  FLAC__stream_encoder_process_interleaved(encoder->flac, encoder->decoded_samples, len / ft->signal.channels);
   return FLAC__stream_encoder_get_state(encoder->flac) == FLAC__STREAM_ENCODER_OK ? len : 0;
 }
 
 
 
-static int stop_write(ft_t const format)
+static int stop_write(sox_format_t * const ft)
 {
-  Encoder * encoder = (Encoder *) format->priv;
+  Encoder * encoder = (Encoder *) ft->priv;
   FLAC__StreamEncoderState state = FLAC__stream_encoder_get_state(encoder->flac);
   unsigned i;
 
@@ -501,7 +501,7 @@
     FLAC__metadata_object_delete(encoder->metadata[i]);
   free(encoder->decoded_samples);
   if (state != FLAC__STREAM_ENCODER_OK) {
-    sox_fail_errno(format, SOX_EINVAL, "FLAC ERROR: failed to encode to end of stream");
+    sox_fail_errno(ft, SOX_EINVAL, "FLAC ERROR: failed to encode to end of stream");
     return SOX_EOF;
   }
   return SOX_SUCCESS;
@@ -509,20 +509,20 @@
 
 
 
-static int seek(ft_t format, sox_size_t offset)
+static int seek(sox_format_t * ft, sox_size_t offset)
 {
-  Decoder * decoder = (Decoder *) format->priv;
+  Decoder * decoder = (Decoder *) ft->priv;
 
-  return format->mode == 'r' && FLAC__stream_decoder_seek_absolute(decoder->flac, (FLAC__uint64)(offset / format->signal.channels)) ?  SOX_SUCCESS : SOX_EOF;
+  return ft->mode == 'r' && FLAC__stream_decoder_seek_absolute(decoder->flac, (FLAC__uint64)(offset / ft->signal.channels)) ?  SOX_SUCCESS : SOX_EOF;
 }
 
 
-const sox_format_t *sox_flac_format_fn(void);
+const sox_format_handler_t *sox_flac_format_fn(void);
 
-const sox_format_t *sox_flac_format_fn(void)
+const sox_format_handler_t *sox_flac_format_fn(void)
 {
   static char const * const names[] = {"flac", NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, SOX_FILE_SEEK,
     start_read, read, stop_read,
     start_write, write, stop_write,
--- a/src/formats.c
+++ b/src/formats.c
@@ -17,7 +17,7 @@
   unsigned sox_formats = 0;
   sox_format_tab_t sox_format_fns[MAX_FORMATS];
 #else
-  #define FORMAT(f) extern sox_format_t const * sox_##f##_format_fn(void);
+  #define FORMAT(f) extern sox_format_handler_t const * sox_##f##_format_fn(void);
   #include "formats.h"
   #undef FORMAT
   sox_format_tab_t sox_format_fns[] = {
--- a/src/gsm.c
+++ b/src/gsm.c
@@ -53,7 +53,7 @@
         gsm             handle[MAXCHANS];
 };
 
-static int gsmstart_rw(ft_t ft, int w) 
+static int gsmstart_rw(sox_format_t * ft, int w) 
 {
         struct gsmpriv *p = (struct gsmpriv *) ft->priv;
         unsigned ch;
@@ -88,12 +88,12 @@
         return (SOX_SUCCESS);
 }
 
-static int sox_gsmstartread(ft_t ft) 
+static int sox_gsmstartread(sox_format_t * ft) 
 {
         return gsmstart_rw(ft,0);
 }
 
-static int sox_gsmstartwrite(ft_t ft)
+static int sox_gsmstartwrite(sox_format_t * ft)
 {
         return gsmstart_rw(ft,1);
 }
@@ -105,7 +105,7 @@
  * Return number of samples read.
  */
 
-static sox_size_t sox_gsmread(ft_t ft, sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_gsmread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t samp)
 {
         size_t done = 0, r;
         int ch, chans;
@@ -149,7 +149,7 @@
         return done;
 }
 
-static int gsmflush(ft_t ft)
+static int gsmflush(sox_format_t * ft)
 {
         int r, ch, chans;
         gsm_signal *gbuff;
@@ -184,7 +184,7 @@
         return (SOX_SUCCESS);
 }
 
-static sox_size_t sox_gsmwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_gsmwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t samp)
 {
         size_t done = 0;
         struct gsmpriv *p = (struct gsmpriv *) ft->priv;
@@ -207,7 +207,7 @@
         return done;
 }
 
-static int sox_gsmstopread(ft_t ft)
+static int sox_gsmstopread(sox_format_t * ft)
 {
         struct gsmpriv *p = (struct gsmpriv *) ft->priv;
         unsigned ch;
@@ -220,7 +220,7 @@
         return (SOX_SUCCESS);
 }
 
-static int sox_gsmstopwrite(ft_t ft)
+static int sox_gsmstopwrite(sox_format_t * ft)
 {
         int rc;
         struct gsmpriv *p = (struct gsmpriv *) ft->priv;
@@ -241,7 +241,7 @@
   NULL
 };
 
-static sox_format_t sox_gsm_format = {
+static sox_format_handler_t sox_gsm_format = {
   gsmnames,
   0,
   sox_gsmstartread,
@@ -253,9 +253,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_gsm_format_fn(void);
+const sox_format_handler_t *sox_gsm_format_fn(void);
 
-const sox_format_t *sox_gsm_format_fn(void)
+const sox_format_handler_t *sox_gsm_format_fn(void)
 {
     return &sox_gsm_format;
 }
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -54,7 +54,7 @@
         int32_t curword;
 };
 
-static int sox_hcomstartread(ft_t ft)
+static int sox_hcomstartread(sox_format_t * ft)
 {
         struct readpriv *p = (struct readpriv *) ft->priv;
         int i;
@@ -149,7 +149,7 @@
         return (SOX_SUCCESS);
 }
 
-static sox_size_t sox_hcomread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_hcomread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
         register struct readpriv *p = (struct readpriv *) ft->priv;
         int done = 0;
@@ -213,7 +213,7 @@
         return done;
 }
 
-static int sox_hcomstopread(ft_t ft)
+static int sox_hcomstopread(sox_format_t * ft)
 {
         register struct readpriv *p = (struct readpriv *) ft->priv;
 
@@ -240,7 +240,7 @@
 
 #define BUFINCR (10*BUFSIZ)
 
-static int sox_hcomstartwrite(ft_t ft)
+static int sox_hcomstartwrite(sox_format_t * ft)
 {
         register struct writepriv *p = (struct writepriv *) ft->priv;
 
@@ -264,7 +264,7 @@
         return (SOX_SUCCESS);
 }
 
-static sox_size_t sox_hcomwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_hcomwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   struct writepriv *p = (struct writepriv *) ft->priv;
   sox_ssample_t datum;
@@ -298,7 +298,7 @@
   }
 }
 
-static void putcode(ft_t ft, long codes[256], long codesize[256], unsigned c, unsigned char **df)
+static void putcode(sox_format_t * ft, long codes[256], long codesize[256], unsigned c, unsigned char **df)
 {
   struct readpriv *p = (struct readpriv *) ft->priv;
   long code, size;
@@ -321,7 +321,7 @@
   }
 }
 
-static void compress(ft_t ft, unsigned char **df, int32_t *dl, sox_rate_t fr)
+static void compress(sox_format_t * ft, unsigned char **df, int32_t *dl, sox_rate_t fr)
 {
   struct readpriv *p = (struct readpriv *) ft->priv;
   int32_t samplerate;
@@ -425,7 +425,7 @@
 
 /* End of hcom utility routines */
 
-static int sox_hcomstopwrite(ft_t ft)
+static int sox_hcomstopwrite(sox_format_t * ft)
 {
   struct writepriv *p = (struct writepriv *) ft->priv;
   unsigned char *compressed_data = p->data;
@@ -468,7 +468,7 @@
   NULL
 };
 
-static sox_format_t sox_hcom_format = {
+static sox_format_handler_t sox_hcom_format = {
   hcomnames,
   SOX_FILE_BIG_END,
   sox_hcomstartread,
@@ -480,9 +480,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_hcom_format_fn(void);
+const sox_format_handler_t *sox_hcom_format_fn(void);
 
-const sox_format_t *sox_hcom_format_fn(void)
+const sox_format_handler_t *sox_hcom_format_fn(void)
 {
     return &sox_hcom_format;
 }
--- a/src/ima-fmt.c
+++ b/src/ima-fmt.c
@@ -13,12 +13,12 @@
 #include "sox_i.h"
 #include "vox.h"
 
-const sox_format_t *sox_ima_format_fn(void);
+const sox_format_handler_t *sox_ima_format_fn(void);
 
-const sox_format_t *sox_ima_format_fn(void)
+const sox_format_handler_t *sox_ima_format_fn(void)
 {
   static char const * names[] = {"ima", NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, 0,
     sox_ima_start,
     sox_vox_read,
--- a/src/lpc10.c
+++ b/src/lpc10.c
@@ -41,7 +41,7 @@
   significant bits of the last byte. The 8 bit characters are "filled"
   in order from most significant bit to least significant.
 */
-static void write_bits(ft_t ft, INT32 *bits, int len)
+static void write_bits(sox_format_t * ft, INT32 *bits, int len)
 {
   int i;
   uint8_t mask;	/* The next bit position within the variable "data" to
@@ -96,7 +96,7 @@
   the range 0 to len, inclusive. If it is less than len, it will
   always be a multiple of 8.
 */
-static int read_bits(ft_t ft, INT32 *bits, int len)
+static int read_bits(sox_format_t * ft, INT32 *bits, int len)
 {
   int i;
   uint8_t c;
@@ -118,7 +118,7 @@
   return (len);
 }
 
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
 
@@ -131,7 +131,7 @@
   return SOX_SUCCESS;
 }
 
-static int startwrite(ft_t ft) 
+static int startwrite(sox_format_t * ft) 
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
 
@@ -144,7 +144,7 @@
   return SOX_SUCCESS;
 }
 
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
   sox_size_t nread = 0;
@@ -168,7 +168,7 @@
   return nread;
 }
 
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
   sox_size_t nwritten = 0;
@@ -189,7 +189,7 @@
   return nwritten;
 }
 
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
 
@@ -198,7 +198,7 @@
   return SOX_SUCCESS;
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   lpcpriv_t lpc = (lpcpriv_t)ft->priv;
 
@@ -214,7 +214,7 @@
   NULL
 };
 
-static sox_format_t sox_lpc10_format = {
+static sox_format_handler_t sox_lpc10_format = {
   lpc10names,
   0,
   startread,
@@ -226,9 +226,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_lpc10_format_fn(void);
+const sox_format_handler_t *sox_lpc10_format_fn(void);
 
-const sox_format_t *sox_lpc10_format_fn(void)
+const sox_format_handler_t *sox_lpc10_format_fn(void)
 {
   return &sox_lpc10_format;
 }
--- a/src/maud.c
+++ b/src/maud.c
@@ -24,7 +24,7 @@
         uint32_t nsamples;
 };
 
-static void maudwriteheader(ft_t);
+static void maudwriteheader(sox_format_t *);
 
 /*
  * Do anything required before you start reading samples.
@@ -33,7 +33,7 @@
  *      size and encoding of samples, 
  *      mono/stereo/quad.
  */
-static int sox_maudstartread(ft_t ft) 
+static int sox_maudstartread(sox_format_t * ft) 
 {
         struct maudstuff * p = (struct maudstuff *) ft->priv;
         
@@ -198,7 +198,7 @@
         return(SOX_SUCCESS);
 }
 
-static int sox_maudstartwrite(ft_t ft) 
+static int sox_maudstartwrite(sox_format_t * ft) 
 {
         struct maudstuff * p = (struct maudstuff *) ft->priv;
         int rc;
@@ -232,7 +232,7 @@
         return (SOX_SUCCESS);
 }
 
-static sox_size_t sox_maudwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_maudwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len) 
 {
         struct maudstuff * p = (struct maudstuff *) ft->priv;
         
@@ -241,7 +241,7 @@
         return sox_rawwrite(ft, buf, len);
 }
 
-static int sox_maudstopwrite(ft_t ft) 
+static int sox_maudstopwrite(sox_format_t * ft) 
 {
         int rc;
 
@@ -263,7 +263,7 @@
 }
 
 #define MAUDHEADERSIZE (4+(4+4+32)+(4+4+32)+(4+4))
-static void maudwriteheader(ft_t ft)
+static void maudwriteheader(sox_format_t * ft)
 {
         struct maudstuff * p = (struct maudstuff *) ft->priv;
         
@@ -346,7 +346,7 @@
   NULL,
 };
 
-static sox_format_t sox_maud_format = {
+static sox_format_handler_t sox_maud_format = {
   maudnames,
   SOX_FILE_BIG_END,
   sox_maudstartread,
@@ -358,9 +358,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_maud_format_fn(void);
+const sox_format_handler_t *sox_maud_format_fn(void);
 
-const sox_format_t *sox_maud_format_fn(void)
+const sox_format_handler_t *sox_maud_format_fn(void)
 {
     return &sox_maud_format;
 }
--- a/src/misc.c
+++ b/src/misc.c
@@ -113,13 +113,13 @@
 /* Read in a buffer of data of length len bytes.
  * Returns number of bytes read.
  */
-size_t sox_readbuf(ft_t ft, void *buf, sox_size_t len)
+size_t sox_readbuf(sox_format_t * ft, void *buf, sox_size_t len)
 {
     return fread(buf, 1, len, ft->fp);
 }
 
 /* Skip input without seeking. */
-int sox_skipbytes(ft_t ft, sox_size_t n)
+int sox_skipbytes(sox_format_t * ft, sox_size_t n)
 {
   unsigned char trash;
 
@@ -131,7 +131,7 @@
 }
 
 /* Pad output. */
-int sox_padbytes(ft_t ft, sox_size_t n)
+int sox_padbytes(sox_format_t * ft, sox_size_t n)
 {
   while (n--)
     if (sox_writeb(ft, '\0') == SOX_EOF)
@@ -144,12 +144,12 @@
  * Returns number of bytes written.
  */
 
-size_t sox_writebuf(ft_t ft, void const *buf, sox_size_t len)
+size_t sox_writebuf(sox_format_t * ft, void const *buf, sox_size_t len)
 {
     return fwrite(buf, 1, len, ft->fp);
 }
 
-sox_size_t sox_filelength(ft_t ft)
+sox_size_t sox_filelength(sox_format_t * ft)
 {
   struct stat st;
 
@@ -158,32 +158,32 @@
   return (sox_size_t)st.st_size;
 }
 
-int sox_flush(ft_t ft)
+int sox_flush(sox_format_t * ft)
 {
   return fflush(ft->fp);
 }
 
-sox_ssize_t sox_tell(ft_t ft)
+sox_ssize_t sox_tell(sox_format_t * ft)
 {
   return (sox_ssize_t)ftello(ft->fp);
 }
 
-int sox_eof(ft_t ft)
+int sox_eof(sox_format_t * ft)
 {
   return feof(ft->fp);
 }
 
-int sox_error(ft_t ft)
+int sox_error(sox_format_t * ft)
 {
   return ferror(ft->fp);
 }
 
-void sox_rewind(ft_t ft)
+void sox_rewind(sox_format_t * ft)
 {
   rewind(ft->fp);
 }
 
-void sox_clearerr(ft_t ft)
+void sox_clearerr(sox_format_t * ft)
 {
   clearerr(ft->fp);
 }
@@ -194,7 +194,7 @@
 /* Read n-char string (and possibly null-terminating).
  * Stop reading and null-terminate string if either a 0 or \n is reached.
  */
-int sox_reads(ft_t ft, char *c, sox_size_t len)
+int sox_reads(sox_format_t * ft, char *c, sox_size_t len)
 {
     char *sc;
     char in;
@@ -219,7 +219,7 @@
 }
 
 /* Write null-terminated string (without \0). */
-int sox_writes(ft_t ft, char const * c)
+int sox_writes(sox_format_t * ft, char const * c)
 {
         if (sox_writebuf(ft, c, strlen(c)) != strlen(c))
         {
@@ -308,10 +308,10 @@
 
 
 /* dummy format routines for do-nothing functions */
-int sox_format_nothing(ft_t ft UNUSED) { return(SOX_SUCCESS); }
-sox_size_t sox_format_nothing_read(ft_t ft UNUSED, sox_ssample_t *buf UNUSED, sox_size_t len UNUSED) { return(0); }
-sox_size_t sox_format_nothing_write(ft_t ft UNUSED, const sox_ssample_t *buf UNUSED, sox_size_t len UNUSED) { return(0); }
-int sox_format_nothing_seek(ft_t ft UNUSED, sox_size_t offset UNUSED) { sox_fail_errno(ft, SOX_ENOTSUP, "operation not supported"); return(SOX_EOF); }
+int sox_format_nothing(sox_format_t * ft UNUSED) { return(SOX_SUCCESS); }
+sox_size_t sox_format_nothing_read(sox_format_t * ft UNUSED, sox_ssample_t *buf UNUSED, sox_size_t len UNUSED) { return(0); }
+sox_size_t sox_format_nothing_write(sox_format_t * ft UNUSED, const sox_ssample_t *buf UNUSED, sox_size_t len UNUSED) { return(0); }
+int sox_format_nothing_seek(sox_format_t * ft UNUSED, sox_size_t offset UNUSED) { sox_fail_errno(ft, SOX_ENOTSUP, "operation not supported"); return(SOX_EOF); }
 
 /* here for linear interp.  might be useful for other things */
 sox_ssample_t sox_gcd(sox_ssample_t a, sox_ssample_t b)
@@ -476,7 +476,7 @@
  *
  * N.B. Can only seek forwards on non-seekable streams!
  */
-int sox_seeki(ft_t ft, sox_ssize_t offset, int whence)
+int sox_seeki(sox_format_t * ft, sox_ssize_t offset, int whence)
 {
     if (ft->seekable == 0) {
         /* If a stream peel off chars else EPERM */
@@ -599,7 +599,7 @@
 10 LListB (i.e. long giving number of bytes followed by bytes) Sound Data
 */
 
-int prc_checkheader(ft_t ft, char *head)
+int prc_checkheader(sox_format_t * ft, char *head)
 {
   sox_readbuf(ft, head, sizeof(prc_header));
   return memcmp(head, prc_header, sizeof(prc_header)) == 0;
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -85,7 +85,7 @@
  * still exists in the buffer then they are first shifted to be
  * front of the stream buffer.
  */
-static int sox_mp3_input(ft_t ft)
+static int sox_mp3_input(sox_format_t * ft)
 {
     struct mp3priv *p = (struct mp3priv *) ft->priv;
     size_t bytes_read;
@@ -122,7 +122,7 @@
  * consume it all.  Returns SOX_EOF if no tag is found.  Its up to
  * caller to recover.
  * */
-static int sox_mp3_inputtag(ft_t ft)
+static int sox_mp3_inputtag(sox_format_t * ft)
 {
     struct mp3priv *p = (struct mp3priv *) ft->priv;
     int rc = SOX_EOF;
@@ -157,7 +157,7 @@
     return rc;
 }
 
-static int sox_mp3startread(ft_t ft) 
+static int sox_mp3startread(sox_format_t * ft) 
 {
     struct mp3priv *p = (struct mp3priv *) ft->priv;
     size_t ReadSize;
@@ -261,7 +261,7 @@
  * Place in buf[].
  * Return number of samples read.
  */
-static sox_size_t sox_mp3read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_mp3read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
     struct mp3priv *p = (struct mp3priv *) ft->priv;
     sox_size_t donow,i,done=0;
@@ -324,7 +324,7 @@
     return done;
 }
 
-static int sox_mp3stopread(ft_t ft)
+static int sox_mp3stopread(sox_format_t * ft)
 {
   struct mp3priv *p=(struct mp3priv*) ft->priv;
 
@@ -341,19 +341,19 @@
   return SOX_SUCCESS;
 }
 #else /*HAVE_LIBMAD*/
-static int sox_mp3startread(ft_t ft)
+static int sox_mp3startread(sox_format_t * ft)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 decoding support");
   return SOX_EOF;
 }
 
-sox_ssize_t sox_mp3read(ft_t ft, sox_sample_t *buf, sox_size_t samp)
+sox_ssize_t sox_mp3read(sox_format_t * ft, sox_sample_t *buf, sox_size_t samp)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 decoding support");
   return SOX_EOF;
 }
 
-int sox_mp3stopread(ft_t ft)
+int sox_mp3stopread(sox_format_t * ft)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 decoding support");
   return SOX_EOF;
@@ -366,7 +366,7 @@
   return;
 }
 
-static int sox_mp3startwrite(ft_t ft)
+static int sox_mp3startwrite(sox_format_t * ft)
 {
   struct mp3priv *p = (struct mp3priv *) ft->priv;
   
@@ -414,7 +414,7 @@
   return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_mp3write(ft_t ft, const sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_mp3write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t samp)
 {
     struct mp3priv *p = (struct mp3priv *)ft->priv;
     char *mp3buffer;
@@ -505,7 +505,7 @@
     return done;
 }
 
-static int sox_mp3stopwrite(ft_t ft)
+static int sox_mp3stopwrite(sox_format_t * ft)
 {
   struct mp3priv *p = (struct mp3priv *) ft->priv;
   char mp3buffer[7200];
@@ -524,19 +524,19 @@
 }
 
 #else /* HAVE_LIBMP3LAME */
-static int sox_mp3startwrite(ft_t ft UNUSED)
+static int sox_mp3startwrite(sox_format_t * ft UNUSED)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 encoding support");
   return SOX_EOF;
 }
 
-static sox_size_t sox_mp3write(ft_t ft UNUSED, const sox_sample_t *buf UNUSED, sox_size_t samp UNUSED)
+static sox_size_t sox_mp3write(sox_format_t * ft UNUSED, const sox_sample_t *buf UNUSED, sox_size_t samp UNUSED)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 encoding support");
   return 0;
 }
 
-static int sox_mp3stopwrite(ft_t ft)
+static int sox_mp3stopwrite(sox_format_t * ft)
 {
   sox_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 encoding support");
   return SOX_EOF;
@@ -550,7 +550,7 @@
   NULL,
 };
 
-static sox_format_t sox_mp3_format = {
+static sox_format_handler_t sox_mp3_format = {
   mp3names,
   0,
   sox_mp3startread,
@@ -562,9 +562,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_mp3_format_fn(void);
+const sox_format_handler_t *sox_mp3_format_fn(void);
 
-const sox_format_t *sox_mp3_format_fn(void)
+const sox_format_handler_t *sox_mp3_format_fn(void)
 {
     return &sox_mp3_format;
 }
--- a/src/nulfile.c
+++ b/src/nulfile.c
@@ -20,7 +20,7 @@
 #include "sox_i.h"
 #include <string.h>
 
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   /* If format parameters are not given, set somewhat arbitrary
    * (but commonly used) defaults: */
@@ -39,7 +39,7 @@
   return SOX_SUCCESS;
 }
 
-static sox_size_t read(ft_t ft UNUSED, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft UNUSED, sox_ssample_t *buf, sox_size_t len)
 {
   /* Reading from null generates silence i.e. (sox_sample_t)0. */
   memset(buf, 0, sizeof(sox_ssample_t) * len);
@@ -46,18 +46,18 @@
   return len; /* Return number of samples "read". */
 }
 
-static sox_size_t write(ft_t ft UNUSED, const sox_ssample_t *buf UNUSED, sox_size_t len)
+static sox_size_t write(sox_format_t * ft UNUSED, const sox_ssample_t *buf UNUSED, sox_size_t len)
 {
   /* Writing to null just discards the samples */
   return len; /* Return number of samples "written". */
 }
 
-const sox_format_t *sox_nul_format_fn(void);
+const sox_format_handler_t *sox_nul_format_fn(void);
 
-const sox_format_t *sox_nul_format_fn(void)
+const sox_format_handler_t *sox_nul_format_fn(void)
 {
   static const char *names[] = { "null", "nul"/* with -t; deprecated*/, NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, SOX_FILE_DEVICE | SOX_FILE_PHONY | SOX_FILE_NOSTDIO,
     startread, read, 0, 0, write, 0, 0
   };
--- a/src/oss.c
+++ b/src/oss.c
@@ -41,7 +41,7 @@
 #include <sys/ioctl.h>
 
 /* common r/w initialization code */
-static int ossinit(ft_t ft)
+static int ossinit(sox_format_t * ft)
 {
     int sampletype, samplesize, dsp_stereo;
     int tmp, rc;
@@ -198,7 +198,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int sox_ossstartread(ft_t ft)
+static int sox_ossstartread(sox_format_t * ft)
 {
     int rc;
     rc = ossinit(ft);
@@ -205,7 +205,7 @@
     return rc;
 }
 
-static int sox_ossstartwrite(ft_t ft)
+static int sox_ossstartwrite(sox_format_t * ft)
 {
     return ossinit(ft);
 }
@@ -217,7 +217,7 @@
   NULL
 };
 
-static sox_format_t sox_oss_format = {
+static sox_format_handler_t sox_oss_format = {
   ossnames,
   SOX_FILE_DEVICE,
   sox_ossstartread,
@@ -229,9 +229,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_oss_format_fn(void);
+const sox_format_handler_t *sox_oss_format_fn(void);
 
-const sox_format_t *sox_oss_format_fn(void)
+const sox_format_handler_t *sox_oss_format_fn(void)
 {
     return &sox_oss_format;
 }
--- a/src/prc.c
+++ b/src/prc.c
@@ -68,9 +68,9 @@
   unsigned frame_samp;     /* samples left to read in current frame */
 } *prc_t;
 
-static void prcwriteheader(ft_t ft);
+static void prcwriteheader(sox_format_t * ft);
 
-static int seek(ft_t ft, sox_size_t offset)
+static int seek(sox_format_t * ft, sox_size_t offset)
 {
   prc_t prc = (prc_t)ft->priv;
   sox_size_t new_offset, channel_block, alignment;
@@ -90,7 +90,7 @@
   return sox_seeki(ft, (sox_ssize_t)new_offset, SEEK_SET);
 }
 
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   prc_t p = (prc_t)ft->priv;
   char head[sizeof(prc_header)];
@@ -180,7 +180,7 @@
 /* Read a variable-length encoded count */
 /* Ignore return code of sox_readb, as it doesn't really matter if EOF
    is delayed until the caller. */
-static unsigned read_cardinal(ft_t ft)
+static unsigned read_cardinal(sox_format_t * ft)
 {
   unsigned a;
   uint8_t byte;
@@ -214,7 +214,7 @@
   return a;
 }
 
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t samp)
 {
   prc_t p = (prc_t)ft->priv;
 
@@ -254,7 +254,7 @@
   }
 }
 
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   prc_t p = (prc_t)ft->priv;
 
@@ -273,7 +273,7 @@
    if it is not, the unspecified size remains in the header
    (this is illegal). */
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   prc_t p = (prc_t)ft->priv;
 
@@ -313,7 +313,7 @@
   return SOX_SUCCESS;
 }
 
-static void write_cardinal(ft_t ft, unsigned a)
+static void write_cardinal(sox_format_t * ft, unsigned a)
 {
   uint8_t byte;
 
@@ -344,7 +344,7 @@
   }
 }
 
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t samp)
 {
   prc_t p = (prc_t)ft->priv;
   /* Psion Record seems not to be able to handle frames > 800 samples */
@@ -368,7 +368,7 @@
     return sox_rawwrite(ft, buf, samp);
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   prc_t p = (prc_t)ft->priv;
 
@@ -391,7 +391,7 @@
   return SOX_SUCCESS;
 }
 
-static void prcwriteheader(ft_t ft)
+static void prcwriteheader(sox_format_t * ft)
 {
   prc_t p = (prc_t)ft->priv;
 
@@ -421,7 +421,7 @@
   NULL
 };
 
-static sox_format_t sox_prc_format = {
+static sox_format_handler_t sox_prc_format = {
   prcnames,
   SOX_FILE_SEEK | SOX_FILE_LIT_END,
   startread,
@@ -433,9 +433,9 @@
   seek
 };
 
-const sox_format_t *sox_prc_format_fn(void);
+const sox_format_handler_t *sox_prc_format_fn(void);
 
-const sox_format_t *sox_prc_format_fn(void)
+const sox_format_handler_t *sox_prc_format_fn(void)
 {
   return &sox_prc_format;
 }
--- a/src/raw-fmt.c
+++ b/src/raw-fmt.c
@@ -10,16 +10,16 @@
 
 #include "sox_i.h"
  
-static int raw_start(ft_t ft) {
+static int raw_start(sox_format_t * ft) {
   return sox_rawstart(ft,sox_false,sox_false,SOX_ENCODING_UNKNOWN,-1);
 }
 
-const sox_format_t *sox_raw_format_fn(void);
+const sox_format_handler_t *sox_raw_format_fn(void);
 
-const sox_format_t *sox_raw_format_fn(void)
+const sox_format_handler_t *sox_raw_format_fn(void)
 {
   static char const * names[] = {"raw", NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, SOX_FILE_SEEK,
     raw_start, sox_rawread , sox_format_nothing,
     raw_start, sox_rawwrite, sox_format_nothing,
--- a/src/raw.c
+++ b/src/raw.c
@@ -20,7 +20,7 @@
 #define SOX_SAMPLE_TO_ULAW_BYTE(d,c) sox_14linear2ulaw(SOX_SAMPLE_TO_SIGNED_16BIT(d,c) >> 2)
 #define SOX_SAMPLE_TO_ALAW_BYTE(d,c) sox_13linear2alaw(SOX_SAMPLE_TO_SIGNED_16BIT(d,c) >> 3)
 
-int sox_rawseek(ft_t ft, sox_size_t offset)
+int sox_rawseek(sox_format_t * ft, sox_size_t offset)
 {
     sox_size_t new_offset, channel_block, alignment;
 
@@ -54,7 +54,7 @@
 
 /* Works nicely for starting read and write; sox_rawstart{read,write}
    are #defined in sox_i.h */
-int sox_rawstart(ft_t ft, sox_bool default_rate, sox_bool default_channels, sox_encoding_t encoding, int size)
+int sox_rawstart(sox_format_t * ft, sox_bool default_rate, sox_bool default_channels, sox_encoding_t encoding, int size)
 {
   if (default_rate && ft->signal.rate == 0) {
     sox_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
@@ -86,7 +86,7 @@
 
 #define READ_SAMPLES_FUNC(type, size, sign, ctype, uctype, cast) \
   sox_size_t sox_read_ ## sign ## type ## _samples( \
-      ft_t ft, sox_ssample_t *buf, sox_size_t len) \
+      sox_format_t * ft, sox_ssample_t *buf, sox_size_t len) \
   { \
     sox_size_t n, nread; \
     ctype *data = xmalloc(sizeof(ctype) * len); \
@@ -113,7 +113,7 @@
 
 #define WRITE_SAMPLES_FUNC(type, size, sign, ctype, uctype, cast) \
   sox_size_t sox_write_ ## sign ## type ## _samples( \
-      ft_t ft, sox_ssample_t *buf, sox_size_t len) \
+      sox_format_t * ft, sox_ssample_t *buf, sox_size_t len) \
   { \
     sox_size_t n, nwritten; \
     ctype *data = xmalloc(sizeof(ctype) * len); \
@@ -138,9 +138,9 @@
 static WRITE_SAMPLES_FUNC(f, sizeof(float), su, float, float, SOX_SAMPLE_TO_FLOAT_32BIT)
 static WRITE_SAMPLES_FUNC(df, sizeof(double), su, double, double, SOX_SAMPLE_TO_FLOAT_64BIT)
 
-typedef sox_size_t (ft_io_fun)(ft_t ft, sox_ssample_t *buf, sox_size_t len);
+typedef sox_size_t (ft_io_fun)(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
 
-static ft_io_fun *check_format(ft_t ft, sox_bool write)
+static ft_io_fun *check_format(sox_format_t * ft, sox_bool write)
 {
     switch (ft->signal.size) {
     case SOX_SIZE_BYTE:
@@ -212,7 +212,7 @@
 }
 
 /* Read a stream of some type into SoX's internal buffer format. */
-sox_size_t sox_rawread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp)
+sox_size_t sox_rawread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp)
 {
     ft_io_fun * read_buf = check_format(ft, sox_false);
 
@@ -223,7 +223,7 @@
 }
 
 /* Writes SoX's internal buffer format to buffer of various data types. */
-sox_size_t sox_rawwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp)
+sox_size_t sox_rawwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp)
 {
     ft_io_fun *write_buf = check_format(ft, sox_true);
 
--- a/src/raw.h
+++ b/src/raw.h
@@ -10,12 +10,12 @@
  */
 
 #define RAW_FORMAT0(id, size, flags, encoding) \
-static int id ## _start(ft_t ft) { \
+static int id ## _start(sox_format_t * ft) { \
   return sox_rawstart(ft, sox_true, sox_true, SOX_ENCODING_ ## encoding, SOX_SIZE_ ## size); \
 } \
-const sox_format_t *sox_ ## id ## _format_fn(void); \
-const sox_format_t *sox_ ## id ## _format_fn(void) { \
-  static sox_format_t handler = { \
+const sox_format_handler_t *sox_ ## id ## _format_fn(void); \
+const sox_format_handler_t *sox_ ## id ## _format_fn(void) { \
+  static sox_format_handler_t handler = { \
     names, flags, \
     id ## _start, sox_rawread , sox_format_nothing, \
     id ## _start, sox_rawwrite, sox_format_nothing, \
--- a/src/sf.c
+++ b/src/sf.c
@@ -30,7 +30,7 @@
  * Read the codes from the sound file, allocate space for the comment and
  * assign its pointer to the comment field in ft.
  */
-static void readcodes(ft_t ft, SFHEADER *sfhead)
+static void readcodes(sox_format_t * ft, SFHEADER *sfhead)
 {
         char *commentbuf = NULL, *sfcharp, *newline;
         sox_size_t bsize;
@@ -64,7 +64,7 @@
                 ft->comment = commentbuf;
 }
 
-static int sox_sfseek(ft_t ft, sox_size_t offset)
+static int sox_sfseek(sox_format_t * ft, sox_size_t offset)
 {
     sox_size_t new_offset, channel_block, alignment;
 
@@ -91,7 +91,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int sox_sfstartread(ft_t ft)
+static int sox_sfstartread(sox_format_t * ft)
 {
         sf_t sf = (sf_t) ft->priv;
         SFHEADER sfhead;
@@ -159,7 +159,7 @@
         return(rc);
 }
 
-static int sox_sfstartwrite(ft_t ft)
+static int sox_sfstartwrite(sox_format_t * ft)
 {
         sf_t sf = (sf_t) ft->priv;
         SFHEADER sfhead;
@@ -225,7 +225,7 @@
   NULL
 };
 
-static sox_format_t sox_sf_format = {
+static sox_format_handler_t sox_sf_format = {
   sfnames,
   SOX_FILE_SEEK,
   sox_sfstartread,
@@ -237,9 +237,9 @@
   sox_sfseek
 };
 
-const sox_format_t *sox_sf_format_fn(void);
+const sox_format_handler_t *sox_sf_format_fn(void);
 
-const sox_format_t *sox_sf_format_fn(void)
+const sox_format_handler_t *sox_sf_format_fn(void)
 {
     return &sox_sf_format;
 }
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -41,7 +41,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   skelform_t sk = (skelform_t)ft->priv;
   sox_size_t samples_in_file;
@@ -84,7 +84,7 @@
  * Read up to len samples of type sox_sample_t from file into buf[].
  * Return number of samples read, or 0 if at end of file.
  */
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
   skelform_t sk = (skelform_t)ft->priv;
   sox_size_t done;
@@ -118,12 +118,12 @@
  * Do anything required when you stop reading samples.
  * Don't close input file!
  */
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   return SOX_SUCCESS;
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   skelform_t sk = (skelform_t)ft->priv;
 
@@ -159,7 +159,7 @@
  * Write len samples of type sox_sample_t from buf[] to file.
  * Return number of samples written.
  */
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   skelform_t sk = (skelform_t)ft->priv;
 
@@ -186,7 +186,7 @@
   return len;
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   /* All samples are already written out. */
   /* If file header needs fixing up, for example it needs the number
@@ -194,7 +194,7 @@
   return SOX_SUCCESS;
 }
 
-static int seek(ft_t ft, sox_size_t offset)
+static int seek(sox_format_t * ft, sox_size_t offset)
 {
   /* Seek relative to current position. */
   return SOX_SUCCESS;
@@ -211,7 +211,7 @@
  * the 7 functions, then the function above can be deleted
  * and 0 used in place of the its name below.
  */
-static sox_format_t sox_skel_format = {
+static sox_format_handler_t sox_skel_format = {
   names,
   SOX_FILE_SEEK,
   startread,
@@ -223,9 +223,9 @@
   seek
 };
 
-const sox_format_t *sox_skel_format_fn(void);
+const sox_format_handler_t *sox_skel_format_fn(void);
 
-const sox_format_t *sox_skel_format_fn(void)
+const sox_format_handler_t *sox_skel_format_fn(void)
 {
   return &sox_skel_format;
 }
--- a/src/smp.c
+++ b/src/smp.c
@@ -73,7 +73,7 @@
  * Read the SampleVision trailer structure.
  * Returns 1 if everything was read ok, 0 if there was an error.
  */
-static int readtrailer(ft_t ft, struct smptrailer *trailer)
+static int readtrailer(sox_format_t * ft, struct smptrailer *trailer)
 {
         int i;
         int16_t trash16;
@@ -109,7 +109,7 @@
 /*
  * set the trailer data - loops and markers, to reasonably benign values
  */
-static void settrailer(ft_t ft, struct smptrailer *trailer, sox_rate_t rate)
+static void settrailer(sox_format_t * ft, struct smptrailer *trailer, sox_rate_t rate)
 {
         int i;
 
@@ -143,7 +143,7 @@
  * Write the SampleVision trailer structure.
  * Returns 1 if everything was written ok, 0 if there was an error.
  */
-static int writetrailer(ft_t ft, struct smptrailer *trailer)
+static int writetrailer(sox_format_t * ft, struct smptrailer *trailer)
 {
         int i;
 
@@ -169,7 +169,7 @@
         return(SOX_SUCCESS);
 }
 
-static int sox_smpseek(ft_t ft, sox_size_t offset) 
+static int sox_smpseek(sox_format_t * ft, sox_size_t offset) 
 {
     sox_size_t new_offset, channel_block, alignment;
     smp_t smp = (smp_t) ft->priv;
@@ -200,7 +200,7 @@
  *      size and encoding of samples, 
  *      mono/stereo/quad.
  */
-static int sox_smpstartread(ft_t ft) 
+static int sox_smpstartread(sox_format_t * ft) 
 {
         smp_t smp = (smp_t) ft->priv;
         int namelen, commentlen;
@@ -318,7 +318,7 @@
  * Place in buf[].
  * Return number of samples read.
  */
-static sox_size_t sox_smpread(ft_t ft, sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_smpread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len) 
 {
         smp_t smp = (smp_t) ft->priv;
         unsigned short datum;
@@ -332,7 +332,7 @@
         return done;
 }
 
-static int sox_smpstartwrite(ft_t ft) 
+static int sox_smpstartwrite(sox_format_t * ft) 
 {
         smp_t smp = (smp_t) ft->priv;
         struct smpheader header;
@@ -366,7 +366,7 @@
         return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_smpwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_smpwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len) 
 {
         smp_t smp = (smp_t) ft->priv;
         int datum;
@@ -382,7 +382,7 @@
         return(done);
 }
 
-static int sox_smpstopwrite(ft_t ft) 
+static int sox_smpstopwrite(sox_format_t * ft) 
 {
         smp_t smp = (smp_t) ft->priv;
         struct smptrailer trailer;
@@ -406,7 +406,7 @@
   NULL,
 };
 
-static sox_format_t sox_smp_format = {
+static sox_format_handler_t sox_smp_format = {
   smpnames,
   SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_LIT_END,
   sox_smpstartread,
@@ -418,9 +418,9 @@
   sox_smpseek
 };
 
-const sox_format_t *sox_smp_format_fn(void);
+const sox_format_handler_t *sox_smp_format_fn(void);
 
-const sox_format_t *sox_smp_format_fn(void)
+const sox_format_handler_t *sox_smp_format_fn(void)
 {
     return &sox_smp_format;
 }
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -108,7 +108,7 @@
 /*
  * Open file in sndfile.
  */
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
 
@@ -135,7 +135,7 @@
  * Read up to len samples of type sox_sample_t from file into buf[].
  * Return number of samples read.
  */
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
 
@@ -146,7 +146,7 @@
 /*
  * Close file for libsndfile (this doesn't close the file handle)
  */
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
   sf_close(sf->sf_file);
@@ -270,7 +270,7 @@
   }
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
   int subtype = sndfile_format(ft->signal.encoding, ft->signal.size);
@@ -321,7 +321,7 @@
  * Write len samples of type sox_sample_t from buf[] to file.
  * Return number of samples written.
  */
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
 
@@ -332,7 +332,7 @@
 /*
  * Close file for libsndfile (this doesn't close the file handle)
  */
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
   sf_close(sf->sf_file);
@@ -339,7 +339,7 @@
   return SOX_SUCCESS;
 }
 
-static int seek(ft_t ft, sox_size_t offset)
+static int seek(sox_format_t * ft, sox_size_t offset)
 {
   sndfile_t sf = (sndfile_t)ft->priv;
   sf_seek(sf->sf_file, (sf_count_t)(offset / ft->signal.channels), SEEK_CUR);
@@ -380,7 +380,7 @@
 };
 
 /* Format descriptor */
-static sox_format_t format = {
+static sox_format_handler_t format = {
   names,
   SOX_FILE_SEEK | SOX_FILE_NOSTDIO,
   startread,
@@ -392,9 +392,9 @@
   seek
 };
 
-const sox_format_t *sox_sndfile_format_fn(void);
+const sox_format_handler_t *sox_sndfile_format_fn(void);
 
-const sox_format_t *sox_sndfile_format_fn(void)
+const sox_format_handler_t *sox_sndfile_format_fn(void)
 {
   return &format;
 }
--- a/src/sndrtool.c
+++ b/src/sndrtool.c
@@ -20,7 +20,7 @@
         sox_size_t dataStart;
 } *snd_t;
 
-static void sndtwriteheader(ft_t ft, sox_size_t nsamples)
+static void sndtwriteheader(sox_format_t * ft, sox_size_t nsamples)
 {
     char name_buf[97];
 
@@ -40,7 +40,7 @@
     sox_writebuf(ft, name_buf, 96);
 }
 
-static int sox_sndseek(ft_t ft, sox_size_t offset) 
+static int sox_sndseek(sox_format_t * ft, sox_size_t offset) 
 {
     sox_size_t new_offset, channel_block, alignment;
     snd_t snd = (snd_t ) ft->priv;
@@ -60,7 +60,7 @@
     return sox_seeki(ft, (sox_ssize_t)new_offset, SEEK_SET);
 }
 
-static int sox_sndtstartread(ft_t ft)
+static int sox_sndtstartread(sox_format_t * ft)
 {
         snd_t snd = (snd_t ) ft->priv;
 
@@ -129,7 +129,7 @@
         return (SOX_SUCCESS);
 }
 
-static int sox_sndtstartwrite(ft_t ft)
+static int sox_sndtstartwrite(sox_format_t * ft)
 {
         snd_t p = (snd_t ) ft->priv;
         int rc;
@@ -149,7 +149,7 @@
         return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_sndtwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_sndtwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
         snd_t p = (snd_t ) ft->priv;
         p->nsamples += len;
@@ -156,7 +156,7 @@
         return sox_rawwrite(ft, buf, len);
 }
 
-static int sox_sndtstopwrite(ft_t ft)
+static int sox_sndtstopwrite(sox_format_t * ft)
 {
         snd_t p = (snd_t ) ft->priv;
         int rc;
@@ -184,7 +184,7 @@
   NULL
 };
 
-static const sox_format_t sox_snd_format = {
+static const sox_format_handler_t sox_snd_format = {
   sndtnames,
   SOX_FILE_SEEK | SOX_FILE_LIT_END,
   sox_sndtstartread,
@@ -196,9 +196,9 @@
   sox_sndseek
 };
 
-const sox_format_t *sox_sndrtool_format_fn(void);
+const sox_format_handler_t *sox_sndrtool_format_fn(void);
 
-const sox_format_t *sox_sndrtool_format_fn(void)
+const sox_format_handler_t *sox_sndrtool_format_fn(void)
 {
     return &sox_snd_format;
 }
--- a/src/sox.c
+++ b/src/sox.c
@@ -102,7 +102,7 @@
   double replay_gain;
   char *comment;
   sox_size_t volume_clips;
-  ft_t desc;                              /* libSoX file descriptor */
+  sox_format_t * ft;                           /* libSoX file descriptor */
 } *file_t;
 
 /* local forward declarations */
@@ -171,27 +171,27 @@
 
   /* Close the input and output files before exiting. */
   for (i = 0; i < input_count; i++) {
-    if (files[i]->desc) {
-      sox_close(files[i]->desc);
-      free(files[i]->desc);
+    if (files[i]->ft) {
+      sox_close(files[i]->ft);
+      free(files[i]->ft);
     }
     free(files[i]);
   }
 
   if (file_count) {
-    if (ofile->desc) {
-      if (!(ofile->desc->h->flags & SOX_FILE_NOSTDIO)) {
+    if (ofile->ft) {
+      if (!(ofile->ft->handler->flags & SOX_FILE_NOSTDIO)) {
         struct stat st;
-        fstat(fileno(ofile->desc->fp), &st);
+        fstat(fileno(ofile->ft->fp), &st);
 
         /* If we didn't succeed and we created an output file, remove it. */
         if (!success && (st.st_mode & S_IFMT) == S_IFREG)
-          unlink(ofile->desc->filename);
+          unlink(ofile->ft->filename);
       }
 
       /* Assumption: we can unlink a file before sox_closing it. */
-      sox_close(ofile->desc);
-      free(ofile->desc);
+      sox_close(ofile->ft);
+      free(ofile->ft);
     }
     free(ofile);
   }
@@ -551,8 +551,8 @@
 
     if (rec && !j) { /* Set the recording sample rate & # of channels: */
       if (input_count > 1) {   /* Get them from the next input file: */
-        f->signal.rate = files[1]->desc->signal.rate;
-        f->signal.channels = files[1]->desc->signal.channels;
+        f->signal.rate = files[1]->ft->signal.rate;
+        f->signal.channels = files[1]->ft->signal.channels;
       }
       else { /* Get them from the output file (which is not open yet): */
         f->signal.rate = files[1]->signal.rate;
@@ -559,17 +559,17 @@
         f->signal.channels = files[1]->signal.channels;
       }
     }
-    files[j]->desc = sox_open_read(f->filename, &f->signal, f->filetype);
-    if (!files[j]->desc)
+    files[j]->ft = sox_open_read(f->filename, &f->signal, f->filetype);
+    if (!files[j]->ft)
       /* sox_open_read() will call sox_warn for most errors.
        * Rely on that printing something. */
       exit(2);
     if (show_progress == SOX_OPTION_DEFAULT &&
-        (files[j]->desc->h->flags & SOX_FILE_DEVICE) != 0 &&
-        (files[j]->desc->h->flags & SOX_FILE_PHONY) == 0)
+        (files[j]->ft->handler->flags & SOX_FILE_DEVICE) != 0 &&
+        (files[j]->ft->handler->flags & SOX_FILE_PHONY) == 0)
       show_progress = SOX_OPTION_YES;
-    if (files[j]->desc->comment)
-      set_replay_gain(files[j]->desc->comment, f);
+    if (files[j]->ft->comment)
+      set_replay_gain(files[j]->ft->comment, f);
   }
   signal(SIGINT, SIG_DFL);
 
@@ -586,10 +586,10 @@
 
   for (i = 0; i < input_count; i++) {
     unsigned j;
-    for (j =0; j < nuser_effects && !files[i]->desc->signal.channels; ++j)
-      files[i]->desc->signal.channels = user_efftab[j].ininfo.channels;
-    if (!files[i]->desc->signal.channels)
-      ++files[i]->desc->signal.channels;
+    for (j =0; j < nuser_effects && !files[i]->ft->signal.channels; ++j)
+      files[i]->ft->signal.channels = user_efftab[j].ininfo.channels;
+    if (!files[i]->ft->signal.channels)
+      ++files[i]->ft->signal.channels;
   }
 
   if (repeatable_random)
@@ -603,9 +603,9 @@
 
   ofile_signal = ofile->signal;
   if (combine_method == sox_sequence) do {
-    if (ofile->desc)
-      sox_close(ofile->desc);
-    free(ofile->desc);
+    if (ofile->ft)
+      sox_close(ofile->ft);
+    free(ofile->ft);
   } while (process() != SOX_EOF && !user_abort && current_input < input_count);
   else process();
 
@@ -613,12 +613,12 @@
     user_efftab[nuser_effects].handler.kill(&user_efftab[nuser_effects]);
 
   for (i = 0; i < file_count; ++i)
-    if (files[i]->desc->clips != 0)
+    if (files[i]->ft->clips != 0)
       sox_warn(i < input_count?"%s: input clipped %u samples" :
                               "%s: output clipped %u samples; decrease volume?",
-          (files[i]->desc->h->flags & SOX_FILE_DEVICE)?
-                       files[i]->desc->h->names[0] : files[i]->desc->filename,
-          files[i]->desc->clips);
+          (files[i]->ft->handler->flags & SOX_FILE_DEVICE)?
+                       files[i]->ft->handler->names[0] : files[i]->ft->filename,
+          files[i]->ft->clips);
 
   if (mixing_clips > 0)
     sox_warn("mix-combining clipped %u samples; decrease volume?", mixing_clips);
@@ -761,10 +761,10 @@
    * gigs of audio data into managable chunks
    */ 
   if (input_count == 1 && sox_neffects > 1 && strcmp(sox_effects[1][0].handler.name, "trim") == 0) {
-    if ((files[0]->desc->h->flags & SOX_FILE_SEEK) && files[0]->desc->seekable){
+    if ((files[0]->ft->handler->flags & SOX_FILE_SEEK) && files[0]->ft->seekable){
       sox_size_t offset = sox_trim_get_start(&sox_effects[1][0]);
-      if (sox_seek(files[0]->desc, offset, SOX_SEEK_SET) != SOX_EOF) { 
-        read_wide_samples = offset / files[0]->desc->signal.channels;
+      if (sox_seek(files[0]->ft, offset, SOX_SEEK_SET) != SOX_EOF) { 
+        read_wide_samples = offset / files[0]->ft->signal.channels;
         /* Assuming a failed seek stayed where it was.  If the 
          * seek worked then reset the start location of 
          * trim so that it thinks user didn't request a skip.
@@ -965,44 +965,44 @@
   static char const * const no_yes[] = {"no", "yes"};
 
   fprintf(stderr, "\n%s: '%s'",
-    f->desc->mode == 'r'? "Input File     " : "Output File    ", f->desc->filename);
-  if (strcmp(f->desc->filename, "-") == 0 || (f->desc->h->flags & SOX_FILE_DEVICE))
-    fprintf(stderr, " (%s)", f->desc->h->names[0]);
+    f->ft->mode == 'r'? "Input File     " : "Output File    ", f->ft->filename);
+  if (strcmp(f->ft->filename, "-") == 0 || (f->ft->handler->flags & SOX_FILE_DEVICE))
+    fprintf(stderr, " (%s)", f->ft->handler->names[0]);
   fprintf(stderr, "\n");
 
-  if (f->desc->signal.size)
+  if (f->ft->signal.size)
     fprintf(stderr, "Sample Size    : %s (%s)\n",
-        sox_size_bits_str[f->desc->signal.size],
-        sox_sizes_str[f->desc->signal.size]);
+        sox_size_bits_str[f->ft->signal.size],
+        sox_sizes_str[f->ft->signal.size]);
 
-  if (f->desc->signal.encoding)
+  if (f->ft->signal.encoding)
     fprintf(stderr, "Sample Encoding: %s\n",
-        sox_encodings_str[f->desc->signal.encoding]);
+        sox_encodings_str[f->ft->signal.encoding]);
 
   fprintf(stderr,
     "Channels       : %u\n"
     "Sample Rate    : %u\n",
-    f->desc->signal.channels,
-    f->desc->signal.rate);
+    f->ft->signal.channels,
+    f->ft->signal.rate);
 
   if (full) {
-    if (f->desc->length && f->desc->signal.channels && f->desc->signal.rate) {
-      sox_size_t ws = f->desc->length / f->desc->signal.channels;
+    if (f->ft->length && f->ft->signal.channels && f->ft->signal.rate) {
+      sox_size_t ws = f->ft->length / f->ft->signal.channels;
       fprintf(stderr,
         "Duration       : %s = %u samples %c %g CDDA sectors\n",
-        str_time((double)ws / f->desc->signal.rate),
-        ws, "~="[f->desc->signal.rate == 44100],
-        (double)ws/ f->desc->signal.rate * 44100 / 588);
+        str_time((double)ws / f->ft->signal.rate),
+        ws, "~="[f->ft->signal.rate == 44100],
+        (double)ws/ f->ft->signal.rate * 44100 / 588);
     }
-    if (f->desc->signal.size > 1)
+    if (f->ft->signal.size > 1)
       fprintf(stderr, "Endian Type    : %s\n",
-          f->desc->signal.reverse_bytes != SOX_IS_BIGENDIAN ? "big" : "little");
-    if (f->desc->signal.size)
+          f->ft->signal.reverse_bytes != SOX_IS_BIGENDIAN ? "big" : "little");
+    if (f->ft->signal.size)
       fprintf(stderr,
         "Reverse Nibbles: %s\n"
         "Reverse Bits   : %s\n",
-        no_yes[f->desc->signal.reverse_nibbles],
-        no_yes[f->desc->signal.reverse_bits]);
+        no_yes[f->ft->signal.reverse_nibbles],
+        no_yes[f->ft->signal.reverse_bits]);
   }
 
   if (f->replay_gain != HUGE_VAL)
@@ -1010,11 +1010,11 @@
   if (f->volume != HUGE_VAL)
     fprintf(stderr, "Level adjust   : %g (linear gain)\n" , f->volume);
 
-  if (!(f->desc->h->flags & SOX_FILE_DEVICE) && f->desc->comment) {
-    if (strchr(f->desc->comment, '\n'))
-      fprintf(stderr, "Comments       : \n%s\n", f->desc->comment);
+  if (!(f->ft->handler->flags & SOX_FILE_DEVICE) && f->ft->comment) {
+    if (strchr(f->ft->comment, '\n'))
+      fprintf(stderr, "Comments       : \n%s\n", f->ft->comment);
     else
-      fprintf(stderr, "Comment        : '%s'\n", f->desc->comment);
+      fprintf(stderr, "Comment        : '%s'\n", f->ft->comment);
   }
   fprintf(stderr, "\n");
 }
@@ -1032,7 +1032,7 @@
     fprintf(stderr, "Skipped.\n");
   }
   read_wide_samples = 0;
-  input_wide_samples = f->desc->length / f->desc->signal.channels;
+  input_wide_samples = f->ft->length / f->ft->signal.channels;
   if (show_progress && (sox_output_verbosity_level < 3 ||
                         (combine_method <= sox_concatenate && input_count > 1)))
     display_file_info(f, sox_false);
@@ -1040,7 +1040,7 @@
     f->volume = 1;
   if (f->replay_gain != HUGE_VAL)
     f->volume *= pow(10.0, f->replay_gain / 20);
-  f->desc->sox_errno = errno = 0;
+  f->ft->sox_errno = errno = 0;
 }
 
 static sox_bool since(struct timeval * then, double secs, sox_bool always_reset)
@@ -1068,22 +1068,22 @@
 static sox_bool can_segue(sox_size_t i)
 {
   return
-    files[i]->desc->signal.channels == files[i - 1]->desc->signal.channels &&
-    files[i]->desc->signal.rate     == files[i - 1]->desc->signal.rate;
+    files[i]->ft->signal.channels == files[i - 1]->ft->signal.channels &&
+    files[i]->ft->signal.rate     == files[i - 1]->ft->signal.rate;
 }
 
-static sox_size_t sox_read_wide(ft_t desc, sox_ssample_t * buf, sox_size_t max)
+static sox_size_t sox_read_wide(sox_format_t * ft, sox_ssample_t * buf, sox_size_t max)
 {
   sox_size_t len = max / combiner.channels;
-  len = sox_read(desc, buf, len * desc->signal.channels) / desc->signal.channels;
-  if (!len && desc->sox_errno)
-    sox_fail("%s: %s (%s)", desc->filename, desc->sox_errstr, strerror(desc->sox_errno));
+  len = sox_read(ft, buf, len * ft->signal.channels) / ft->signal.channels;
+  if (!len && ft->sox_errno)
+    sox_fail("%s: %s (%s)", ft->filename, ft->sox_errstr, strerror(ft->sox_errno));
   return len;
 }
 
 static void balance_input(sox_ssample_t * buf, sox_size_t ws, file_t f)
 {
-  sox_size_t s = ws * f->desc->signal.channels;
+  sox_size_t s = ws * f->ft->signal.channels;
 
   if (f->volume != 1)
     while (s--) {
@@ -1128,7 +1128,7 @@
 
   if (combine_method <= sox_concatenate) while (sox_true) {
     if (!user_skip)
-      olen = sox_read_wide(files[current_input]->desc, obuf, *osamp);
+      olen = sox_read_wide(files[current_input]->ft, obuf, *osamp);
     if (olen == 0) {   /* If EOF, go to the next input file. */
       if (++current_input < input_count) {
         if (combine_method == sox_sequence && !can_segue(current_input))
@@ -1142,7 +1142,7 @@
   } else {
     sox_ssample_t * p = obuf;
     for (i = 0; i < input_count; ++i) {
-      ilen[i] = sox_read_wide(files[i]->desc, z->ibuf[i], *osamp);
+      ilen[i] = sox_read_wide(files[i]->ft, z->ibuf[i], *osamp);
       balance_input(z->ibuf[i], ilen[i], files[i]);
       olen = max(olen, ilen[i]);
     }
@@ -1151,16 +1151,16 @@
         for (s = 0; s < effp->ininfo.channels; ++s, ++p) {
           *p = 0;
           for (i = 0; i < input_count; ++i)
-            if (ws < ilen[i] && s < files[i]->desc->signal.channels) {
+            if (ws < ilen[i] && s < files[i]->ft->signal.channels) {
               /* Cast to double prevents integer overflow */
-              double sample = *p + (double)z->ibuf[i][ws * files[i]->desc->signal.channels + s];
+              double sample = *p + (double)z->ibuf[i][ws * files[i]->ft->signal.channels + s];
               *p = SOX_ROUND_CLIP_COUNT(sample, mixing_clips);
           }
         }
       } else { /* sox_merge: like a multi-track recorder */
         for (i = 0; i < input_count; ++i)
-          for (s = 0; s < files[i]->desc->signal.channels; ++s)
-            *p++ = (ws < ilen[i]) * z->ibuf[i][ws * files[i]->desc->signal.channels + s];
+          for (s = 0; s < files[i]->ft->signal.channels; ++s)
+            *p++ = (ws < ilen[i]) * z->ibuf[i][ws * files[i]->ft->signal.channels + s];
     }
   }
   read_wide_samples += olen;
@@ -1196,15 +1196,15 @@
 {
   size_t len;
   for (*osamp = *isamp; *osamp; ibuf += len, *osamp -= len) {
-    len = sox_write(ofile->desc, ibuf, *osamp);
+    len = sox_write(ofile->ft, ibuf, *osamp);
     if (len == 0) {
-      sox_warn("Error writing: %s", ofile->desc->sox_errstr);
+      sox_warn("Error writing: %s", ofile->ft->sox_errstr);
       return SOX_EOF;
     }
     if (user_abort) /* Don't get stuck in this loop. */
       return SOX_EOF;
   }
-  output_samples += *isamp / ofile->desc->signal.channels;
+  output_samples += *isamp / ofile->ft->signal.channels;
   return SOX_SUCCESS;
 }
 
@@ -1224,7 +1224,7 @@
   sox_create_effect(&e, sox_find_effect(name));
   if (e.handler.getopts(&e, 0, NULL) == SOX_EOF)  /* Set up with default opts */
     exit(2);
-  sox_add_effect(&e, &combiner, &ofile->desc->signal, effects_mask);
+  sox_add_effect(&e, &combiner, &ofile->ft->signal, effects_mask);
 }
 
 /* If needed effects are not given, auto-add at (performance) optimal point. */
@@ -1232,8 +1232,8 @@
 {
   unsigned i;
   int effects_mask = 0;
-  sox_bool need_rate = combiner.rate     != ofile->desc->signal.rate;
-  sox_bool need_chan = combiner.channels != ofile->desc->signal.channels;
+  sox_bool need_rate = combiner.rate     != ofile->ft->signal.rate;
+  sox_bool need_chan = combiner.channels != ofile->ft->signal.channels;
   int user_mchan = -1;
   sox_effect_t eff;
 
@@ -1265,12 +1265,12 @@
   }
 
   sox_create_effect(&eff, input_combiner_effect_fn());
-  sox_add_effect(&eff, &combiner, &ofile->desc->signal, &effects_mask);
+  sox_add_effect(&eff, &combiner, &ofile->ft->signal, &effects_mask);
 
   /* Copy user specified effects into the real effects */
   for (i = 0; i <= nuser_effects; i++) {
     /* If reducing channels, it's faster to do so before all other effects: */
-    if ((int)i > user_mchan && need_chan && combiner.channels > ofile->desc->signal.channels) {
+    if ((int)i > user_mchan && need_chan && combiner.channels > ofile->ft->signal.channels) {
       add_default_effect("mixer", &effects_mask);
       need_chan = sox_false;
     }
@@ -1277,18 +1277,18 @@
     /* If reducing rate, it's faster to do so before all other effects
      * (except reducing channels): */
     if (need_rate)
-      if (i == nuser_effects || combiner.rate > ofile->desc->signal.rate) {
+      if (i == nuser_effects || combiner.rate > ofile->ft->signal.rate) {
         add_default_effect("resample", &effects_mask);
         need_rate = sox_false;
       }
     if (i < nuser_effects)
-      sox_add_effect(&user_efftab[i], &combiner, &ofile->desc->signal, &effects_mask);
+      sox_add_effect(&user_efftab[i], &combiner, &ofile->ft->signal, &effects_mask);
   }
   if (need_chan)
     add_default_effect("mixer", &effects_mask);
 
   sox_create_effect(&eff, output_effect_fn());
-  sox_add_effect(&eff, &combiner, &ofile->desc->signal, &effects_mask);
+  sox_add_effect(&eff, &combiner, &ofile->ft->signal, &effects_mask);
 }
 
 static void open_output_file(sox_size_t olen)
@@ -1299,7 +1299,7 @@
   char const *comment = NULL;
 
   if (ofile->comment == NULL)
-    comment = files[0]->desc->comment ? files[0]->desc->comment : "Processed by SoX";
+    comment = files[0]->ft->comment ? files[0]->ft->comment : "Processed by SoX";
   else if (*ofile->comment != '\0')
       comment = ofile->comment;
 
@@ -1311,22 +1311,22 @@
    */
   factor = (double) ofile->signal.rate / combiner.rate;
   for (i = 0; i < SOX_MAX_NLOOPS; i++) {
-    loops[i].start = files[0]->desc->loops[i].start * factor;
-    loops[i].length = files[0]->desc->loops[i].length * factor;
-    loops[i].count = files[0]->desc->loops[i].count;
-    loops[i].type = files[0]->desc->loops[i].type;
+    loops[i].start = files[0]->ft->loops[i].start * factor;
+    loops[i].length = files[0]->ft->loops[i].length * factor;
+    loops[i].count = files[0]->ft->loops[i].count;
+    loops[i].type = files[0]->ft->loops[i].type;
   }
 
-  ofile->desc = sox_open_write(overwrite_permitted,
+  ofile->ft = sox_open_write(overwrite_permitted,
                         ofile->filename,
                         &ofile->signal,
                         ofile->filetype,
                         comment,
                         olen,
-                        &files[0]->desc->instr,
+                        &files[0]->ft->instr,
                         loops);
 
-  if (!ofile->desc)
+  if (!ofile->ft)
     /* sox_open_write() will call sox_warn for most errors.
      * Rely on that printing something. */
     exit(2);
@@ -1335,8 +1335,8 @@
    * progress display to match behavior of ogg123,
    * unless the user requested us not to display anything. */
   if (show_progress == SOX_OPTION_DEFAULT)
-    show_progress = (ofile->desc->h->flags & SOX_FILE_DEVICE) != 0 &&
-                    (ofile->desc->h->flags & SOX_FILE_PHONY) == 0;
+    show_progress = (ofile->ft->handler->flags & SOX_FILE_DEVICE) != 0 &&
+                    (ofile->ft->handler->flags & SOX_FILE_PHONY) == 0;
 
   report_file_info(ofile);
 }
@@ -1357,7 +1357,7 @@
   sox_bool known_length = combine_method != sox_sequence;
   sox_size_t olen = 0;
 
-  combiner = files[current_input]->desc->signal;
+  combiner = files[current_input]->ft->signal;
   if (combine_method == sox_sequence) {
     if (!current_input) for (i = 0; i < input_count; i++)
       report_file_info(files[i]);
@@ -1370,16 +1370,16 @@
 
     for (i = 0; i < input_count; i++) { /* Report all inputs, then check */
       report_file_info(files[i]);
-      total_channels += files[i]->desc->signal.channels;
-      min_channels = min(min_channels, files[i]->desc->signal.channels);
-      max_channels = max(max_channels, files[i]->desc->signal.channels);
-      min_rate = min(min_rate, files[i]->desc->signal.rate);
-      max_rate = max(max_rate, files[i]->desc->signal.rate);
-      known_length = known_length && files[i]->desc->length != 0;
+      total_channels += files[i]->ft->signal.channels;
+      min_channels = min(min_channels, files[i]->ft->signal.channels);
+      max_channels = max(max_channels, files[i]->ft->signal.channels);
+      min_rate = min(min_rate, files[i]->ft->signal.rate);
+      max_rate = max(max_rate, files[i]->ft->signal.rate);
+      known_length = known_length && files[i]->ft->length != 0;
       if (combine_method == sox_concatenate)
-        olen += files[i]->desc->length;
+        olen += files[i]->ft->length;
       else
-        olen = max(olen, files[i]->desc->length);
+        olen = max(olen, files[i]->ft->length);
     }
     if (min_rate != max_rate)
       sox_fail("Input files must have the same sample-rate");
@@ -1438,7 +1438,7 @@
   unsigned i, f;
   sox_size_t clips = 0;
   for (i = 0; i < file_count; ++i)
-    clips += files[i]->desc->clips + files[i]->volume_clips;
+    clips += files[i]->ft->clips + files[i]->volume_clips;
   clips += mixing_clips;
   for (i = 1; i < sox_neffects - 1; ++i)
     for (f = 1; f < sox_effects[i][0].flows; ++f)
--- a/src/sox.h
+++ b/src/sox.h
@@ -17,6 +17,13 @@
 #include <limits.h>
 #include "soxstdint.h"
 
+/* Avoid warnings about unused parameters. */
+#ifdef __GNUC__
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
+
 /* The following is the API version of libSoX.  It is not meant
  * to follow the version number of SoX but it has historically.
  * Please do not count on these numbers being in sync.
@@ -25,13 +32,23 @@
 #define SOX_LIB_VERSION_CODE 0x0d0000
 #define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 
-/* Avoid warnings about unused parameters. */
-#ifdef __GNUC__
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif
+const char *sox_version(void);   /* Returns version number */
 
+extern char const * sox_message_filename;
+
+#define SOX_SUCCESS 0
+#define SOX_EOF (-1)             /* End Of File or other error */
+
+/* libSoX specific error codes.  The rest directly map from errno. */
+#define SOX_EHDR 2000            /* Invalid Audio Header */
+#define SOX_EFMT 2001            /* Unsupported data format */
+#define SOX_ERATE 2002           /* Unsupported rate for format */
+#define SOX_ENOMEM 2003          /* Can't alloc memory */
+#define SOX_EPERM 2004           /* Operation not permitted */
+#define SOX_ENOTSUP 2005         /* Operation not supported */
+#define SOX_EINVAL 2006          /* Invalid argument */
+#define SOX_EFFMT 2007           /* Unsupported file format */
+
 /* Boolean type, assignment (but not necessarily binary) compatible with
  * C++ bool */
 typedef enum {sox_false, sox_true} sox_bool;
@@ -196,13 +213,6 @@
 
 typedef enum {sox_plot_off, sox_plot_octave, sox_plot_gnuplot} sox_plot_t;
 
-typedef struct sox_effects_global_info /* Global parameters (for effects) */
-{
-  sox_plot_t plot;         /* To help the user choose effect & options */
-  double speed;            /* Gather up all speed changes here, then resample */
-  sox_global_info_t * global_info;
-} sox_effects_global_info_t;
-
 typedef struct sox_formats_global_info /* Global parameters (for formats) */
 {
   sox_global_info_t * global_info;
@@ -280,55 +290,49 @@
 
 
 /*
- *  Format information for input and output files.
+ * Handler structure for each format.
  */
 
-#define SOX_MAX_FILE_PRIVSIZE    1000
-#define SOX_MAX_EFFECT_PRIVSIZE 1000
+typedef struct sox_format sox_format_t;
 
-#define SOX_MAX_NLOOPS           8
+typedef struct {
+    const char   * const *names;
+    unsigned int flags;
+    int          (*startread)(sox_format_t * ft);
+    sox_size_t    (*read)(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
+    int          (*stopread)(sox_format_t * ft);
+    int          (*startwrite)(sox_format_t * ft);
+    sox_size_t    (*write)(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len);
+    int          (*stopwrite)(sox_format_t * ft);
+    int          (*seek)(sox_format_t * ft, sox_size_t offset);
+} sox_format_handler_t;
 
 /*
- * Handler structure for each format.
+ *  Format information for input and output files.
  */
 
-typedef struct sox_soundstream *ft_t;
+#define SOX_MAX_FILE_PRIVSIZE    1000
+#define SOX_MAX_NLOOPS           8
 
-typedef struct sox_format {
-    const char   * const *names;
-    unsigned int flags;
-    int          (*startread)(ft_t ft);
-    sox_size_t    (*read)(ft_t ft, sox_ssample_t *buf, sox_size_t len);
-    int          (*stopread)(ft_t ft);
-    int          (*startwrite)(ft_t ft);
-    sox_size_t    (*write)(ft_t ft, const sox_ssample_t *buf, sox_size_t len);
-    int          (*stopwrite)(ft_t ft);
-    int          (*seek)(ft_t ft, sox_size_t offset);
-} sox_format_t;
+struct sox_format {
+  /* Placing priv at the start of this structure ensures that it gets aligned
+   * in memory in the optimal way for any structure to be cast over it. */
+  char   priv[SOX_MAX_FILE_PRIVSIZE];    /* format's private data area */
 
-struct sox_soundstream {
-    sox_signalinfo_t signal;               /* signal specifications */
-    sox_instrinfo_t  instr;                /* instrument specification */
-    sox_loopinfo_t   loops[SOX_MAX_NLOOPS]; /* Looping specification */
-    sox_bool         seekable;             /* can seek on this file */
-    char             mode;                 /* read or write mode */
-    sox_size_t       length;               /* frames in file, or 0 if unknown. */
-    sox_size_t       clips;                /* increment if clipping occurs */
-    char             *filename;            /* file name */
-    char             *filetype;            /* type of file */
-    char             *comment;             /* comment string */
-    FILE             *fp;                  /* File stream pointer */
-    int              sox_errno;            /* Failure error codes */
-    char             sox_errstr[256];      /* Extend Failure text */
-    const sox_format_t *h;                 /* format struct for this file */
-    /* The following is a portable trick to align this variable on
-     * an 8-byte boundery.  Once this is done, the buffer alloced
-     * after it should be align on an 8-byte boundery as well.
-     * This lets you cast any structure over the private area
-     * without concerns of alignment.
-     */
-    double priv1;
-    char   priv[SOX_MAX_FILE_PRIVSIZE]; /* format's private data area */
+  sox_signalinfo_t signal;               /* signal specifications */
+  sox_instrinfo_t  instr;                /* instrument specification */
+  sox_loopinfo_t   loops[SOX_MAX_NLOOPS];/* Looping specification */
+  sox_bool         seekable;             /* can seek on this file */
+  char             mode;                 /* read or write mode */
+  sox_size_t       length;               /* frames in file, or 0 if unknown. */
+  sox_size_t       clips;                /* increment if clipping occurs */
+  char             *filename;            /* file name */
+  char             *filetype;            /* type of file */
+  char             *comment;             /* comment string */
+  FILE             *fp;                  /* File stream pointer */
+  int              sox_errno;            /* Failure error codes */
+  char             sox_errstr[256];      /* Extend Failure text */
+  const sox_format_handler_t * handler;  /* format struct for this file */
 };
 
 /* file flags field */
@@ -361,6 +365,40 @@
 extern const char * const sox_size_bits_str[];
 extern const char * const sox_encodings_str[];
 
+sox_format_t * sox_open_read(const char *path, const sox_signalinfo_t *info, 
+                         const char *filetype);
+sox_format_t * sox_open_write(
+    sox_bool (*overwrite_permitted)(const char *filename),
+    const char *path,
+    const sox_signalinfo_t *info,
+    const char *filetype,
+    const char *comment,
+    sox_size_t length,
+    const sox_instrinfo_t *instr,
+    const sox_loopinfo_t *loops);
+sox_size_t sox_read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
+sox_size_t sox_write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len);
+int sox_close(sox_format_t * ft);
+
+#define SOX_SEEK_SET 0
+int sox_seek(sox_format_t * ft, sox_size_t offset, int whence);
+
+int sox_gettype(sox_format_t *, sox_bool);
+sox_format_t * sox_initformat(void);
+
+/*
+ * Structures for effects.
+ */
+
+typedef struct sox_effects_global_info /* Global parameters (for effects) */
+{
+  sox_plot_t plot;         /* To help the user choose effect & options */
+  double speed;            /* Gather up all speed changes here, then resample */
+  sox_global_info_t * global_info;
+} sox_effects_global_info_t;
+
+#define SOX_MAX_EFFECT_PRIVSIZE SOX_MAX_FILE_PRIVSIZE
+
 #define SOX_EFF_CHAN     1           /* Effect can mix channels up/down */
 #define SOX_EFF_RATE     2           /* Effect can alter data rate */
 #define SOX_EFF_LENGTH   4           /* Effect can alter audio length */
@@ -368,10 +406,6 @@
 #define SOX_EFF_NULL     16          /* Effect does nothing */
 #define SOX_EFF_DEPRECATED 32        /* Effect is living on borrowed time */
 
-/*
- * Handler structure for each effect.
- */
-
 typedef struct sox_effect sox_effect_t;
 
 typedef struct {
@@ -404,24 +438,6 @@
   sox_size_t               flows;
 };
 
-extern ft_t sox_open_read(const char *path, const sox_signalinfo_t *info, 
-                         const char *filetype);
-ft_t sox_open_write(
-    sox_bool (*overwrite_permitted)(const char *filename),
-    const char *path,
-    const sox_signalinfo_t *info,
-    const char *filetype,
-    const char *comment,
-    sox_size_t length,
-    const sox_instrinfo_t *instr,
-    const sox_loopinfo_t *loops);
-extern sox_size_t sox_read(ft_t ft, sox_ssample_t *buf, sox_size_t len);
-extern sox_size_t sox_write(ft_t ft, const sox_ssample_t *buf, sox_size_t len);
-extern int sox_close(ft_t ft);
-
-#define SOX_SEEK_SET 0
-extern int sox_seek(ft_t ft, sox_size_t offset, int whence);
-
 sox_effect_handler_t const *sox_find_effect(char const * name);
 void sox_create_effect(sox_effect_t * effp, sox_effect_handler_t const *e);
 int sox_update_effect(sox_effect_t * effp, const sox_signalinfo_t *in, const sox_signalinfo_t *out, int effect_mask);
@@ -437,8 +453,6 @@
 void sox_stop_effects(void);
 void sox_delete_effects(void);
 
-int sox_gettype(ft_t, sox_bool);
-ft_t sox_initformat(void);
 char const * sox_parsesamples(sox_rate_t rate, const char *str, sox_size_t *samples, int def);
 
 /* The following routines are unique to the trim effect.
@@ -452,22 +466,5 @@
  */
 sox_size_t sox_trim_get_start(sox_effect_t * effp);
 void sox_trim_clear_start(sox_effect_t * effp);
-
-extern char const * sox_message_filename;
-
-#define SOX_SUCCESS 0
-#define SOX_EOF (-1)           /* End Of File or other error */
-
-const char *sox_version(void);   /* Returns version number */
-
-/* libSoX specific error codes.  The rest directly map from errno. */
-#define SOX_EHDR 2000            /* Invalid Audio Header */
-#define SOX_EFMT 2001            /* Unsupported data format */
-#define SOX_ERATE 2002           /* Unsupported rate for format */
-#define SOX_ENOMEM 2003          /* Can't alloc memory */
-#define SOX_EPERM 2004           /* Operation not permitted */
-#define SOX_ENOTSUP 2005         /* Operation not supported */
-#define SOX_EINVAL 2006          /* Invalid argument */
-#define SOX_EFFMT 2007           /* Unsupported file format */
 
 #endif
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -133,48 +133,48 @@
  * possible byte swapping.
  */
 /* declared in misc.c */
-size_t sox_readbuf(ft_t ft, void *buf, sox_size_t len);
-int sox_skipbytes(ft_t ft, sox_size_t n);
-int sox_padbytes(ft_t ft, sox_size_t n);
-size_t sox_writebuf(ft_t ft, void const *buf, sox_size_t len);
-int sox_reads(ft_t ft, char *c, sox_size_t len);
-int sox_writes(ft_t ft, char const * c);
-void set_endianness_if_not_already_set(ft_t ft);
+size_t sox_readbuf(sox_format_t * ft, void *buf, sox_size_t len);
+int sox_skipbytes(sox_format_t * ft, sox_size_t n);
+int sox_padbytes(sox_format_t * ft, sox_size_t n);
+size_t sox_writebuf(sox_format_t * ft, void const *buf, sox_size_t len);
+int sox_reads(sox_format_t * ft, char *c, sox_size_t len);
+int sox_writes(sox_format_t * ft, char const * c);
+void set_endianness_if_not_already_set(sox_format_t * ft);
 
-sox_size_t sox_read_b_buf(ft_t ft, uint8_t *buf, sox_size_t len);
-sox_size_t sox_read_w_buf(ft_t ft, uint16_t *buf, sox_size_t len);
-sox_size_t sox_read_3_buf(ft_t ft, uint24_t *buf, sox_size_t len);
-sox_size_t sox_read_dw_buf(ft_t ft, uint32_t *buf, sox_size_t len);
-sox_size_t sox_read_f_buf(ft_t ft, float *buf, sox_size_t len);
-sox_size_t sox_read_df_buf(ft_t ft, double *buf, sox_size_t len);
+sox_size_t sox_read_b_buf(sox_format_t * ft, uint8_t *buf, sox_size_t len);
+sox_size_t sox_read_w_buf(sox_format_t * ft, uint16_t *buf, sox_size_t len);
+sox_size_t sox_read_3_buf(sox_format_t * ft, uint24_t *buf, sox_size_t len);
+sox_size_t sox_read_dw_buf(sox_format_t * ft, uint32_t *buf, sox_size_t len);
+sox_size_t sox_read_f_buf(sox_format_t * ft, float *buf, sox_size_t len);
+sox_size_t sox_read_df_buf(sox_format_t * ft, double *buf, sox_size_t len);
 
-sox_size_t sox_write_b_buf(ft_t ft, uint8_t *buf, sox_size_t len);
-sox_size_t sox_write_w_buf(ft_t ft, uint16_t *buf, sox_size_t len);
-sox_size_t sox_write_3_buf(ft_t ft, uint24_t *buf, sox_size_t len);
-sox_size_t sox_write_dw_buf(ft_t ft, uint32_t *buf, sox_size_t len);
-sox_size_t sox_write_f_buf(ft_t ft, float *buf, sox_size_t len);
-sox_size_t sox_write_df_buf(ft_t ft, double *buf, sox_size_t len);
+sox_size_t sox_write_b_buf(sox_format_t * ft, uint8_t *buf, sox_size_t len);
+sox_size_t sox_write_w_buf(sox_format_t * ft, uint16_t *buf, sox_size_t len);
+sox_size_t sox_write_3_buf(sox_format_t * ft, uint24_t *buf, sox_size_t len);
+sox_size_t sox_write_dw_buf(sox_format_t * ft, uint32_t *buf, sox_size_t len);
+sox_size_t sox_write_f_buf(sox_format_t * ft, float *buf, sox_size_t len);
+sox_size_t sox_write_df_buf(sox_format_t * ft, double *buf, sox_size_t len);
 
 #define sox_readb(ft, ub) (sox_read_b_buf(ft, ub, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_writeb(ft_t ft, uint8_t ub);
+int sox_writeb(sox_format_t * ft, uint8_t ub);
 #define sox_readw(ft, uw) (sox_read_w_buf(ft, uw, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_writew(ft_t ft, uint16_t uw);
+int sox_writew(sox_format_t * ft, uint16_t uw);
 #define sox_read3(ft, u3) (sox_read_3_buf(ft, u3, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_write3(ft_t ft, uint24_t u3);
+int sox_write3(sox_format_t * ft, uint24_t u3);
 #define sox_readdw(ft, udw) (sox_read_dw_buf(ft, udw, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_writedw(ft_t ft, uint32_t udw);
+int sox_writedw(sox_format_t * ft, uint32_t udw);
 #define sox_readf(ft, f) (sox_read_f_buf(ft, f, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_writef(ft_t ft, float f);
+int sox_writef(sox_format_t * ft, float f);
 #define sox_readdf(ft, d) (sox_read_df_buf(ft, d, 1) == 1 ? SOX_SUCCESS : SOX_EOF)
-int sox_writedf(ft_t ft, double d);
-int sox_seeki(ft_t ft, sox_ssize_t offset, int whence);
-sox_size_t sox_filelength(ft_t ft);
-int sox_flush(ft_t ft);
-sox_ssize_t sox_tell(ft_t ft);
-int sox_eof(ft_t ft);
-int sox_error(ft_t ft);
-void sox_rewind(ft_t ft);
-void sox_clearerr(ft_t ft);
+int sox_writedf(sox_format_t * ft, double d);
+int sox_seeki(sox_format_t * ft, sox_ssize_t offset, int whence);
+sox_size_t sox_filelength(sox_format_t * ft);
+int sox_flush(sox_format_t * ft);
+sox_ssize_t sox_tell(sox_format_t * ft);
+int sox_eof(sox_format_t * ft);
+int sox_error(sox_format_t * ft);
+void sox_rewind(sox_format_t * ft);
+void sox_clearerr(sox_format_t * ft);
 
 /* Utilities to read/write values endianness-independently */
 uint32_t get32_le(unsigned char **p);
@@ -216,7 +216,7 @@
 #define sox_debug_more sox_message_filename=__FILE__,sox_debug_more
 #define sox_debug_most sox_message_filename=__FILE__,sox_debug_most
 
-void sox_fail_errno(ft_t, int, const char *, ...);
+void sox_fail_errno(sox_format_t *, int, const char *, ...);
 
 #ifdef WORDS_BIGENDIAN
 #define SOX_IS_BIGENDIAN 1
@@ -252,9 +252,9 @@
 
 /* Psion record header check, defined in misc.c and used in prc.c and auto.c */
 const char prc_header[41];
-int prc_checkheader(ft_t ft, char *head);
+int prc_checkheader(sox_format_t * ft, char *head);
 
-typedef const sox_format_t *(*sox_format_fn_t)(void);
+typedef const sox_format_handler_t *(*sox_format_fn_t)(void);
 
 typedef struct {
   char *name;
@@ -265,22 +265,22 @@
 extern sox_format_tab_t sox_format_fns[];
 
 /* Raw I/O */
-int sox_rawstartread(ft_t ft);
-sox_size_t sox_rawread(ft_t ft, sox_ssample_t *buf, sox_size_t nsamp);
-int sox_rawstopread(ft_t ft);
-int sox_rawstartwrite(ft_t ft);
-sox_size_t sox_rawwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t nsamp);
-int sox_rawseek(ft_t ft, sox_size_t offset);
+int sox_rawstartread(sox_format_t * ft);
+sox_size_t sox_rawread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t nsamp);
+int sox_rawstopread(sox_format_t * ft);
+int sox_rawstartwrite(sox_format_t * ft);
+sox_size_t sox_rawwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t nsamp);
+int sox_rawseek(sox_format_t * ft, sox_size_t offset);
 
 /* The following functions can be used to simply return success if
  * a file handler or effect doesn't need to do anything special
  */
-int sox_format_nothing(ft_t ft);
-sox_size_t sox_format_nothing_read(ft_t ft, sox_ssample_t *buf, sox_size_t len);
-sox_size_t sox_format_nothing_write(ft_t ft, const sox_ssample_t *buf, sox_size_t len);
-int sox_format_nothing_seek(ft_t ft, sox_size_t offset);
+int sox_format_nothing(sox_format_t * ft);
+sox_size_t sox_format_nothing_read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
+sox_size_t sox_format_nothing_write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len);
+int sox_format_nothing_seek(sox_format_t * ft, sox_size_t offset);
 
-int sox_rawstart(ft_t ft, sox_bool default_rate, sox_bool default_channels, sox_encoding_t encoding, int size);
+int sox_rawstart(sox_format_t * ft, sox_bool default_rate, sox_bool default_channels, sox_encoding_t encoding, int size);
 #define sox_rawstartread(ft) sox_rawstart(ft, sox_false, sox_false, SOX_ENCODING_UNKNOWN, -1)
 #define sox_rawstartwrite sox_rawstartread
 #define sox_rawstopread sox_format_nothing
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -12,29 +12,29 @@
 #endif
 
 
-void set_endianness_if_not_already_set(ft_t ft)
+void set_endianness_if_not_already_set(sox_format_t * ft)
 {
   if (ft->signal.reverse_bytes == SOX_OPTION_DEFAULT) {
-    if (ft->h->flags & SOX_FILE_ENDIAN)
+    if (ft->handler->flags & SOX_FILE_ENDIAN)
       /* Set reverse_bytes for big-endian formats; on a big-endian
          system this cancels out with the reversal made for being on a
          big-endian system. */
-      ft->signal.reverse_bytes = (ft->h->flags & SOX_FILE_ENDBIG) != 0;
+      ft->signal.reverse_bytes = (ft->handler->flags & SOX_FILE_ENDBIG) != 0;
     else
       ft->signal.reverse_bytes = SOX_OPTION_NO;
   }
   if (ft->signal.reverse_bits == SOX_OPTION_DEFAULT)
-    ft->signal.reverse_bits = !!(ft->h->flags & SOX_FILE_BIT_REV);
-  else if (ft->signal.reverse_bits != !!(ft->h->flags & SOX_FILE_BIT_REV))
+    ft->signal.reverse_bits = !!(ft->handler->flags & SOX_FILE_BIT_REV);
+  else if (ft->signal.reverse_bits != !!(ft->handler->flags & SOX_FILE_BIT_REV))
       sox_report("'%s': Format options overriding file-type bit-order", ft->filename);
 
   if (ft->signal.reverse_nibbles == SOX_OPTION_DEFAULT)
-    ft->signal.reverse_nibbles = !!(ft->h->flags & SOX_FILE_NIB_REV);
-  else if (ft->signal.reverse_nibbles != !!(ft->h->flags & SOX_FILE_NIB_REV))
+    ft->signal.reverse_nibbles = !!(ft->handler->flags & SOX_FILE_NIB_REV);
+  else if (ft->signal.reverse_nibbles != !!(ft->handler->flags & SOX_FILE_NIB_REV))
       sox_report("'%s': Format options overriding file-type nibble-order", ft->filename);
 }
 
-static int is_seekable(ft_t ft)
+static int is_seekable(sox_format_t * ft)
 {
         struct stat st;
 
@@ -44,7 +44,7 @@
 }
 
 /* check that all settings have been given */
-static int sox_checkformat(ft_t ft)
+static int sox_checkformat(sox_format_t * ft)
 {
 
         ft->sox_errno = SOX_SUCCESS;
@@ -82,10 +82,10 @@
         return SOX_SUCCESS;
 }
 
-ft_t sox_open_read(const char *path, const sox_signalinfo_t *info,
+sox_format_t * sox_open_read(const char *path, const sox_signalinfo_t *info,
                   const char *filetype)
 {
-    ft_t ft = (ft_t)xcalloc(sizeof(struct sox_soundstream), 1);
+    sox_format_t * ft = xcalloc(sizeof(*ft), 1);
 
     ft->filename = xstrdup(path);
 
@@ -109,7 +109,7 @@
         ft->signal = *info;
     ft->mode = 'r';
 
-    if (!(ft->h->flags & SOX_FILE_NOSTDIO))
+    if (!(ft->handler->flags & SOX_FILE_NOSTDIO))
     {
         /* Open file handler based on input name.  Used stdin file handler
          * if the filename is "-"
@@ -138,7 +138,7 @@
       set_endianness_if_not_already_set(ft);
 
     /* Read and write starters can change their formats. */
-    if (ft->h->startread && (*ft->h->startread)(ft) != SOX_SUCCESS)
+    if (ft->handler->startread && (*ft->handler->startread)(ft) != SOX_SUCCESS)
     {
         sox_fail("Failed reading `%s': %s", ft->filename, ft->sox_errstr);
         goto input_error;
@@ -148,7 +148,7 @@
      * This is because libsox usually doesn't set this for mono file
      * formats (for historical reasons).
      */
-    if (!(ft->h->flags & SOX_FILE_PHONY) && !ft->signal.channels)
+    if (!(ft->handler->flags & SOX_FILE_PHONY) && !ft->signal.channels)
       ft->signal.channels = 1;
 
     if (sox_checkformat(ft) )
@@ -167,7 +167,7 @@
     return NULL;
 }
 
-ft_t sox_open_write(
+sox_format_t * sox_open_write(
     sox_bool (*overwrite_permitted)(const char *filename),
     const char *path,
     const sox_signalinfo_t *info,
@@ -177,7 +177,7 @@
     const sox_instrinfo_t *instr,
     const sox_loopinfo_t *loops)
 {
-    ft_t ft = (ft_t)xcalloc(sizeof(struct sox_soundstream), 1);
+    sox_format_t * ft = xcalloc(sizeof(*ft), 1);
     int i;
     sox_bool no_filetype_given = filetype == NULL;
 
@@ -205,7 +205,7 @@
         ft->signal = *info;
     ft->mode = 'w';
 
-    if (!(ft->h->flags & SOX_FILE_NOSTDIO))
+    if (!(ft->handler->flags & SOX_FILE_NOSTDIO))
     {
         /* Open file handler based on output name.  Used stdout file handler
          * if the filename is "-"
@@ -259,7 +259,7 @@
     set_endianness_if_not_already_set(ft);
 
     /* Read and write starters can change their formats. */
-    if (ft->h->startwrite && (*ft->h->startwrite)(ft) != SOX_SUCCESS)
+    if (ft->handler->startwrite && (*ft->handler->startwrite)(ft) != SOX_SUCCESS)
     {
         sox_fail("Failed writing %s: %s", ft->filename, ft->sox_errstr);
         goto output_error;
@@ -282,15 +282,15 @@
     return NULL;
 }
 
-sox_size_t sox_read(ft_t f, sox_ssample_t * buf, sox_size_t len)
+sox_size_t sox_read(sox_format_t * ft, sox_ssample_t * buf, sox_size_t len)
 {
-  sox_size_t actual = f->h->read? (*f->h->read)(f, buf, len) : 0;
+  sox_size_t actual = ft->handler->read? (*ft->handler->read)(ft, buf, len) : 0;
   return (actual > len? 0 : actual);
 }
 
-sox_size_t sox_write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+sox_size_t sox_write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
-    return ft->h->write? (*ft->h->write)(ft, buf, len) : 0;
+    return ft->handler->write? (*ft->handler->write)(ft, buf, len) : 0;
 }
 
 #define TWIDDLE_BYTE(ub, type) \
@@ -309,7 +309,7 @@
    types). */
 #define READ_FUNC(type, size, ctype, twiddle) \
   sox_size_t sox_read_ ## type ## _buf( \
-      ft_t ft, ctype *buf, sox_size_t len) \
+      sox_format_t * ft, ctype *buf, sox_size_t len) \
   { \
     sox_size_t n, nread; \
     if ((nread = sox_readbuf(ft, buf, len * size)) != len * size) \
@@ -327,7 +327,7 @@
    that need to be unpacked. */
 #define READ_FUNC_UNPACK(type, size, ctype, twiddle) \
   sox_size_t sox_read_ ## type ## _buf( \
-      ft_t ft, ctype *buf, sox_size_t len) \
+      sox_format_t * ft, ctype *buf, sox_size_t len) \
   { \
     sox_size_t n, nread; \
     uint8_t *data = xmalloc(size * len); \
@@ -354,7 +354,7 @@
    types). */
 #define WRITE_FUNC(type, size, ctype, twiddle) \
   sox_size_t sox_write_ ## type ## _buf( \
-      ft_t ft, ctype *buf, sox_size_t len) \
+      sox_format_t * ft, ctype *buf, sox_size_t len) \
   { \
     sox_size_t n, nwritten; \
     for (n = 0; n < len; n++) \
@@ -374,7 +374,7 @@
    that need to be packed. */
 #define WRITE_FUNC_PACK(type, size, ctype, twiddle) \
   sox_size_t sox_write_ ## type ## _buf( \
-      ft_t ft, ctype *buf, sox_size_t len) \
+      sox_format_t * ft, ctype *buf, sox_size_t len) \
   { \
     sox_size_t n, nwritten; \
     uint8_t *data = xmalloc(size * len); \
@@ -397,7 +397,7 @@
 WRITE_FUNC(df, sizeof(double), double, TWIDDLE_WORD)
 
 #define WRITE1_FUNC(type, sign, ctype) \
-  int sox_write ## type(ft_t ft, ctype datum) \
+  int sox_write ## type(sox_format_t * ft, ctype datum) \
   { \
     return sox_write_ ## type ## _buf(ft, &datum, 1) == 1 ? SOX_SUCCESS : SOX_EOF; \
   }
@@ -410,16 +410,16 @@
 WRITE1_FUNC(df, su, double)
 
 /* N.B. The file (if any) may already have been deleted. */
-int sox_close(ft_t ft)
+int sox_close(sox_format_t * ft)
 {
     int rc;
 
     if (ft->mode == 'r')
-        rc = ft->h->stopread? (*ft->h->stopread)(ft) : SOX_SUCCESS;
+        rc = ft->handler->stopread? (*ft->handler->stopread)(ft) : SOX_SUCCESS;
     else
-        rc = ft->h->stopwrite? (*ft->h->stopwrite)(ft) : SOX_SUCCESS;
+        rc = ft->handler->stopwrite? (*ft->handler->stopwrite)(ft) : SOX_SUCCESS;
 
-    if (!(ft->h->flags & SOX_FILE_NOSTDIO))
+    if (!(ft->handler->flags & SOX_FILE_NOSTDIO))
         fclose(ft->fp);
     free(ft->filename);
     free(ft->filetype);
@@ -431,7 +431,7 @@
     return rc;
 }
 
-int sox_seek(ft_t ft, sox_size_t offset, int whence)
+int sox_seek(sox_format_t * ft, sox_size_t offset, int whence)
 {
     /* FIXME: Implement SOX_SEEK_CUR and SOX_SEEK_END. */
     if (whence != SOX_SEEK_SET)
@@ -440,8 +440,8 @@
     /* If file is a seekable file and this handler supports seeking,
      * the invoke handlers function.
      */
-    if (ft->seekable  && (ft->h->flags & SOX_FILE_SEEK))
-        return ft->h->seek? (*ft->h->seek)(ft, offset) : SOX_EOF;
+    if (ft->seekable  && (ft->handler->flags & SOX_FILE_SEEK))
+        return ft->handler->seek? (*ft->handler->seek)(ft, offset) : SOX_EOF;
     else
         return SOX_EOF; /* FIXME: return SOX_EBADF */
 }
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -26,7 +26,7 @@
  *      size and encoding of samples, 
  *      mono/stereo/quad.
  */
-static int sox_spherestartread(ft_t ft) 
+static int sox_spherestartread(sox_format_t * ft) 
 {
         sphere_t sphere = (sphere_t) ft->priv;
         int rc;
@@ -167,7 +167,7 @@
         return (SOX_SUCCESS);
 }
 
-static int sox_spherestartwrite(ft_t ft) 
+static int sox_spherestartwrite(sox_format_t * ft) 
 {
     int rc;
     int x;
@@ -206,7 +206,7 @@
         
 }
 
-static sox_size_t sox_spherewrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_spherewrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len) 
 {
     sphere_t sphere = (sphere_t) ft->priv;
 
@@ -214,7 +214,7 @@
     return sox_rawwrite(ft, buf, len);
 }
 
-static int sox_spherestopwrite(ft_t ft) 
+static int sox_spherestopwrite(sox_format_t * ft) 
 {
     int rc;
     char buf[128];
@@ -269,7 +269,7 @@
   NULL
 };
 
-static sox_format_t sox_sphere_format = {
+static sox_format_handler_t sox_sphere_format = {
   spherenames,
   0,
   sox_spherestartread,
@@ -281,9 +281,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_sphere_format_fn(void);
+const sox_format_handler_t *sox_sphere_format_fn(void);
 
-const sox_format_t *sox_sphere_format_fn(void)
+const sox_format_handler_t *sox_sphere_format_fn(void)
 {
     return &sox_sphere_format;
 }
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -42,7 +42,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int sox_sunstartread(ft_t ft)
+static int sox_sunstartread(sox_format_t * ft)
 {
     sox_fileinfo_t *file = (sox_fileinfo_t *)ft->priv;
     sox_size_t samplesize, encoding;
@@ -178,7 +178,7 @@
     return (SOX_SUCCESS);
 }
 
-static int sox_sunstartwrite(ft_t ft)
+static int sox_sunstartwrite(sox_format_t * ft)
 {
     sox_fileinfo_t *file = (sox_fileinfo_t *)ft->priv;
     sox_size_t samplesize, encoding;
@@ -312,7 +312,7 @@
   NULL
 };
 
-static sox_format_t sox_sunau_format = {
+static sox_format_handler_t sox_sunau_format = {
   names,
   SOX_FILE_DEVICE,
   sox_sunstartread,
@@ -324,9 +324,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_sunau_format_fn(void);
+const sox_format_handler_t *sox_sunau_format_fn(void);
 
-const sox_format_t *sox_sunau_format_fn(void)
+const sox_format_handler_t *sox_sunau_format_fn(void)
 {
     return &sox_sunau_format;
 }
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -70,7 +70,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int sox_txwstartread(ft_t ft)
+static int sox_txwstartread(sox_format_t * ft)
 {
     int c;
     char filetype[7];
@@ -182,7 +182,7 @@
  * Return number of samples read.
  */
 
-static sox_size_t sox_txwread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_txwread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
     txw_t sk = (txw_t) ft->priv;
     sox_size_t done = 0;
@@ -232,7 +232,7 @@
     return done;
 }
 
-static int sox_txwstartwrite(ft_t ft)
+static int sox_txwstartwrite(sox_format_t * ft)
 {
     struct WaveHeader_ WH;
 
@@ -263,7 +263,7 @@
     return(SOX_SUCCESS);
 }
 
-static sox_size_t sox_txwwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_txwwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
     sox_size_t i;
     sox_ssample_t w1,w2;
@@ -286,7 +286,7 @@
     return(len);
 }
 
-static int sox_txwstopwrite(ft_t ft)
+static int sox_txwstopwrite(sox_format_t * ft)
 {
     struct WaveHeader_ WH;
     int AttackLength, LoopLength, i;
@@ -369,7 +369,7 @@
   NULL
 };
 
-static sox_format_t sox_txw_format = {
+static sox_format_handler_t sox_txw_format = {
    txwnames,
    0,
    sox_txwstartread,
@@ -381,9 +381,9 @@
    sox_format_nothing_seek
 };
 
-const sox_format_t *sox_txw_format_fn(void);
+const sox_format_handler_t *sox_txw_format_fn(void);
 
-const sox_format_t *sox_txw_format_fn(void)
+const sox_format_handler_t *sox_txw_format_fn(void)
 {
     return &sox_txw_format;
 }
--- a/src/util.c
+++ b/src/util.c
@@ -100,7 +100,7 @@
 
 #undef SOX_MESSAGE_FUNCTION
 
-void sox_fail_errno(ft_t ft, int sox_errno, const char *fmt, ...)
+void sox_fail_errno(sox_format_t * ft, int sox_errno, const char *fmt, ...)
 {
         va_list args;
 
@@ -119,21 +119,21 @@
 /*
  * Check that we have a known format suffix string.
  */
-int sox_gettype(ft_t formp, sox_bool is_file_extension)
+int sox_gettype(sox_format_t * ft, sox_bool is_file_extension)
 {
     const char * const *list;
     unsigned i;
 
-    if (!formp->filetype) {
-        sox_fail_errno(formp, SOX_EFMT, "Filetype was not specified");
+    if (!ft->filetype) {
+        sox_fail_errno(ft, SOX_EFMT, "Filetype was not specified");
         return SOX_EFMT;
     }
     for (i = 0; i < sox_formats; i++) {
-      const sox_format_t *f = sox_format_fns[i].fn();
+      const sox_format_handler_t *f = sox_format_fns[i].fn();
       if (is_file_extension && (f->flags & SOX_FILE_DEVICE))
         continue; /* don't match device name in file name extensions */
       for (list = f->names; *list; list++) {
-        const char *s1 = *list, *s2 = formp->filetype;
+        const char *s1 = *list, *s2 = ft->filetype;
         if (!strcasecmp(s1, s2))
           break;  /* not a match */
       }
@@ -140,11 +140,11 @@
       if (!*list)
         continue;
       /* Found it! */
-      formp->h = f;
+      ft->handler = f;
       return SOX_SUCCESS;
     }
-    sox_fail_errno(formp, SOX_EFMT, "File type `%s' is not known",
-                  formp->filetype);
+    sox_fail_errno(ft, SOX_EFMT, "File type `%s' is not known",
+                  ft->filetype);
     return SOX_EFMT;
 }
 
--- a/src/voc.c
+++ b/src/voc.c
@@ -198,8 +198,8 @@
 #define VOC_FMT_CRLADPCM4A 0x200   /* Creative 16-bit to 4-bit ADPCM */
 
 /* Prototypes for internal functions */
-static int getblock(ft_t);
-static void blockstart(ft_t);
+static int getblock(sox_format_t *);
+static void blockstart(sox_format_t *);
 
 /* Conversion macros (from raw.c) */
 #define SOX_ALAW_BYTE_TO_SAMPLE(d) ((sox_ssample_t)(sox_alaw2linear16(d)) << 16)
@@ -209,7 +209,7 @@
 /*-----------------------------------------------------------------
  * sox_vocstartread() -- start reading a VOC file
  *-----------------------------------------------------------------*/
-static int sox_vocstartread(ft_t ft)
+static int sox_vocstartread(sox_format_t * ft)
 {
         int rtn = SOX_SUCCESS;
         char header[20];
@@ -308,7 +308,7 @@
  * ANN:  Major changes here to support multi-part files and files
  *       that do not have audio in block 9's.
  *-----------------------------------------------------------------*/
-static sox_size_t sox_vocread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_vocread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
         vs_t v = (vs_t) ft->priv;
         sox_size_t done = 0;
@@ -409,7 +409,7 @@
  * which will work with the oldest software (eg. an 8-bit mono sample
  * will be able to be played with a really old SB VOC player.)
  */
-static int sox_vocstartwrite(ft_t ft)
+static int sox_vocstartwrite(sox_format_t * ft)
 {
         vs_t v = (vs_t) ft->priv;
 
@@ -441,7 +441,7 @@
 /*-----------------------------------------------------------------
  * sox_vocwrite() -- write a VOC file
  *-----------------------------------------------------------------*/
-static sox_size_t sox_vocwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_vocwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
         vs_t v = (vs_t) ft->priv;
         unsigned char uc;
@@ -471,7 +471,7 @@
  * blockstop() -- stop an output block
  * End the current data or silence block.
  *-----------------------------------------------------------------*/
-static void blockstop(ft_t ft)
+static void blockstop(sox_format_t * ft)
 {
         vs_t v = (vs_t) ft->priv;
         sox_ssample_t datum;
@@ -500,7 +500,7 @@
 /*-----------------------------------------------------------------
  * sox_vocstopwrite() -- stop writing a VOC file
  *-----------------------------------------------------------------*/
-static int sox_vocstopwrite(ft_t ft)
+static int sox_vocstopwrite(sox_format_t * ft)
 {
         blockstop(ft);
         return(SOX_SUCCESS);
@@ -514,7 +514,7 @@
  * getblock() -- Read next block header, save info,
  *               leave position at start of dat
  *-----------------------------------------------------------------*/
-static int getblock(ft_t ft)
+static int getblock(sox_format_t * ft)
 {
         vs_t v = (vs_t) ft->priv;
         unsigned char uc, block;
@@ -747,7 +747,7 @@
 /*-----------------------------------------------------------------
  * vlockstart() -- start an output block
  *-----------------------------------------------------------------*/
-static void blockstart(ft_t ft)
+static void blockstart(sox_format_t * ft)
 {
         vs_t v = (vs_t) ft->priv;
 
@@ -806,7 +806,7 @@
   NULL
 };
 
-static sox_format_t sox_voc_format = {
+static sox_format_handler_t sox_voc_format = {
   vocnames,
   SOX_FILE_LIT_END,
   sox_vocstartread,
@@ -818,9 +818,9 @@
   sox_format_nothing_seek
 };
 
-const sox_format_t *sox_voc_format_fn(void);
+const sox_format_handler_t *sox_voc_format_fn(void);
 
-const sox_format_t *sox_voc_format_fn(void)
+const sox_format_handler_t *sox_voc_format_fn(void)
 {
     return &sox_voc_format;
 }
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -89,7 +89,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int startread(ft_t ft)
+static int startread(sox_format_t * ft)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
         vorbis_info *vi;
@@ -210,7 +210,7 @@
  * Return number of samples read.
  */
 
-static sox_size_t read(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
         sox_size_t i;
@@ -245,7 +245,7 @@
  * Do anything required when you stop reading samples.
  * Don't close input file!
  */
-static int stopread(ft_t ft)
+static int stopread(sox_format_t * ft)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
 
@@ -257,7 +257,7 @@
 
 /* Write a page of ogg data to a file.  Taken directly from encode.c in
    oggenc.   Returns the number of bytes written. */
-static int oe_write_page(ogg_page *page, ft_t ft)
+static int oe_write_page(ogg_page *page, sox_format_t * ft)
 {
         int written;
         written = sox_writebuf(ft, page->header,(sox_size_t)page->header_len);
@@ -269,7 +269,7 @@
 /* Write out the header packets.  Derived mostly from encode.c in
    oggenc.  Returns HEADER_ERROR if the header cannot be written and
    HEADER_OK otherwise. */
-static int write_vorbis_header(ft_t ft, vorbis_enc_t *ve)
+static int write_vorbis_header(sox_format_t * ft, vorbis_enc_t *ve)
 {
         ogg_packet header_main;
         ogg_packet header_comments;
@@ -329,7 +329,7 @@
         return HEADER_OK;
 }
 
-static int startwrite(ft_t ft)
+static int startwrite(sox_format_t * ft)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
         vorbis_enc_t *ve;
@@ -377,7 +377,7 @@
         return(SOX_SUCCESS);
 }
 
-static sox_size_t write(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t write(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
         vorbis_enc_t *ve = vb->vorbis_enc_data;
@@ -428,7 +428,7 @@
         return (len);
 }
 
-static int stopwrite(ft_t ft)
+static int stopwrite(sox_format_t * ft)
 {
         vorbis_t vb = (vorbis_t) ft->priv;
         vorbis_enc_t *ve = vb->vorbis_enc_data;
@@ -444,18 +444,18 @@
         return (SOX_SUCCESS);
 }
 
-static int seek(ft_t ft, sox_size_t offset) 
+static int seek(sox_format_t * ft, sox_size_t offset) 
 {
   vorbis_t vb = (vorbis_t)ft->priv;
   return ov_pcm_seek(vb->vf, offset / ft->signal.channels)? SOX_EOF:SOX_SUCCESS;
 }
 
-const sox_format_t *sox_vorbis_format_fn(void);
+const sox_format_handler_t *sox_vorbis_format_fn(void);
 
-const sox_format_t *sox_vorbis_format_fn(void)
+const sox_format_handler_t *sox_vorbis_format_fn(void)
 {
   static const char * names[] = {"vorbis", "ogg", NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, SOX_FILE_SEEK,
     startread, read, stopread,
     startwrite, write, stopwrite,
--- a/src/vox-fmt.c
+++ b/src/vox-fmt.c
@@ -13,12 +13,12 @@
 #include "sox_i.h"
 #include "vox.h"
  
-const sox_format_t *sox_vox_format_fn(void);
+const sox_format_handler_t *sox_vox_format_fn(void);
 
-const sox_format_t *sox_vox_format_fn(void)
+const sox_format_handler_t *sox_vox_format_fn(void)
 {
   static char const * names[] = {"vox", NULL};
-  static sox_format_t handler = {
+  static sox_format_handler_t handler = {
     names, 0,
     sox_vox_start,
     sox_vox_read,
--- a/src/vox.c
+++ b/src/vox.c
@@ -17,32 +17,32 @@
 /* .vox doesn't need any private state over and above adpcm_io_t, so
    just have simple wrappers that pass it on directly. */
 
-int sox_vox_start(ft_t ft)
+int sox_vox_start(sox_format_t * ft)
 {
   return sox_adpcm_oki_start(ft, (adpcm_io_t)ft->priv);
 }
 
-int sox_ima_start(ft_t ft)
+int sox_ima_start(sox_format_t * ft)
 {
   return sox_adpcm_ima_start(ft, (adpcm_io_t)ft->priv);
 }
 
-sox_size_t sox_vox_read(ft_t ft, sox_ssample_t *buffer, sox_size_t len)
+sox_size_t sox_vox_read(sox_format_t * ft, sox_ssample_t *buffer, sox_size_t len)
 {
   return sox_adpcm_read(ft, (adpcm_io_t)ft->priv, buffer, len);
 }
 
-int sox_vox_stopread(ft_t ft)
+int sox_vox_stopread(sox_format_t * ft)
 {
   return sox_adpcm_stopread(ft, (adpcm_io_t)ft->priv);
 }
 
-sox_size_t sox_vox_write(ft_t ft, const sox_ssample_t *buffer, sox_size_t length)
+sox_size_t sox_vox_write(sox_format_t * ft, const sox_ssample_t *buffer, sox_size_t length)
 {
   return sox_adpcm_write(ft, (adpcm_io_t)ft->priv, buffer, length);
 }
 
-int sox_vox_stopwrite(ft_t ft)
+int sox_vox_stopwrite(sox_format_t * ft)
 {
   return sox_adpcm_stopwrite(ft, (adpcm_io_t)ft->priv);
 }
--- a/src/vox.h
+++ b/src/vox.h
@@ -10,9 +10,9 @@
  * consequences of using this software.
  */
 
-int sox_vox_start(ft_t ft);
-int sox_ima_start(ft_t ft);
-sox_size_t sox_vox_read(ft_t ft, sox_ssample_t *buffer, sox_size_t len);
-int sox_vox_stopread(ft_t ft);
-sox_size_t sox_vox_write(ft_t ft, const sox_ssample_t *buffer, sox_size_t length);
-int sox_vox_stopwrite(ft_t ft);
+int sox_vox_start(sox_format_t * ft);
+int sox_ima_start(sox_format_t * ft);
+sox_size_t sox_vox_read(sox_format_t * ft, sox_ssample_t *buffer, sox_size_t len);
+int sox_vox_stopread(sox_format_t * ft);
+sox_size_t sox_vox_write(sox_format_t * ft, const sox_ssample_t *buffer, sox_size_t length);
+int sox_vox_stopwrite(sox_format_t * ft);
--- a/src/wav.c
+++ b/src/wav.c
@@ -65,7 +65,7 @@
 
 static char *wav_format_str(unsigned wFormatTag);
 
-static int wavwritehdr(ft_t, int);
+static int wavwritehdr(sox_format_t *, int);
 
 
 /****************************************************************************/
@@ -77,7 +77,7 @@
  * ImaAdpcmReadBlock - Grab and decode complete block of samples
  *
  */
-static unsigned short  ImaAdpcmReadBlock(ft_t ft)
+static unsigned short  ImaAdpcmReadBlock(sox_format_t * ft)
 {
     wav_t       wav = (wav_t) ft->priv;
     size_t bytesRead;
@@ -117,7 +117,7 @@
  * AdpcmReadBlock - Grab and decode complete block of samples
  *
  */
-static unsigned short  AdpcmReadBlock(ft_t ft)
+static unsigned short  AdpcmReadBlock(sox_format_t * ft)
 {
     wav_t       wav = (wav_t) ft->priv;
     size_t bytesRead;
@@ -152,7 +152,7 @@
 /* Common ADPCM Write Function                                              */
 /****************************************************************************/
 
-static int xxxAdpcmWriteBlock(ft_t ft)
+static int xxxAdpcmWriteBlock(sox_format_t * ft)
 {
     wav_t wav = (wav_t) ft->priv;
     sox_size_t chans, ct;
@@ -191,7 +191,7 @@
 /* WAV GSM6.10 support functions                                            */
 /****************************************************************************/
 /* create the gsm object, malloc buffer for 160*2 samples */
-static int wavgsminit(ft_t ft)
+static int wavgsminit(sox_format_t * ft)
 {       
     int valueP=1;
     wav_t       wav = (wav_t) ft->priv;
@@ -214,7 +214,7 @@
 }
 
 /*destroy the gsm object and free the buffer */
-static void wavgsmdestroy(ft_t ft)
+static void wavgsmdestroy(sox_format_t * ft)
 {       
     wav_t       wav = (wav_t) ft->priv;
     gsm_destroy(wav->gsmhandle);
@@ -221,7 +221,7 @@
     free(wav->gsmsample);
 }
 
-static sox_size_t wavgsmread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t wavgsmread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
     wav_t       wav = (wav_t) ft->priv;
     size_t done=0;
@@ -265,7 +265,7 @@
     return done;
 }
 
-static int wavgsmflush(ft_t ft)
+static int wavgsmflush(sox_format_t * ft)
 {
     gsm_byte    frame[65];
     wav_t       wav = (wav_t) ft->priv;
@@ -289,7 +289,7 @@
     return (SOX_SUCCESS);
 }
 
-static sox_size_t wavgsmwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len)
+static sox_size_t wavgsmwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len)
 {
     wav_t wav = (wav_t) ft->priv;
     size_t done = 0;
@@ -313,7 +313,7 @@
 
 }
 
-static void wavgsmstopwrite(ft_t ft)
+static void wavgsmstopwrite(sox_format_t * ft)
 {
     wav_t       wav = (wav_t) ft->priv;
 
@@ -336,7 +336,7 @@
 /****************************************************************************/
 /* General Sox WAV file code                                                */
 /****************************************************************************/
-static int findChunk(ft_t ft, const char *Label, sox_size_t *len)
+static int findChunk(sox_format_t * ft, const char *Label, sox_size_t *len)
 {
     char magic[5];
     for (;;)
@@ -370,7 +370,7 @@
 }
 
 
-static int wavfail(ft_t ft, const char *format)
+static int wavfail(sox_format_t * ft, const char *format)
 {
     sox_fail_errno(ft, SOX_EHDR, "Unhandled WAV file encoding (%s).\nTry overriding the encoding: e.g. for an MP3 WAV, `-t mp3'", format);
     return SOX_EOF;
@@ -383,7 +383,7 @@
  *      size and encoding of samples, 
  *      mono/stereo/quad.
  */
-static int sox_wavstartread(ft_t ft) 
+static int sox_wavstartread(sox_format_t * ft) 
 {
     wav_t       wav = (wav_t) ft->priv;
     char        magic[5];
@@ -997,7 +997,7 @@
  * Return number of samples read.
  */
 
-static sox_size_t sox_wavread(ft_t ft, sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_wavread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len) 
 {
         wav_t   wav = (wav_t) ft->priv;
         sox_size_t done;
@@ -1093,7 +1093,7 @@
  * Do anything required when you stop reading samples.  
  * Don't close input file! 
  */
-static int sox_wavstopread(ft_t ft) 
+static int sox_wavstopread(sox_format_t * ft) 
 {
     wav_t       wav = (wav_t) ft->priv;
     int         rc = SOX_SUCCESS;
@@ -1121,7 +1121,7 @@
     return rc;
 }
 
-static int sox_wavstartwrite(ft_t ft) 
+static int sox_wavstartwrite(sox_format_t * ft) 
 {
     wav_t wav = (wav_t) ft->priv;
     int rc;
@@ -1232,7 +1232,7 @@
 
 */
 
-static int wavwritehdr(ft_t ft, int second_header) 
+static int wavwritehdr(sox_format_t * ft, int second_header) 
 {
     wav_t       wav = (wav_t) ft->priv;
 
@@ -1531,7 +1531,7 @@
     return SOX_SUCCESS;
 }
 
-static sox_size_t sox_wavwrite(ft_t ft, const sox_ssample_t *buf, sox_size_t len) 
+static sox_size_t sox_wavwrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t len) 
 {
         wav_t   wav = (wav_t) ft->priv;
         sox_ssize_t total_len = len;
@@ -1572,7 +1572,7 @@
         }
 }
 
-static int sox_wavstopwrite(ft_t ft) 
+static int sox_wavstopwrite(sox_format_t * ft) 
 {
         wav_t   wav = (wav_t) ft->priv;
 
@@ -1667,7 +1667,7 @@
         }
 }
 
-static int sox_wavseek(ft_t ft, sox_size_t offset) 
+static int sox_wavseek(sox_format_t * ft, sox_size_t offset) 
 {
     wav_t   wav = (wav_t) ft->priv;
     int new_offset, channel_block, alignment;
@@ -1731,7 +1731,7 @@
   NULL
 };
 
-static sox_format_t sox_wav_format = {
+static sox_format_handler_t sox_wav_format = {
   wavnames,
   SOX_FILE_SEEK | SOX_FILE_LIT_END,
   sox_wavstartread,
@@ -1743,9 +1743,9 @@
   sox_wavseek
 };
 
-const sox_format_t *sox_wav_format_fn(void);
+const sox_format_handler_t *sox_wav_format_fn(void);
 
-const sox_format_t *sox_wav_format_fn()
+const sox_format_handler_t *sox_wav_format_fn()
 {
     return &sox_wav_format;
 }
--- a/src/wve.c
+++ b/src/wve.c
@@ -21,9 +21,9 @@
         sox_size_t dataStart;
     } *wve_t;
 
-static void wvewriteheader(ft_t ft);
+static void wvewriteheader(sox_format_t * ft);
 
-static int sox_wveseek(ft_t ft, sox_size_t offset)
+static int sox_wveseek(sox_format_t * ft, sox_size_t offset)
 {
     int new_offset, channel_block, alignment;
     wve_t wve = (wve_t)ft->priv;
@@ -43,7 +43,7 @@
     return sox_seeki(ft, (sox_ssize_t)offset, SEEK_SET);
 }
 
-static int sox_wvestartread(ft_t ft)
+static int sox_wvestartread(sox_format_t * ft)
 {
         wve_t p = (wve_t)ft->priv;
         char magic[16];
@@ -115,7 +115,7 @@
    if it is not, the unspecified size remains in the header
    (this is illegal). */
 
-static int sox_wvestartwrite(ft_t ft)
+static int sox_wvestartwrite(sox_format_t * ft)
 {
         wve_t p = (wve_t)ft->priv;
         int rc;
@@ -143,7 +143,7 @@
         return SOX_SUCCESS;
 }
 
-static sox_size_t sox_wvewrite(ft_t ft, const sox_ssample_t *buf, sox_size_t samp)
+static sox_size_t sox_wvewrite(sox_format_t * ft, const sox_ssample_t *buf, sox_size_t samp)
 {
         wve_t p = (wve_t)ft->priv;
         p->length += samp * ft->signal.size;
@@ -150,7 +150,7 @@
         return sox_rawwrite(ft, buf, samp);
 }
 
-static int sox_wvestopwrite(ft_t ft)
+static int sox_wvestopwrite(sox_format_t * ft)
 {
 
         /* Call before seeking to flush buffer */
@@ -171,7 +171,7 @@
         return SOX_SUCCESS;
 }
 
-static void wvewriteheader(ft_t ft)
+static void wvewriteheader(sox_format_t * ft)
 {
 
     char magic[16];
@@ -204,7 +204,7 @@
   NULL
 };
 
-static sox_format_t sox_wve_format = {
+static sox_format_handler_t sox_wve_format = {
   wvenames,
   SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_wvestartread,
@@ -216,9 +216,9 @@
   sox_wveseek
 };
 
-const sox_format_t *sox_wve_format_fn(void);
+const sox_format_handler_t *sox_wve_format_fn(void);
 
-const sox_format_t *sox_wve_format_fn(void)
+const sox_format_handler_t *sox_wve_format_fn(void)
 {
     return &sox_wve_format;
 }
--- a/src/xa.c
+++ b/src/xa.c
@@ -89,7 +89,7 @@
     }
 }
 
-static int sox_xastartread(ft_t ft)
+static int sox_xastartread(sox_format_t * ft)
 {
     xa_t xa = (xa_t) ft->priv;
     char *magic = xa->header.magic;
@@ -194,7 +194,7 @@
  * Read up to len samples from a file, converted to signed longs.
  * Return the number of samples read.
  */
-static sox_size_t sox_xaread(ft_t ft, sox_ssample_t *buf, sox_size_t len)
+static sox_size_t sox_xaread(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len)
 {
     xa_t xa = (xa_t) ft->priv;
     int32_t sample;
@@ -269,7 +269,7 @@
     return done;
 }
 
-static int sox_xastopread(ft_t ft)
+static int sox_xastopread(sox_format_t * ft)
 {
     xa_t xa = (xa_t) ft->priv;
 
@@ -284,25 +284,25 @@
     return SOX_SUCCESS;
 }
 
-static int sox_xastartwrite(ft_t ft)
+static int sox_xastartwrite(sox_format_t * ft)
 {
     sox_fail_errno(ft, SOX_ENOTSUP, ".XA writing not supported");
     return SOX_EOF;
 }
 
-static sox_size_t sox_xawrite(ft_t ft, const sox_ssample_t *buf UNUSED, sox_size_t len UNUSED)
+static sox_size_t sox_xawrite(sox_format_t * ft, const sox_ssample_t *buf UNUSED, sox_size_t len UNUSED)
 {
     sox_fail_errno(ft, SOX_ENOTSUP, ".XA writing not supported");
     return 0;
 }
 
-static int sox_xastopwrite(ft_t ft)
+static int sox_xastopwrite(sox_format_t * ft)
 {
     sox_fail_errno(ft, SOX_ENOTSUP, ".XA writing not supported");
     return SOX_EOF;
 }
 
-static int sox_xaseek(ft_t ft, sox_size_t offset)
+static int sox_xaseek(sox_format_t * ft, sox_size_t offset)
 {
     return sox_format_nothing_seek(ft, offset);
 }
@@ -313,7 +313,7 @@
     NULL
 };
 
-sox_format_t sox_xa_format = {
+sox_format_handler_t sox_xa_format = {
   xanames,
   SOX_FILE_LIT_END,
   sox_xastartread,
@@ -325,9 +325,9 @@
   sox_xaseek
 };
 
-const sox_format_t *sox_xa_format_fn(void);
+const sox_format_handler_t *sox_xa_format_fn(void);
 
-const sox_format_t *sox_xa_format_fn(void)
+const sox_format_handler_t *sox_xa_format_fn(void)
 {
   return &sox_xa_format;
 }