shithub: sox

Download patch

ref: 5a36edac0341d8e4ecab6a5eed7914893d2207e7
parent: c9d24fa2815962a3cacc2825abe7b5a49fe03978
author: robs <robs>
date: Sun Feb 17 03:15:26 EST 2008

clean-up

--- a/ChangeLog
+++ b/ChangeLog
@@ -10,17 +10,17 @@
 
 Deprecated features removed in this release:
 
-  Deprec-  Feature    [O(ption)]                           Removal
-  ated in  [F(ormat)] [E(ffect)]   Replacement             due in
-  -------  ----------------------  ----------------------  -------
-  13.0.0   O -e                    -n                      14.1.0
-  13.0.0   O -b/-w/-l/-d           -1/-2/-4/-8             14.1.0
-  13.0.0   E avg, pick             mixer                   14.1.0
-  13.0.0   E highp, lowp           highpass -1, lowpass -1 14.1.0
-  13.0.0   E mask                  dither                  14.1.0
-  13.0.0   E rate                  ~= resample             14.1.0
-  13.0.0   E vibro                 ~= tremolo              14.1.0
-  13.0.0   F auto                  Becomes internal only   14.1.0
+  Deprec-  Feature    [O(ption)]
+  ated in  [F(ormat)] [E(ffect)]   Replacement
+  -------  ----------------------  ----------------------
+  13.0.0   O -e                    -n
+  13.0.0   O -b/-w/-l/-d           -1/-2/-4/-8
+  13.0.0   E avg, pick             mixer
+  13.0.0   E highp, lowp           highpass -1, lowpass -1
+  13.0.0   E mask                  dither
+  13.0.0   E rate                  ~= resample
+  13.0.0   E vibro                 ~= tremolo
+  13.0.0   F auto                  Becomes internal only
 
 File formats:
 
@@ -57,6 +57,9 @@
   14.0.0   E pitch                 ~= key                  2008-09-11
   14.1.0   F wve (native)          wve (libsndfile)        14.1.0 + 1 year
   14.1.0   F flac: libFLAC 1.1.1   libFLAC > 1.1.1         14.1.0 + 6 months
+  14.1.0   Behaviour whereby       soxi                    14.1.0 + 1 year
+           sox -V file(s) -n
+	   doesn't read to EOF
 
 
 sox-14.0.1	2008-01-29
@@ -361,9 +364,9 @@
   o Prevent crashes when printing error mesages (1447239)
   o Added makefile and support files to compile using Open Watcom
     compiler.  (1417798) Marty
-  o Stop calling flow() on effects that returned EOF during drain().  Allows 
+  o Stop calling flow() on effects that returned EOF during drain().  Allows
     two back-to-back reverse effects to work.
-  o Added support for multiple channels in .dat files. 
+  o Added support for multiple channels in .dat files.
     (1366634) tomchristie
 
 sox-12.17.9	2005-12-05
@@ -396,7 +399,7 @@
     talking to kernel driver.  This also means that device names
     are now the ALSA logical names instead of /dev type names.
   o Added ALSA support to play/rec scripts.
-  o Added st_open*, st_read, st_write, st_seek, st_close routines 
+  o Added st_open*, st_read, st_write, st_seek, st_close routines
     to help simplify developer interface to libst.  See libst.3..
   o Removed st_initformat(), st_copyformat(), and
     st_checkformat() from library.  If your app used those
@@ -842,11 +845,11 @@
   o Matthias Nutt helped add support for specifying multiple effects
     to SoX on the command line.
   o Curt Zirzow added a trim effect to trim off audio data.
-  o Updated ALSA driver to support new interface. Jimen Ching 
+  o Updated ALSA driver to support new interface. Jimen Ching
 
 sox-12.16	1999-07-13
 ---------
-  
+
   o Changed raw data functions to perform I/O operations using block reads.
     Should improve speeds greatly, especially when filesize is in megs.
     Got code ready to tweak speed more which also forced me to clean up
@@ -877,7 +880,7 @@
     Also fix an Endian bug thats been there for quite a long time (when
     ran on Intel machines).  Made comment lengths even length to make
     most MacOS programs happy.  cbagwell
-  o Resample function was updated by Andreas Wilde 
+  o Resample function was updated by Andreas Wilde
     (andreas@eakaw2.et.tu-dresden.de) to fix problem were freqs. were
     off by a factor of 2.
   o Added an effect that swaps stereo channels.  cbagwell
