shithub: sox

Download patch

ref: ac98ed3eb993a415a44ca4c8338f2ce10daeecb9
parent: 3fa0b14620e9c84c1fac5eb6e70b5db93b2bf4af
author: robs <robs>
date: Sat Jan 13 18:02:49 EST 2007

Clean-up file format flags; default to show-progress when recording; don't show progress when verbose.

--- a/src/8svx.c
+++ b/src/8svx.c
@@ -368,7 +368,7 @@
 static st_format_t st_svx_format = {
   svxnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_BIG_END,
+  ST_FILE_BIG_END,
   st_svxstartread,
   st_svxread,
   st_svxstopread,
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -1204,7 +1204,7 @@
 static st_format_t st_aiff_format = {
   aiffnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_BIG_END,
+  ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_BIG_END,
   st_aiffstartread,
   st_aiffread,
   st_aiffstopread,
@@ -1228,7 +1228,7 @@
 static st_format_t st_aifc_format = {
   aifcnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_BIG_END,
+  ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_BIG_END,
   st_aiffstartread,
   st_aiffread,
   st_aiffstopread,
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -686,16 +686,16 @@
 };
 
 static st_format_t st_alsa_format = {
-   alsanames,
-   NULL,
-   ST_FILE_STEREO | ST_FILE_NOSTDIO | ST_FILE_NOFEXT,
-   st_alsastartread,
-   st_alsaread,
-   st_alsastopread,
-   st_alsastartwrite,
-   st_alsawrite,
-   st_alsastopwrite,
-   st_format_nothing_seek
+  alsanames,
+  NULL,
+  ST_FILE_DEVICE | ST_FILE_NOSTDIO,
+  st_alsastartread,
+  st_alsaread,
+  st_alsastopread,
+  st_alsastartwrite,
+  st_alsawrite,
+  st_alsastopwrite,
+  st_format_nothing_seek
 };
 
 const st_format_t *st_alsa_format_fn(void)
--- a/src/au.c
+++ b/src/au.c
@@ -469,7 +469,7 @@
 static st_format_t st_au_format = {
   aunames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK | ST_FILE_BIG_END,
+  ST_FILE_SEEK | ST_FILE_BIG_END,
   st_austartread,
   st_auread,
   st_rawstopread,
--- a/src/auto.c
+++ b/src/auto.c
@@ -194,7 +194,7 @@
 static st_format_t st_auto_format = {
   autonames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_NOFEXT,
+  ST_FILE_DEVICE | ST_FILE_PHONY,
   st_autostartread,
   st_format_nothing_read_io,
   st_format_nothing,
--- a/src/avr.c
+++ b/src/avr.c
@@ -285,7 +285,7 @@
 static st_format_t st_avr_format = {
   avrnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_BIG_END,
+  ST_FILE_BIG_END,
   st_avrstartread,
   st_rawread,
   st_format_nothing,
--- a/src/cdr.c
+++ b/src/cdr.c
@@ -155,7 +155,7 @@
 static st_format_t st_cdr_format = {
   cdrnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK | ST_FILE_BIG_END,
+  ST_FILE_SEEK | ST_FILE_BIG_END,
   st_cdrstartread,
   st_cdrread,
   st_cdrstopread,
--- a/src/flac.c
+++ b/src/flac.c
@@ -468,7 +468,7 @@
 {
   st_format_names,
   NULL,
-  ST_FILE_STEREO,
+  0,
   st_format_start_read,
   st_format_read,
   st_format_stop_read,
--- a/src/maud.c
+++ b/src/maud.c
@@ -349,7 +349,7 @@
 static st_format_t st_maud_format = {
   maudnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_BIG_END,
+  ST_FILE_BIG_END,
   st_maudstartread,
   st_rawread,
   st_rawstopread,
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -554,7 +554,7 @@
 static st_format_t st_mp3_format = {
   mp3names,
   NULL,
-  ST_FILE_STEREO,
+  0,
   st_mp3startread,
   st_mp3read,
   st_mp3stopread,
--- a/src/nulfile.c
+++ b/src/nulfile.c
@@ -51,7 +51,7 @@
 static st_format_t st_nul_format = {
   nulnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_NOSTDIO | ST_FILE_NOFEXT,
+  ST_FILE_DEVICE | ST_FILE_PHONY | ST_FILE_NOSTDIO,
   st_nulstartread,
   st_nulread,
   st_format_nothing,
--- a/src/oss.c
+++ b/src/oss.c
@@ -221,7 +221,7 @@
 static st_format_t st_ossdsp_format = {
   ossdspnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_NOFEXT,
+  ST_FILE_DEVICE,
   st_ossdspstartread,
   st_rawread,
   st_rawstopread,
--- a/src/raw.c
+++ b/src/raw.c
@@ -55,7 +55,7 @@
 
 /* Works nicely for starting read and write; st_rawstart{read,write}
    are #defined in st_i.h */
-int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_reverse_t rev_bits)
+int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits)
 {
   if (default_rate && ft->signal.rate == 0) {
     st_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
@@ -82,9 +82,9 @@
     else ft->signal.size = size;
   }
 
-  if (rev_bits != ST_REVERSE_DEFAULT) {
+  if (rev_bits != ST_OPTION_DEFAULT) {
     if (ft->mode == 'r' &&
-        ft->signal.reverse_bits != ST_REVERSE_DEFAULT &&
+        ft->signal.reverse_bits != ST_OPTION_DEFAULT &&
         ft->signal.reverse_bits != rev_bits)
       st_report("'%s': Format options overriding file-type bit-order", ft->filename);
     else ft->signal.reverse_bits = rev_bits;
@@ -256,12 +256,12 @@
 }
 
 static int raw_start(ft_t ft) {
-  return st_rawstart(ft,false,false,ST_ENCODING_UNKNOWN,-1,ST_REVERSE_DEFAULT);
+  return st_rawstart(ft,false,false,ST_ENCODING_UNKNOWN,-1,ST_OPTION_DEFAULT);
 }
 st_format_t const * st_raw_format_fn(void) {
   static char const * names[] = {"raw", NULL};
   static st_format_t driver = {
-    names, NULL, ST_FILE_STEREO | ST_FILE_SEEK,
+    names, NULL, ST_FILE_SEEK,
     raw_start, st_rawread , st_rawstopread,
     raw_start, st_rawwrite, st_rawstopwrite,
     st_rawseek
@@ -271,12 +271,12 @@
 
 #define RAW_FORMAT(id,alt1,alt2,size,rev_bits,encoding) \
 static int id##_start(ft_t ft) { \
-  return st_rawstart(ft,true,true,ST_ENCODING_##encoding,ST_SIZE_##size,ST_REVERSE_##rev_bits); \
+  return st_rawstart(ft,true,true,ST_ENCODING_##encoding,ST_SIZE_##size,ST_OPTION_##rev_bits); \
 } \
 st_format_t const * st_##id##_format_fn(void) { \
   static char const * names[] = {#id, alt1, alt2, NULL}; \
   static st_format_t driver = { \
-    names, NULL, ST_FILE_STEREO, \
+    names, NULL, 0, \
     id##_start, st_rawread , st_rawstopread, \
     id##_start, st_rawwrite, st_rawstopwrite, \
     st_format_nothing_seek \
--- a/src/sf.c
+++ b/src/sf.c
@@ -226,7 +226,7 @@
 static st_format_t st_sf_format = {
   sfnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK,
+  ST_FILE_SEEK,
   st_sfstartread,
   st_rawread,
   st_rawstopread,
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -214,7 +214,7 @@
 static st_format_t st_skel_format = {
   skel_names,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK,
+  ST_FILE_SEEK,
   skel_startread,
   skel_read,
   skel_stopread,
--- a/src/smp.c
+++ b/src/smp.c
@@ -410,7 +410,7 @@
 static st_format_t st_smp_format = {
   smpnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_LIT_END,
+  ST_FILE_LOOPS | ST_FILE_SEEK | ST_FILE_LIT_END,
   st_smpstartread,
   st_smpread,
   st_format_nothing,
--- a/src/sndrtool.c
+++ b/src/sndrtool.c
@@ -187,7 +187,7 @@
 const st_format_t st_snd_format = {
   sndtnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK | ST_FILE_LIT_END,
+  ST_FILE_SEEK | ST_FILE_LIT_END,
   st_sndtstartread,
   st_rawread,
   st_rawstopread,
--- a/src/sox.c
+++ b/src/sox.c
@@ -64,8 +64,7 @@
 static int user_abort = 0;
 static int success = 0;
 
-static int quiet = 0;
-static int status = 0;
+static st_option_t show_progress = ST_OPTION_DEFAULT;
 static unsigned long input_samples = 0;
 static unsigned long read_samples = 0;
 static unsigned long output_samples = 0;
@@ -213,9 +212,9 @@
   fi->signal.size = -1;
   fi->signal.encoding = ST_ENCODING_UNKNOWN;
   fi->signal.channels = 0;
-  fi->signal.reverse_bytes = ST_REVERSE_DEFAULT;
-  fi->signal.reverse_nibbles = ST_REVERSE_DEFAULT;
-  fi->signal.reverse_bits = ST_REVERSE_DEFAULT;
+  fi->signal.reverse_bytes = ST_OPTION_DEFAULT;
+  fi->signal.reverse_nibbles = ST_OPTION_DEFAULT;
+  fi->signal.reverse_bits = ST_OPTION_DEFAULT;
   fi->signal.compression = HUGE_VAL;
   fi->volume = HUGE_VAL;
   fi->volume_clips = 0;
@@ -309,8 +308,8 @@
       exit(1);
     }
 
-    for (i = 0; i < file_count; i++)
-      file_opts[i + 1] = file_opts[i];
+    for (i = file_count; i > 0; -- i)
+      file_opts[i] = file_opts[i - 1];
 
     file_count++;
     set_device(fo);
@@ -334,42 +333,37 @@
             "\tuse 'vol' to set the output file volume");
   
   for (i = 0; i < input_count; i++) {
+    int j = input_count - 1 - i;
+    file_info_t fi = file_opts[j];
     /* When mixing audio, default to input side volume
      * adjustments that will make sure no clipping will
      * occur.  Users most likely won't be happy with
      * this and will want to override it. */
     if (combine_method == SOX_MIX && !uservolume)
-      file_opts[i]->volume = 1.0 / input_count;
+      file_opts[j]->volume = 1.0 / input_count;
       
-    if (!rec || i) {
-      file_desc[i] = st_open_read(file_opts[i]->filename,
-                                &file_opts[i]->signal, 
-                                file_opts[i]->filetype);
-      if (!file_desc[i])
-        /* st_open_read() will call st_warn for most errors.
-         * Rely on that printing something. */
-        exit(2);
+    if (rec && !j) { /* Set the recording sample rate & # of channels: */
+      if (input_count > 1) {   /* Get them from the next input file: */
+        fi->signal.rate = file_desc[1]->signal.rate;
+        fi->signal.channels = file_desc[1]->signal.channels;
+      }
+      else { /* Get them from the output file (which is not open yet): */
+        fi->signal.rate = file_opts[1]->signal.rate;
+        fi->signal.channels = file_opts[1]->signal.channels;
+      }
     }
-  }
-  if (rec) { /* Set the recording sample rate & # of channels: */
-    if (input_count > 1) {   /* Get them from the next input file: */
-      file_opts[0]->signal.rate = file_desc[1]->signal.rate;
-      file_opts[0]->signal.channels = file_desc[1]->signal.channels;
-    }
-    else { /* Get them from the output file (which is not open yet): */
-      file_opts[0]->signal.rate = file_opts[1]->signal.rate;
-      file_opts[0]->signal.channels = file_opts[1]->signal.channels;
-    }
-    file_desc[0] = st_open_read(file_opts[0]->filename,
-                              &file_opts[0]->signal, 
-                              file_opts[0]->filetype);
-    if (!file_desc[0])
+    file_desc[j] = st_open_read(fi->filename, &fi->signal, fi->filetype);
+    if (!file_desc[j])
       /* st_open_read() will call st_warn for most errors.
        * Rely on that printing something. */
       exit(2);
+    if (show_progress == ST_OPTION_DEFAULT &&
+        (file_desc[j]->h->flags & ST_FILE_DEVICE) != 0 &&
+        (file_desc[j]->h->flags & ST_FILE_PHONY) == 0)
+      show_progress = ST_OPTION_YES;
   }
     
-  /* Loop through the reset of the arguments looking for effects */
+  /* Loop through the rest of the arguments looking for effects */
   parse_effects(argc, argv);
 
   if (repeatable_random)
@@ -391,7 +385,7 @@
       st_warn("%s: -v clipped %u samples; decrease volume?", file_opts[i]->filename,
               file_opts[i]->volume_clips);
 
-  if (status) {
+  if (show_progress) {
     if (user_abort)
       fprintf(stderr, "Aborted.\n");
     else
@@ -621,15 +615,15 @@
       break;
 
     case 'x':
-      fi->signal.reverse_bytes = ST_REVERSE_YES;
+      fi->signal.reverse_bytes = ST_OPTION_YES;
       break;
 
     case 'X':
-      fi->signal.reverse_bits = ST_REVERSE_YES;
+      fi->signal.reverse_bits = ST_OPTION_YES;
       break;
 
     case 'N':
-      fi->signal.reverse_nibbles = ST_REVERSE_YES;
+      fi->signal.reverse_nibbles = ST_OPTION_YES;
       break;
 
     case 'V':
@@ -644,13 +638,11 @@
       break;
 
     case 'S':
-      status = 1;
-      quiet = 0;
+      show_progress = ST_OPTION_YES;
       break;
 
     case 'q':
-      status = 0;
-      quiet = 1;
+      show_progress = ST_OPTION_NO;
       break;
     }
   }
@@ -671,7 +663,7 @@
   char const * type =
     (strcmp(f->filename, "-") == 0 ||
      strcmp(f->filename, "--") == 0 ||
-          f->h->flags & ST_FILE_NOFEXT)? 
+          f->h->flags & ST_FILE_DEVICE)? 
           f->h->names[0] : "\b ";
 
   st_report("\n\n%s: \"%s\" (%s%c\n"
@@ -773,13 +765,11 @@
       exit(2);
     
     /* When writing to an audio device, auto turn on the
-     * status display to match behavior of ogg123 status,
+     * progress display to match behavior of ogg123,
      * unless the user requested us not to display anything. */
-    if ((strcmp(ofile->filetype, "alsa") == 0 ||
-        strcmp(ofile->filetype, "ossdsp") == 0 ||
-         strcmp(ofile->filetype, "sunau") == 0) &&
-        !quiet)
-      status = 1;
+    if (show_progress == ST_OPTION_DEFAULT)
+      show_progress = (ofile->h->flags & ST_FILE_DEVICE) != 0 &&
+                      (ofile->h->flags & ST_FILE_PHONY) == 0;
 
     report_file(ofile);
   }
@@ -814,7 +804,7 @@
       }
       ibuf[f] = (st_sample_t *)xmalloc(alloc_size);
       
-      if (status)
+      if (show_progress)
         print_input_status(f);
     }
   } else {
@@ -821,7 +811,7 @@
     current_input = 0;
     input_samples = file_desc[current_input]->length;
         
-    if (status)
+    if (show_progress)
       print_input_status(current_input);
   }
       
@@ -877,7 +867,7 @@
             input_samples = file_desc[current_input]->length;
             read_samples = 0;
                     
-            if (status)
+            if (show_progress)
               print_input_status(current_input);
             
             continue;
@@ -958,7 +948,7 @@
 
       flowstatus = flow_effect_out();
 
-      if (status)
+      if (show_progress)
         update_status();
 
       /* Quit reading/writing on user aborts.  This will close
@@ -976,7 +966,7 @@
       drain_effect_out();
   }
 
-  if (status)
+  if (show_progress)
     fputs("\n\n", stderr);
 
   if (combine_method != SOX_CONCAT)
@@ -1000,7 +990,7 @@
 
   if (file_desc[f]->clips != 0)
     st_warn("%s: output clipped %u samples; decrease volume?",
-            (file_desc[f]->h->flags & ST_FILE_NOFEXT)?
+            (file_desc[f]->h->flags & ST_FILE_DEVICE)?
             file_desc[f]->h->names[0] : file_desc[f]->filename,
             file_desc[f]->clips);
 }
@@ -1560,6 +1550,8 @@
 
 static void print_input_status(int input)
 {
+  if (st_output_verbosity_level > 2)
+    return;
   fprintf(stderr, "\nInput Filename : %s\n", file_desc[input]->filename);
   fprintf(stderr, "Sample Size    : %s\n", 
           st_size_bits_str[file_desc[input]->signal.size]);
@@ -1646,7 +1638,6 @@
 static void usage(char const * message)
 {
   int i;
-  const st_format_t *f;
   const st_effect_t *e;
 
   printf("%s: ", myname);
@@ -1673,7 +1664,7 @@
          "--play          output to the default sound device; set if SoX run as `play'\n"
          "-q              run in quiet mode; opposite of -S\n"
          "--rec           input from the default sound device; set if SoX run as `rec'\n"
-         "-S              display status while processing audio data\n"
+         "-S              display progress while processing audio data\n"
          "--version       display version number of SoX and exit\n"
          "-V[level]       increment or set verbosity level (default 2); levels are:\n"
          "\n"
@@ -1707,11 +1698,11 @@
          "-R              use default random numbers (same on each run of SoX)\n"
          "\n");
 
-  printf("Supported file formats: ");
+  printf("Supported file formats:");
   for (i = 0; st_format_fns[i]; i++) {
-    f = st_format_fns[i]();
-    if (f && f->names)
-      printf("%s ", f->names[0]); /* only print the first name */
+    char const * const * names = st_format_fns[i]()->names;
+    if (!(st_format_fns[i]()->flags & ST_FILE_PHONY))
+      while (*names) printf(" %s", *names++);
   }
 
   printf("\n\nSupported effects: ");
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -289,7 +289,7 @@
 static st_format_t st_sphere_format = {
   spherenames,
   NULL,
-  ST_FILE_STEREO,
+  0,
   st_spherestartread,
   st_sphereread,
   st_rawstopread,
--- a/src/st.h
+++ b/src/st.h
@@ -200,7 +200,7 @@
     double speed;         /* Gather up all speed changes here, then resample */
 } st_globalinfo_t;
 
-typedef enum {ST_REVERSE_NO, ST_REVERSE_YES, ST_REVERSE_DEFAULT} st_reverse_t;
+typedef enum {ST_OPTION_NO, ST_OPTION_YES, ST_OPTION_DEFAULT} st_option_t;
 
 /* Signal parameters */
 
@@ -210,9 +210,9 @@
     signed char size;     /* word length of data */
     st_encoding_t encoding; /* format of sample numbers */
     unsigned channels;    /* number of sound channels */
-    st_reverse_t reverse_bytes;    /* endiannesses... */
-    st_reverse_t reverse_nibbles;
-    st_reverse_t reverse_bits;
+    st_option_t reverse_bytes;    /* endiannesses... */
+    st_option_t reverse_nibbles;
+    st_option_t reverse_bits;
     double compression;   /* compression factor (where applicable) */
     char *lua_script;      /* Lua script to use for Lua pseudo-file */
 } st_signalinfo_t;
@@ -315,12 +315,12 @@
 };
 
 /* file flags field */
-#define ST_FILE_STEREO  1  /* does file format support stereo? */
-#define ST_FILE_LOOPS   2  /* does file format support loops? */
-#define ST_FILE_INSTR   4  /* does file format support instrument specs? */
-#define ST_FILE_SEEK    8  /* does file format support seeking? */
-#define ST_FILE_NOSTDIO 16 /* does not use stdio routines */
-#define ST_FILE_NOFEXT  32 /* does not use file extensions */
+#define ST_FILE_LOOPS   1  /* does file format support loops? */
+#define ST_FILE_INSTR   2  /* does file format support instrument specs? */
+#define ST_FILE_SEEK    4  /* does file format support seeking? */
+#define ST_FILE_NOSTDIO 8  /* does not use stdio routines */
+#define ST_FILE_DEVICE  16 /* file is an audio device */
+#define ST_FILE_PHONY   32 /* phony file/device */
 /* These two for use by stlib clients: */
 #define ST_FILE_ENDIAN  64 /* is file format endian? */
 #define ST_FILE_ENDBIG  128/* if so, is it big endian? */
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -255,8 +255,8 @@
 int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
 int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED);
 
-int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_reverse_t rev_bits);
-#define st_rawstartread(ft) st_rawstart(ft, false, false, ST_ENCODING_UNKNOWN, -1, ST_REVERSE_DEFAULT)
+int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits);
+#define st_rawstartread(ft) st_rawstart(ft, false, false, ST_ENCODING_UNKNOWN, -1, ST_OPTION_DEFAULT)
 #define st_rawstartwrite st_rawstartread
 #define st_rawstopread st_format_nothing
 
--- a/src/stio.c
+++ b/src/stio.c
@@ -27,16 +27,16 @@
 
 void set_endianness_if_not_already_set(ft_t ft)
 {
-  if (ft->signal.reverse_bytes == ST_REVERSE_DEFAULT) {
+  if (ft->signal.reverse_bytes == ST_OPTION_DEFAULT) {
     if (ft->h->flags & ST_FILE_ENDIAN)
       ft->signal.reverse_bytes = ST_IS_LITTLEENDIAN != !(ft->h->flags & ST_FILE_ENDBIG);
     else
-      ft->signal.reverse_bytes = ST_REVERSE_NO;
+      ft->signal.reverse_bytes = ST_OPTION_NO;
   }
-  if (ft->signal.reverse_nibbles == ST_REVERSE_DEFAULT)
-    ft->signal.reverse_nibbles = ST_REVERSE_NO;
-  if (ft->signal.reverse_bits == ST_REVERSE_DEFAULT)
-    ft->signal.reverse_bits = ST_REVERSE_NO;
+  if (ft->signal.reverse_nibbles == ST_OPTION_DEFAULT)
+    ft->signal.reverse_nibbles = ST_OPTION_NO;
+  if (ft->signal.reverse_bits == ST_OPTION_DEFAULT)
+    ft->signal.reverse_bits = ST_OPTION_NO;
 }
 
 static int is_seekable(ft_t ft)
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -319,7 +319,7 @@
 static st_format_t st_sun_format = {
   sunnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_NOFEXT,
+  ST_FILE_DEVICE,
   st_sunstartread,
   st_rawread,
   st_rawstopread,
--- a/src/util.c
+++ b/src/util.c
@@ -141,8 +141,8 @@
     }
     for (i = 0; st_format_fns[i]; i++) {
         f = st_format_fns[i]();
-        if (is_file_extension && (f->flags & ST_FILE_NOFEXT))
-          continue; /* don't match special device names in real file names */
+        if (is_file_extension && (f->flags & ST_FILE_DEVICE))
+          continue; /* don't match device names in real file names */
         for (list = f->names; *list; list++) {
             const char *s1 = *list, *s2 = formp->filetype;
             if (!strcasecmp(s1, s2))
--- a/src/voc.c
+++ b/src/voc.c
@@ -809,7 +809,7 @@
 static st_format_t st_voc_format = {
   vocnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_LIT_END,
+  ST_FILE_LIT_END,
   st_vocstartread,
   st_vocread,
   st_format_nothing,
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -453,7 +453,7 @@
 static st_format_t st_vorbis_format = {
   vorbisnames,
   NULL,
-  ST_FILE_STEREO,
+  0,
   st_vorbisstartread,
   st_vorbisread,
   st_vorbisstopread,
--- a/src/vox.c
+++ b/src/vox.c
@@ -73,7 +73,7 @@
 
   adpcm_init(&state->encoder, 1);
   ft->signal.channels = 1;
-  return st_rawstart(ft, true, false, ST_ENCODING_OKI_ADPCM, ST_SIZE_WORD, ST_REVERSE_DEFAULT);
+  return st_rawstart(ft, true, false, ST_ENCODING_OKI_ADPCM, ST_SIZE_WORD, ST_OPTION_DEFAULT);
 }
 
 
@@ -92,7 +92,7 @@
 
   adpcm_init(&state->encoder, 0);
   ft->signal.channels = 1;
-  return st_rawstart(ft, true, false, ST_ENCODING_IMA_ADPCM, ST_SIZE_WORD, ST_REVERSE_DEFAULT);
+  return st_rawstart(ft, true, false, ST_ENCODING_IMA_ADPCM, ST_SIZE_WORD, ST_OPTION_DEFAULT);
 }
 
 
--- a/src/wav.c
+++ b/src/wav.c
@@ -1749,7 +1749,7 @@
 static st_format_t st_wav_format = {
   wavnames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_SEEK | ST_FILE_LIT_END,
+  ST_FILE_SEEK | ST_FILE_LIT_END,
   st_wavstartread,
   st_wavread,
   st_wavstopread,
--- a/src/xa.c
+++ b/src/xa.c
@@ -316,7 +316,7 @@
 st_format_t st_xa_format = {
   xanames,
   NULL,
-  ST_FILE_STEREO | ST_FILE_LIT_END,
+  ST_FILE_LIT_END,
   st_xastartread,
   st_xaread,
   st_xastopread,