@@ -900,16 +903,16 @@
     handy CHEAT.eft file for using various effects.
   o Incorporated Yamaha TX-16W sampler file support provided by
     Rob Talley (rob@aii.com) and Mark Lakata (lakata@physics.berkeley.edu).
-  o Fixed a small bug in hcom compression, dependent on sign 
+  o Fixed a small bug in hcom compression, dependent on sign
     extension.  Leigh Smith (leigh@psychokiller.dialix.oz.au).
   o sox -h now prints out the file formats and effects supported.
     Leigh Smith and Chris Bagwell.
   o smp transfers comments more completely.  Leigh Smith.
-  o aiff manages markers and loops correctly and produces more 
+  o aiff manages markers and loops correctly and produces more
     verbose output.  Leigh Smith.
   o Added polyphase resampler (kb@ece.cmu.edu).  This adds a slightly
     different resampling algorithm to the mix.
-  o Michael Brown (mjb@pootle.demon.co.uk) sent a patch to stop crashes 
+  o Michael Brown (mjb@pootle.demon.co.uk) sent a patch to stop crashes
     from happening when reading mono MS ADPCM files.
   o Fabrice Bellard has added a less buggy 'rate' conversion.  I've left
     the old rate code included but if all goes well this will become
@@ -941,7 +944,7 @@
   o Added path string to play and rec strings so that it could be run by
     users without complete paths setup (i.e. Ran by "rc" files during bootup
     or shutdown)
-  o Fixed -e option from Richard Guenther 
+  o Fixed -e option from Richard Guenther
       (richard.guenther@student.uni-tuebingen.de) and fixed a small bug
     in stat.
   o Fixed a bug in the mask effect for ULAW/ALAW files.
@@ -966,7 +969,7 @@
   o Speaking of cleanups, anyone want to help cleanup the makefiles for
     various platforms?  They are quite outdated right now and it is
     very obvious that Sox hasn't been able to compile under all the
-    platforms it once did for several releases.  Please send in 
+    platforms it once did for several releases.  Please send in
     the cleaned-up makefile versions along with what programs you
     used to compile it with.
   o There is a known bug in hcom's compress() function.  It is allocating
@@ -1024,7 +1027,7 @@
      sox effects after the filename and hear them in real time.
      Please be sure that an older version of sox is not in your path
      because these script will possibly find it first and
-     incorrectly use it.  
+     incorrectly use it.
   o  Setting play/record volume still requires an external program.
      If you have one a command line program to do this (such as
      "mixer" for Linux) then you will want to edit the play and rec
--- a/src/aifc-fmt.c
+++ b/src/aifc-fmt.c
@@ -20,7 +20,7 @@
 
 static sox_format_handler_t sox_aifc_format = {
   aifcnames,
-  SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_BIG_END,
+  SOX_FILE_LOOPS | SOX_FILE_BIG_END,
   sox_aiffstartread,
   sox_aiffread,
   sox_aiffstopread,
--- a/src/aiff-fmt.c
+++ b/src/aiff-fmt.c
@@ -20,7 +20,7 @@
 
 static sox_format_handler_t sox_aiff_format = {
   aiffnames,
-  SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_BIG_END,
+  SOX_FILE_LOOPS | SOX_FILE_BIG_END,
   sox_aiffstartread,
   sox_aiffread,
   sox_aiffstopread,
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -656,9 +656,7 @@
                 }
             }
         }
-
-        /* Needed because of sox_rawwrite() */
-        return sox_rawstopread(ft);
+        return SOX_SUCCESS;
 }
 
 /* When writing, the header is supposed to contain the number of
@@ -712,7 +710,6 @@
 int sox_aiffstopwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
-        int rc;
 
         /* If we've written an odd number of bytes, write a padding
            NUL */
@@ -722,13 +719,6 @@
             sox_rawwrite(ft, &buf, 1);
         }
 
-        /* Needed because of sox_rawwrite().  Call now to flush
-         * buffer now before seeking around below.
-         */
-        rc = sox_rawstopwrite(ft);
-        if (rc)
-            return rc;
-
         if (!ft->seekable)
         {
             sox_fail_errno(ft,SOX_EOF,"Non-seekable file.");
@@ -918,7 +908,6 @@
 int sox_aifcstopwrite(sox_format_t * ft)
 {
         aiff_t aiff = (aiff_t ) ft->priv;
-        int rc;
 
         /* If we've written an odd number of bytes, write a padding
            NUL */
@@ -927,13 +916,6 @@
             sox_sample_t buf = 0;
             sox_rawwrite(ft, &buf, 1);
         }
-
-        /* Needed because of sox_rawwrite().  Call now to flush
-         * buffer now before seeking around below.
-         */
-        rc = sox_rawstopwrite(ft);
-        if (rc)
-            return rc;
 
         if (!ft->seekable)
         {
--- a/src/amr.h
+++ b/src/amr.h
@@ -167,7 +167,7 @@
     names, 0,
     startread, read, stopread,
     startwrite, write, stopwrite,
-    sox_format_nothing_seek
+    NULL
   };
   return &handler;
 }
--- a/src/au.c
+++ b/src/au.c
@@ -360,15 +360,7 @@
 static int sox_austopwrite(sox_format_t * ft)
 {
         au_t p = (au_t ) ft->priv;
-        int rc;
 
-        /* Needed because of rawwrite(). Do now to flush
-         * data before seeking around below.
-         */
-        rc = sox_rawstopwrite(ft);
-        if (rc)
-            return rc;
-
         /* Attempt to update header */
         if (ft->seekable)
         {
@@ -485,7 +477,7 @@
  */
 static sox_format_handler_t sox_au_format = {
   aunames,
-  SOX_FILE_SEEK | SOX_FILE_BIG_END,
+  SOX_FILE_BIG_END,
   sox_austartread,
   sox_auread,
   sox_rawstopread,
--- a/src/avr.c
+++ b/src/avr.c
@@ -258,14 +258,9 @@
 static int sox_avrstopwrite(sox_format_t * ft) 
 {
   avr_t avr = (avr_t)ft->priv;
-  int rc;
 
   unsigned size = avr->size / ft->signal.channels;
 
-  rc = sox_rawstopwrite(ft);
-  if (rc)
-      return rc;
-
   /* Fix size */
   sox_seeki(ft, 26, SEEK_SET);
   sox_writedw (ft, size);
@@ -287,7 +282,7 @@
   SOX_FILE_BIG_END,
   sox_avrstartread,
   sox_rawread,
-  sox_format_nothing,
+  NULL,
   sox_avrstartwrite,
   sox_avrwrite,
   sox_avrstopwrite,
--- a/src/cdr.c
+++ b/src/cdr.c
@@ -1,5 +1,5 @@
 /*
- * CD-R format handler
+ * CD Digital Audio format handler: pads to integer number of CDDA sectors
  *
  * David Elliott, Sony Microsystems -  July 5, 1991
  *
@@ -6,163 +6,56 @@
  * Copyright 1991 David Elliott And Sundry Contributors
  * This source code is freely redistributable and may be used for
  * any purpose.  This copyright notice must be maintained. 
- * Lance Norskog And Sundry Contributors are not responsible for 
+ * David Elliott And Sundry Contributors are not responsible for 
  * the consequences of using this software.
- *
- * This code automatically handles endianness differences
- *
- * cbagwell (cbagwell@sprynet.com) - 20 April 1998
- *
- *   Changed endianness handling.  Seemed to be reversed (since format
- *   is in big endian) and made it so that user could always override
- *   swapping no matter what endian machine they are one.
- *
- *   Fixed bug were trash could be appended to end of file for certain
- *   endian machines.
- *
  */
 
 #include "sox_i.h"
 
-#define SECTORSIZE      (2352 / 2)
+#define SECTOR_SIZE   (2352 / 2)
+#define samples       (*(sox_size_t *)ft->priv)
 
-/* Private data for SKEL file */
-typedef struct cdrstuff {
-        sox_size_t samples;      /* number of samples written */
-} *cdr_t;
-
-/*
- * Do anything required before you start reading samples.
- * Read file header. 
- *      Find out sampling rate, 
- *      size and encoding of samples, 
- *      mono/stereo/quad.
- */
-
-static int sox_cdrstartread(sox_format_t * ft) 
+static int start(sox_format_t * ft) 
 {
-        int rc;
+  ft->signal.rate = 44100;
+  ft->signal.size = SOX_SIZE_16BIT;
+  ft->signal.encoding = SOX_ENCODING_SIGN2;
+  ft->signal.channels = 2;
 
-        /* Needed because of rawread() */
-        rc = sox_rawstartread(ft);
-        if (rc)
-            return rc;
-
-        ft->signal.rate = 44100;
-        ft->signal.size = SOX_SIZE_16BIT;
-        ft->signal.encoding = SOX_ENCODING_SIGN2;
-        ft->signal.channels = 2;
-
-/* Need length for seeking */
-        if(ft->seekable){
-                ft->length = sox_filelength(ft)/SOX_SIZE_16BIT;
-        } else {
-                ft->length = 0;
-        }
-        
-        return(SOX_SUCCESS);
+  if (ft->mode == 'r' && ft->seekable) /* Need length for seeking */
+    ft->length = sox_filelength(ft)/SOX_SIZE_16BIT;
+  
+  return SOX_SUCCESS;
 }
 
-/*
- * Read up to len samples from file.
- * Convert to signed longs.
- * Place in buf[].
- * Return number of samples read.
- */
-
-static sox_size_t sox_cdrread(sox_format_t * ft, sox_sample_t *buf, sox_size_t len) 
+static sox_size_t write(
+    sox_format_t * ft, const sox_sample_t *buf, sox_size_t len) 
 {
-
-        return sox_rawread(ft, buf, len);
+  samples += len;
+  return sox_rawwrite(ft, buf, len);
 }
 
-/*
- * Do anything required when you stop reading samples.  
- * Don't close input file! 
- */
-static int sox_cdrstopread(sox_format_t * ft) 
+static int stopwrite(sox_format_t * ft) 
 {
-        /* Needed because of rawread() */
-        return sox_rawstopread(ft);
-}
+  sox_size_t i = samples % SECTOR_SIZE;
 
-static int sox_cdrstartwrite(sox_format_t * ft) 
-{
-        cdr_t cdr = (cdr_t) ft->priv;
-        int rc;
+  if (i) while (i++ < SECTOR_SIZE)     /* Pad with silence to multiple */
+    sox_writew(ft, 0);                 /* of SECTOR_SIZE samples. */
 
-        /* Needed because of rawwrite() */
-        rc = sox_rawstartwrite(ft);
-        if (rc)
-            return rc;
-
-        cdr->samples = 0;
-
-        ft->signal.rate = 44100;
-        ft->signal.size = SOX_SIZE_16BIT;
-        ft->signal.encoding = SOX_ENCODING_SIGN2;
-        ft->signal.channels = 2;
-
-        return(SOX_SUCCESS);
+  return SOX_SUCCESS;
 }
 
-static sox_size_t sox_cdrwrite(sox_format_t * ft, const sox_sample_t *buf, sox_size_t len) 
-{
-        cdr_t cdr = (cdr_t) ft->priv;
-
-        cdr->samples += len;
-
-        return sox_rawwrite(ft, buf, len);
-}
-
-/*
- * A CD-R file needs to be padded to SECTORSIZE, which is in terms of
- * samples.  We write -32768 for each sample to pad it out.
- */
-
-static int sox_cdrstopwrite(sox_format_t * ft) 
-{
-        cdr_t cdr = (cdr_t) ft->priv;
-        int padsamps = SECTORSIZE - (cdr->samples % SECTORSIZE);
-        int rc;
-
-        /* Flush buffer before writing anything else */
-        rc = sox_rawstopwrite(ft);
-
-        if (rc)
-            return rc;
-
-        if (padsamps != SECTORSIZE) 
-        {
-                while (padsamps > 0) {
-                        sox_writew(ft, 0);
-                        padsamps--;
-                }
-        }
-        return(SOX_SUCCESS);
-}
-
-static const char *cdrnames[] = {
-  "cdda",
-  "cdr",
-  NULL
-};
-
-static sox_format_handler_t sox_cdr_format = {
-  cdrnames,
-  SOX_FILE_SEEK | SOX_FILE_BIG_END,
-  sox_cdrstartread,
-  sox_cdrread,
-  sox_cdrstopread,
-  sox_cdrstartwrite,
-  sox_cdrwrite,
-  sox_cdrstopwrite,
-  sox_rawseek
-};
-
 const sox_format_handler_t *sox_cdr_format_fn(void);
-
 const sox_format_handler_t *sox_cdr_format_fn(void)
 {
-    return &sox_cdr_format;
+  static const char * names[] = {"cdda", "cdr", NULL};
+
+  static sox_format_handler_t handler = {
+    names, SOX_FILE_BIG_END,
+    start, sox_rawread, NULL,
+    start, write, stopwrite,
+    sox_rawseek
+  };
+
+  return &handler;
 }
--- a/src/dat.c
+++ b/src/dat.c
@@ -162,10 +162,10 @@
   0,
   sox_datstartread,
   sox_datread,
-  sox_format_nothing,
+  NULL,
   sox_datstartwrite,
   sox_datwrite,
-  sox_format_nothing,
+  NULL,
   NULL
 };
 
--- a/src/flac.c
+++ b/src/flac.c
@@ -525,7 +525,7 @@
 {
   static char const * const names[] = {"flac", NULL};
   static sox_format_handler_t handler = {
-    names, SOX_FILE_SEEK,
+    names, 0,
     start_read, read, stop_read,
     start_write, write, stop_write,
     seek
--- a/src/maud.c
+++ b/src/maud.c
@@ -241,13 +241,6 @@
 
 static int sox_maudstopwrite(sox_format_t * ft) 
 {
-        int rc;
-
-        /* Flush out remaining samples*/
-        rc = sox_rawstopwrite(ft);
-        if (rc)
-            return rc;
-
         /* All samples are already written out. */
         
         if (sox_seeki(ft, 0, 0) != 0) 
--- a/src/misc.c
+++ b/src/misc.c
@@ -309,11 +309,6 @@
     return (sdf);
 }
 
-
-/* dummy format routines for do-nothing functions */
-int sox_format_nothing(sox_format_t * ft UNUSED) { return(SOX_SUCCESS); }
-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_sample_t sox_gcd(sox_sample_t a, sox_sample_t b)
 {
--- a/src/prc.c
+++ b/src/prc.c
@@ -261,7 +261,7 @@
   if (ft->signal.encoding == SOX_ENCODING_IMA_ADPCM)
     return sox_adpcm_stopread(ft, &p->adpcm);
   else
-    return sox_rawstopread(ft);
+    return SOX_SUCCESS;
 }
 
 /* When writing, the header is supposed to contain the number of
@@ -372,10 +372,6 @@
 {
   prc_t p = (prc_t)ft->priv;
 
-  /* Call before seeking to flush buffer (ADPCM has already been flushed) */
-  if (ft->signal.encoding != SOX_ENCODING_IMA_ADPCM)
-    sox_rawstopwrite(ft);
-
   p->nbytes = sox_tell(ft) - p->data_start;
 
   if (!ft->seekable) {
@@ -423,7 +419,7 @@
 
 static sox_format_handler_t sox_prc_format = {
   prcnames,
-  SOX_FILE_SEEK | SOX_FILE_LIT_END,
+  SOX_FILE_LIT_END,
   startread,
   read,
   stopread,
--- a/src/raw-fmt.c
+++ b/src/raw-fmt.c
@@ -20,7 +20,7 @@
 {
   static char const * names[] = {"raw", NULL};
   static sox_format_handler_t handler = {
-    names, SOX_FILE_SEEK,
+    names, 0,
     raw_start, sox_rawread , NULL,
     raw_start, sox_rawwrite, NULL,
     sox_rawseek
--- a/src/raw.h
+++ b/src/raw.h
@@ -17,9 +17,9 @@
 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, \
-    sox_format_nothing_seek \
+    id ## _start, sox_rawread , NULL, \
+    id ## _start, sox_rawwrite, NULL, \
+    NULL \
   }; \
   return &handler; \
 }
--- a/src/sf.c
+++ b/src/sf.c
@@ -226,7 +226,7 @@
 
 static sox_format_handler_t sox_sf_format = {
   sfnames,
-  SOX_FILE_SEEK,
+  0,
   sox_sfstartread,
   sox_rawread,
   sox_rawstopread,
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -209,7 +209,7 @@
  */
 static sox_format_handler_t sox_skel_format = {
   names,
-  SOX_FILE_SEEK,
+  0,
   startread,
   read,
   stopread,
--- a/src/smp.c
+++ b/src/smp.c
@@ -409,10 +409,10 @@
 
 static sox_format_handler_t sox_smp_format = {
   smpnames,
-  SOX_FILE_LOOPS | SOX_FILE_SEEK | SOX_FILE_LIT_END,
+  SOX_FILE_LOOPS | SOX_FILE_LIT_END,
   sox_smpstartread,
   sox_smpread,
-  sox_format_nothing,
+  NULL,
   sox_smpstartwrite,
   sox_smpwrite,
   sox_smpstopwrite,
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -454,7 +454,7 @@
 /* Format descriptor */
 static sox_format_handler_t format = {
   names,
-  SOX_FILE_SEEK | SOX_FILE_NOSTDIO,
+  SOX_FILE_NOSTDIO,
   startread,
   read,
   stopread,
--- a/src/sndrtool.c
+++ b/src/sndrtool.c
@@ -154,13 +154,7 @@
 static int sox_sndtstopwrite(sox_format_t * ft)
 {
   snd_t p = (snd_t) ft->priv;
-  int rc;
 
-  /* Flush remaining buffer out */
-  rc = sox_rawstopwrite(ft);
-  if (rc)
-    return rc;
-
   /* fixup file sizes in header */
   if (sox_seeki(ft, 0, 0) != 0) {
     sox_fail_errno(ft, errno,
@@ -182,7 +176,7 @@
 
 static const sox_format_handler_t sox_snd_format = {
   sndtnames,
-  SOX_FILE_SEEK | SOX_FILE_LIT_END,
+  SOX_FILE_LIT_END,
   sox_sndtstartread,
   sox_rawread,
   sox_rawstopread,
--- a/src/sox.c
+++ b/src/sox.c
@@ -1323,7 +1323,7 @@
    * gigs of audio data into managable chunks
    */ 
   if (input_count == 1 && ofile_effects_chain.length > 1 && strcmp(ofile_effects_chain.effects[1][0].handler.name, "trim") == 0) {
-    if ((files[0]->ft->handler->flags & SOX_FILE_SEEK) && files[0]->ft->seekable){
+    if (files[0]->ft->handler->seek && files[0]->ft->seekable){
       sox_size_t offset = sox_trim_get_start(&ofile_effects_chain.effects[1][0]);
       if (offset && sox_seek(files[0]->ft, offset, SOX_SEEK_SET) == SOX_SUCCESS) { 
         read_wide_samples = offset / files[0]->ft->signal.channels;
--- a/src/sox.h
+++ b/src/sox.h
@@ -330,7 +330,6 @@
 /* file flags field */
 #define SOX_FILE_LOOPS   1  /* does file format support loops? */
 #define SOX_FILE_INSTR   2  /* does file format support instrument specs? */
-#define SOX_FILE_SEEK    4  /* does file format support seeking? */
 #define SOX_FILE_NOSTDIO 8  /* does not use stdio routines */
 #define SOX_FILE_DEVICE  16 /* file is an audio device */
 #define SOX_FILE_PHONY   32 /* phony file/device */
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -322,20 +322,11 @@
 int sox_rawstartwrite(sox_format_t * ft);
 sox_size_t sox_rawwrite(sox_format_t * ft, const sox_sample_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 doesn't need to do anything special
- */
-int sox_format_nothing(sox_format_t * ft);
-sox_size_t sox_format_nothing_read(sox_format_t * ft, sox_sample_t *buf, sox_size_t len);
-sox_size_t sox_format_nothing_write(sox_format_t * ft, const sox_sample_t *buf, sox_size_t len);
-int sox_format_nothing_seek(sox_format_t * ft, sox_size_t offset);
-
 int sox_rawstart(sox_format_t * ft, sox_bool default_rate, sox_bool default_channels, sox_encoding_t encoding, unsigned size);
 #define sox_rawstartread(ft) sox_rawstart(ft, sox_false, sox_false, SOX_ENCODING_UNKNOWN, 0)
 #define sox_rawstartwrite sox_rawstartread
-#define sox_rawstopread sox_format_nothing
-#define sox_rawstopwrite sox_format_nothing
+#define sox_rawstopread NULL
+#define sox_rawstopwrite NULL
 
 
 
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -582,12 +582,11 @@
         return SOX_EOF; /* FIXME: return SOX_EINVAL */
 
     /* If file is a seekable file and this handler supports seeking,
-     * the invoke handlers function.
+     * then invoke handler's function.
      */
-    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 */
+    if (ft->seekable && ft->handler->seek)
+      return (*ft->handler->seek)(ft, offset);
+    return SOX_EOF; /* FIXME: return SOX_EBADF */
 }
 
 sox_bool sox_is_playlist(char const * filename)
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -216,14 +216,9 @@
 
 static int sox_spherestopwrite(sox_format_t * ft) 
 {
-    int rc;
     char buf[128];
     sphere_t sphere = (sphere_t) ft->priv;
     long samples, rate;
-
-    rc = sox_rawstopwrite(ft);
-    if (rc)
-        return rc;
 
     if (sox_seeki(ft, 0, 0) != 0)
     {
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -374,7 +374,7 @@
    0,
    sox_txwstartread,
    sox_txwread,
-   sox_format_nothing,
+   NULL,
    sox_txwstartwrite,
    sox_txwwrite,
    sox_txwstopwrite,
--- a/src/voc.c
+++ b/src/voc.c
@@ -804,7 +804,7 @@
   SOX_FILE_LIT_END,
   sox_vocstartread,
   sox_vocread,
-  sox_format_nothing,
+  NULL,
   sox_vocstartwrite,
   sox_vocwrite,
   sox_vocstopwrite,
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -400,7 +400,7 @@
 {
   static const char *names[] = {"vorbis", "ogg", NULL};
   static sox_format_handler_t handler = {
-    names, SOX_FILE_SEEK,
+    names, 0,
     startread, read, stopread,
     startwrite, write, stopwrite,
     seek
--- a/src/wav.c
+++ b/src/wav.c
@@ -1101,9 +1101,8 @@
 static int sox_wavstopread(sox_format_t * ft) 
 {
     wav_t       wav = (wav_t) ft->priv;
-    int         rc = SOX_SUCCESS;
 
-        ft->sox_errno = SOX_SUCCESS;
+    ft->sox_errno = SOX_SUCCESS;
 
     free(wav->packet);
     free(wav->samples);
@@ -1120,10 +1119,9 @@
     case SOX_ENCODING_ADPCM:
         break;
     default:
-        /* Needed for rawread() */
-        rc = sox_rawstopread(ft);
+        break;
     }
-    return rc;
+    return SOX_SUCCESS;
 }
 
 static int sox_wavstartwrite(sox_format_t * ft) 
@@ -1599,12 +1597,6 @@
         free(wav->samples);
         free(wav->iCoefs);
 
-        /* Flush any remaining data */
-        if (wav->formatTag != WAVE_FORMAT_IMA_ADPCM &&
-            wav->formatTag != WAVE_FORMAT_ADPCM &&
-            wav->formatTag != WAVE_FORMAT_GSM610)
-            sox_rawstopwrite(ft);
-
         /* All samples are already written out. */
         /* If file header needs fixing up, for example it needs the */
         /* the number of samples in a field, seek back and write them here. */
@@ -1739,7 +1731,7 @@
 
 static sox_format_handler_t sox_wav_format = {
   wavnames,
-  SOX_FILE_SEEK | SOX_FILE_LIT_END,
+  SOX_FILE_LIT_END,
   sox_wavstartread,
   sox_wavread,
   sox_wavstopread,
--- a/src/wve.c
+++ b/src/wve.c
@@ -118,13 +118,7 @@
 static int sox_wvestartwrite(sox_format_t * ft)
 {
         wve_t p = (wve_t)ft->priv;
-        int rc;
 
-        /* Needed for rawwrite() */
-        rc = sox_rawstartwrite(ft);
-        if (rc)
-            return SOX_EOF;
-
         p->length = 0;
         if (p->repeats == 0)
             p->repeats = 1;
@@ -154,9 +148,6 @@
 static int sox_wvestopwrite(sox_format_t * ft)
 {
 
-        /* Call before seeking to flush buffer */
-        sox_rawstopwrite(ft);
-
         if (!ft->seekable)
         {
             sox_warn("Header will be have invalid file length since file is not seekable");
@@ -207,7 +198,7 @@
 
 static sox_format_handler_t sox_wve_format = {
   wvenames,
-  SOX_FILE_SEEK | SOX_FILE_BIG_END,
+  SOX_FILE_BIG_END,
   sox_wvestartread,
   sox_rawread,
   sox_rawstopread,