shithub: sox

Download patch

ref: af261dcc91071cafd7d83054afb1eb4b2d0083ef
parent: a8635acb1f82f062e4ce39340866d8d2d5e0fa5d
author: cbagwell <cbagwell>
date: Sun May 20 20:22:44 EDT 2001

Adding support for Ogg Vorbis files.

--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,9 @@
     that occurs on platforms that rand() can return large values.
     The bug resulted in polyphase resampling an audio file to a
     different rate then it said it was.
+  o Stan Seibert contributed a handler for Ogg Vorbis files.  It
+    handles all input formats but can only save using default
+    settings.
   o Darrick Servis has made major cleanups in the code in regards
     to error conditions.  Helps people using libst.
   o Darrick Servis has added added optional seek functionality sox.
--- a/configure
+++ b/configure
@@ -28,6 +28,10 @@
   --with-oss-dsp          Force support for /dev/dsp (OSS)"
 ac_help="$ac_help
   --with-sun-audio        Force support for /dev/audio (SUN, etc)"
+ac_help="$ac_help
+  --with-ogg-vorbislib    Location of Ogg Vorbis libraries (=dir)"
+ac_help="$ac_help
+  --with-ogg-vorbisinc    Location of Ogg Vorbis headers (=dir)"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -606,11 +610,29 @@
 fi
 
 
+# Check whether --with-ogg_vorbislib or --without-ogg_vorbislib was given.
+if test "${with_ogg_vorbislib+set}" = set; then
+  withval="$with_ogg_vorbislib"
+  ogg_vorbislib="$withval"
+else
+  ogg_vorbislib=auto
+fi
 
+
+# Check whether --with-ogg_vorbisinc or --without-ogg_vorbisinc was given.
+if test "${with_ogg_vorbisinc+set}" = set; then
+  withval="$with_ogg_vorbisinc"
+  ogg_vorbisinc="$withval"
+else
+  ogg_vorbisinc=auto
+fi
+
+
+
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:614: checking for $ac_word" >&5
+echo "configure:636: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -640,7 +662,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:644: checking for $ac_word" >&5
+echo "configure:666: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -691,7 +713,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:695: checking for $ac_word" >&5
+echo "configure:717: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -723,7 +745,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:727: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:749: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -734,12 +756,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 738 "configure"
+#line 760 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -765,12 +787,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:769: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:791: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:774: checking whether we are using GNU C" >&5
+echo "configure:796: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -779,7 +801,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -798,7 +820,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:802: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:824: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -832,7 +854,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:836: checking for $ac_word" >&5
+echo "configure:858: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -890,7 +912,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:894: checking for a BSD compatible install" >&5
+echo "configure:916: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -943,7 +965,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:947: checking how to run the C preprocessor" >&5
+echo "configure:969: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -958,13 +980,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 962 "configure"
+#line 984 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -975,13 +997,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 979 "configure"
+#line 1001 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -992,13 +1014,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 996 "configure"
+#line 1018 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1028,7 +1050,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1032: checking for $ac_word" >&5
+echo "configure:1054: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1087,7 +1109,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1091: checking host system type" >&5
+echo "configure:1113: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -1108,7 +1130,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:1112: checking target system type" >&5
+echo "configure:1134: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -1126,7 +1148,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1130: checking build system type" >&5
+echo "configure:1152: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1168,7 +1190,7 @@
 
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1172: checking whether byte ordering is bigendian" >&5
+echo "configure:1194: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1175,7 +1197,7 @@
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 1179 "configure"
+#line 1201 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1186,11 +1208,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:1190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 1194 "configure"
+#line 1216 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1201,7 +1223,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:1205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -1221,7 +1243,7 @@
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 1225 "configure"
+#line 1247 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -1234,7 +1256,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -1261,14 +1283,14 @@
 
 
 echo "checking if math library is required during link" 1>&6
-echo "configure:1265: checking if math library is required during link" >&5
+echo "configure:1287: checking if math library is required during link" >&5
 echo $ac_n "checking for pow""... $ac_c" 1>&6
-echo "configure:1267: checking for pow" >&5
+echo "configure:1289: checking for pow" >&5
 if eval "test \"`echo '$''{'ac_cv_func_pow'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1272 "configure"
+#line 1294 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pow(); below.  */
@@ -1291,7 +1313,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_pow=yes"
 else
@@ -1313,7 +1335,7 @@
 if test "$ac_cv_func_pow" = no
 then
   echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6
-echo "configure:1317: checking for pow in -lm" >&5
+echo "configure:1339: checking for pow in -lm" >&5
 ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1321,7 +1343,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1325 "configure"
+#line 1347 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1332,7 +1354,7 @@
 pow()
 ; return 0; }
 EOF
-if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1380,17 +1402,17 @@
 
 ac_safe=`echo "gsm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for gsm.h""... $ac_c" 1>&6
-echo "configure:1384: checking for gsm.h" >&5
+echo "configure:1406: checking for gsm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1389 "configure"
+#line 1411 "configure"
 #include "confdefs.h"
 #include <gsm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1394: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1415,7 +1437,7 @@
 if test "$gsminc" = yes
 then
   echo $ac_n "checking for gsm_create in -lgsm""... $ac_c" 1>&6
-echo "configure:1419: checking for gsm_create in -lgsm" >&5
+echo "configure:1441: checking for gsm_create in -lgsm" >&5
 ac_lib_var=`echo gsm'_'gsm_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1423,7 +1445,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lgsm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1427 "configure"
+#line 1449 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1434,7 +1456,7 @@
 gsm_create()
 ; return 0; }
 EOF
-if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1465,21 +1487,122 @@
 CPPFLAGS="$ac_save_CPPFLAGS"
 
 
+
+if test "$ogg_vorbislib" != auto  && test "$ogg_vorbislib" != no
+then
+  LIBS="$LIBS -L$ogg_vorbislib"
+fi
+
+ac_save_CPPFLAGS="$CPPFLAGS"
+
+if test "$ogg_vorbisinc" != auto && test "$ogg_vorbisinc" != no
+then
+  CFLAGS="$CFLAGS -I$ogg_vorbisinc"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$ogg_vorbisinc" ; then
+    CPPFLAGS="$CPPFLAGS -I$ogg_vorbisinc"
+  fi
+fi
+
+ac_safe=`echo "vorbis/codec.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for vorbis/codec.h""... $ac_c" 1>&6
+echo "configure:1510: checking for vorbis/codec.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1515 "configure"
+#include "confdefs.h"
+#include <vorbis/codec.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  ogg_vorbisinc=yes
+else
+  echo "$ac_t""no" 1>&6
+ogg_vorbisinc=no
+fi
+
+if test "$ogg_vorbisinc" = yes
+then
+  echo $ac_n "checking for vorbis_analysis_init in -lvorbis""... $ac_c" 1>&6
+echo "configure:1545: checking for vorbis_analysis_init in -lvorbis" >&5
+ac_lib_var=`echo vorbis'_'vorbis_analysis_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lvorbis  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1553 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char vorbis_analysis_init();
+
+int main() {
+vorbis_analysis_init()
+; return 0; }
+EOF
+if { (eval echo configure:1564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -logg -lvorbis -lvorbisfile -lvorbisenc"
+               cat >> confdefs.h <<\EOF
+#define HAVE_LIBVORBIS 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+CPPFLAGS="$ac_save_CPPFLAGS"
+
+
 for ac_hdr in getopt.h unistd.h malloc.h byteswap.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1473: checking for $ac_hdr" >&5
+echo "configure:1596: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1478 "configure"
+#line 1601 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1510,12 +1633,12 @@
 for ac_func in getopt strerror memmove rand
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1514: checking for $ac_func" >&5
+echo "configure:1637: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1519 "configure"
+#line 1642 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1538,7 +1661,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1570,17 +1693,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1574: checking for $ac_hdr" >&5
+echo "configure:1697: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1579 "configure"
+#line 1702 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1611,9 +1734,9 @@
 if test "$alsa_dsp" = yes
 then
 	echo $ac_n "checking for ALSA ioctl API""... $ac_c" 1>&6
-echo "configure:1615: checking for ALSA ioctl API" >&5
+echo "configure:1738: checking for ALSA ioctl API" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 1617 "configure"
+#line 1740 "configure"
 #include "confdefs.h"
 
 #include <linux/asound.h>
@@ -1624,7 +1747,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1628: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   alsa_api_ver=oldapi
 else
@@ -1647,17 +1770,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1651: checking for $ac_hdr" >&5
+echo "configure:1774: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1656 "configure"
+#line 1779 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1698,17 +1821,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1702: checking for $ac_hdr" >&5
+echo "configure:1825: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1707 "configure"
+#line 1830 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
--- a/configure.in
+++ b/configure.in
@@ -43,6 +43,16 @@
 	[sun_audio="$withval"],
 	[sun_audio=auto])
 
+AC_ARG_WITH(ogg_vorbislib,
+	[  --with-ogg-vorbislib    Location of Ogg Vorbis libraries (=dir)],
+	[ogg_vorbislib="$withval"],
+	[ogg_vorbislib=auto])
+
+AC_ARG_WITH(ogg_vorbisinc,
+	[  --with-ogg-vorbisinc    Location of Ogg Vorbis headers (=dir)],
+	[ogg_vorbisinc="$withval"],
+	[ogg_vorbisinc=auto])
+
 dnl Checks for programs.
 
 AC_PROG_CC
@@ -115,6 +125,37 @@
 if test "$gsminc" = yes
 then
   AC_CHECK_LIB(gsm, gsm_create)
+fi
+CPPFLAGS="$ac_save_CPPFLAGS"
+
+
+dnl Test for Ogg Vorbis libraries.
+
+if test "$ogg_vorbislib" != auto  && test "$ogg_vorbislib" != no
+then
+  LIBS="$LIBS -L$ogg_vorbislib"
+fi
+
+dnl Need to tell preprocess where to look for Ogg Vorbis include files
+dnl when they are not in system directories.  Because of this make
+dnl a backup copy of the CPPFLAGS.
+ac_save_CPPFLAGS="$CPPFLAGS"
+
+if test "$ogg_vorbisinc" != auto && test "$ogg_vorbisinc" != no
+then
+  CFLAGS="$CFLAGS -I$ogg_vorbisinc"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$ogg_vorbisinc" ; then
+    CPPFLAGS="$CPPFLAGS -I$ogg_vorbisinc"
+  fi
+fi
+
+AC_CHECK_HEADER(vorbis/codec.h, ogg_vorbisinc=yes, ogg_vorbisinc=no)
+if test "$ogg_vorbisinc" = yes
+then
+  AC_CHECK_LIB(vorbis, vorbis_analysis_init,
+               LIBS="$LIBS -logg -lvorbis -lvorbisfile -lvorbisenc"
+               AC_DEFINE(HAVE_LIBVORBIS))
 fi
 CPPFLAGS="$ac_save_CPPFLAGS"
 
--- a/sox.1
+++ b/sox.1
@@ -394,6 +394,22 @@
 Allows 8bit linear, 16bit linear, A-Law, u-law
 in mono and stereo.
 .TP 10
+.B .ogg
+Ogg Vorbis Compressed Audio.
+.br
+Ogg Vorbis is a open, patent-free codec designed for compressing music
+and streaming audio.  It is similar to MP3, VQF, AAC, and other lossy
+formats.  
+.B sox
+can decode all types of Ogg Vorbis files, but can only encode at 128 kbps.
+Decoding is somewhat CPU intensive and encoding is very CPU intensive.
+.br
+Ogg Vorbis in
+.B sox
+is optional and requires access to external Ogg Vorbis libraries.  To
+see if there is support for Ogg Vorbis run \fBsox -h\fR
+and look for it under the list of supported file formats as "vorbis".
+.TP 10
 .B ossdsp
 OSS /dev/dsp device driver
 .br
@@ -484,6 +500,11 @@
 and sample data with a new sample rate is rejected.
 Silence with a different sample rate is generated appropriately.
 On output, silence is not detected, nor are impossible sample rates.
+.TP 10
+.B vorbis
+See
+.B .ogg
+format.
 .TP 10
 .B .wav
 Microsoft .WAV RIFF files.
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -44,7 +44,8 @@
 
 FOBJ	= 8svx.o adpcm.o aiff.o au.o auto.o avr.o cdr.o cvsd.o dat.o g721.o \
 	  g723_24.o g723_40.o g72x.o gsm.o hcom.o ima_rw.o maud.o nul.o \
-	  raw.o sf.o smp.o sndrtool.o sphere.o tx16w.o voc.o wav.o wve.o
+	  raw.o sf.o smp.o sndrtool.o sphere.o tx16w.o voc.o vorbis.o \
+	  wav.o wve.o
 
 EOBJ	= avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
 	  copy.o cut.o deemphas.o earwax.o echo.o echos.o fade.o filter.o \
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -335,6 +335,21 @@
 extern LONG st_vocwrite();
 extern int  st_vocstopwrite();
 
+#ifdef HAVE_LIBVORBIS
+static char *vorbisnames[] = {
+	"vorbis",
+	"ogg",
+	(char *) 0
+};
+
+extern int  st_vorbisstartread();
+extern LONG st_vorbisread();
+extern int  st_vorbisstopread();
+extern int  st_vorbisstartwrite();
+extern LONG st_vorbiswrite();
+extern int  st_vorbisstopwrite();
+#endif
+
 static char *wavnames[] = {
 	"wav",
 	(char *) 0
@@ -463,6 +478,11 @@
 	{vocnames, ST_FILE_STEREO,		/* Sound Blaster .VOC */
 		st_vocstartread, st_vocread, st_vocstopread,
 		st_vocstartwrite, st_vocwrite, st_vocstopwrite, st_nothing},
+#ifdef HAVE_LIBVORBIS
+	{vorbisnames, ST_FILE_STEREO,		/* Ogg Vorbis */
+		st_vorbisstartread, st_vorbisread, st_vorbisstopread,
+		st_vorbisstartwrite, st_vorbiswrite, st_vorbisstopwrite},
+#endif
 	{wavnames, ST_FILE_STEREO | ST_FILE_SEEK,		/* Microsoftt RIFF */
 		st_wavstartread, st_wavread, st_nothing,
 		st_wavstartwrite, st_wavwrite, st_wavstopwrite, st_wavseek},	
--- /dev/null
+++ b/src/vorbis.c
@@ -1,0 +1,420 @@
+#if defined(HAVE_LIBVORBIS)
+/*
+ * Ogg Vorbis sound format driver
+ * Copyright 2001, Stan Seibert <indigo@aztec.asu.edu>
+ *
+ * Portions from oggenc, (c) Michael Smith <msmith@labyrinth.net.au>,
+ * ogg123, (c) Kenneth Arnold <kcarnold@yahoo.com>, and
+ * libvorbisfile (c) Xiphophorus Company
+ * 
+ * May 9, 2001 - Stan Seibert (indigo@aztec.asu.edu)
+ * Ogg Vorbis driver initially written.
+ *
+ * July 5, 1991 - Skeleton file
+ * Copyright 1991 Lance Norskog 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 
+ * the consequences of using this software.
+ */
+
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <string.h>
+#include "st.h"
+
+#include <ogg/ogg.h>
+#include <vorbis/codec.h>
+#include <vorbis/vorbisfile.h>
+#include <vorbis/vorbisenc.h>
+
+#define DEF_BUF_LEN 4096
+
+#define BUF_ERROR -1
+#define BUF_EOF  0
+#define BUF_DATA 1
+
+#define HEADER_ERROR 0
+#define HEADER_OK   1
+
+/* Private data for Ogg Vorbis file */
+typedef struct vorbis_enc {
+	ogg_stream_state os;
+	ogg_page         og;
+	ogg_packet       op;
+	
+	vorbis_dsp_state vd;
+	vorbis_block     vb;
+        vorbis_info      vi;
+} vorbis_enc_t;
+
+typedef struct vorbisstuff {
+/* Decoding data */
+	OggVorbis_File *vf;
+	char *buf;
+	int buf_len;
+	int start;
+	int end;  /* Unsent data samples in buf[start] through buf[end-1] */
+	int current_section;
+	int eof;
+
+	vorbis_enc_t *vorbis_enc_data;
+} *vorbis_t;
+
+/******** Callback functions used in ov_open_callbacks ************/
+int myclose (void *datasource)
+{
+	/* Do nothing so sox can close the file for us */
+	return 0;
+}
+
+/* Taken from vorbisfile.c in libvorbis source code */
+static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
+  if(f==NULL)return(-1);
+  return fseek(f,(int)off,whence);
+}
+
+/********************* End callbacks *****************************/
+
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header. 
+ *	Find out sampling rate, 
+ *	size and encoding of samples, 
+ *	mono/stereo/quad.
+ */
+int st_vorbisstartread(ft) 
+ft_t ft;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+	vorbis_info *vi;
+	vorbis_comment *vc;
+	int comment_size;
+	int i, offset;
+
+	ov_callbacks callbacks = {
+		(size_t (*)(void *, size_t, size_t, void *))  fread,
+		(int (*)(void *, ogg_int64_t, int))           _fseek64_wrap,
+		(int (*)(void *))                             myclose,
+		(long (*)(void *))                            ftell
+	};
+
+	
+	
+	/* Allocate space for decoding structure */
+	vb->vf = malloc(sizeof(OggVorbis_File));
+	if (vb->vf == NULL) 
+		return (ST_ENOMEM);
+
+	/* Init the decoder */
+	if (ov_open_callbacks((void *)ft->fp,vb->vf,NULL,0,callbacks) < 0)
+	{
+		st_fail_errno(ft,ST_EHDR,
+			      "Input not an Ogg Vorbis audio stream");
+		return (ST_EHDR);
+	}
+
+	/* Get info about the Ogg Vorbis stream */
+	vi = ov_info(vb->vf, -1);
+	vc = ov_comment(vb->vf, -1);
+
+	/* Record audio info */
+	ft->info.rate = vi->rate;
+	ft->info.size = ST_SIZE_16BIT;
+	ft->info.encoding = ST_ENCODING_SIGN2;
+	ft->info.channels = vi->channels;
+	
+	/* Record comments */
+	if (vc->comments == 0)
+		ft->comment = NULL;
+	else 
+	{
+		comment_size = 0;
+		for (i = 0; i < vc->comments; i++)
+			comment_size += vc->comment_lengths[i] + 1;
+
+		if ( (ft->comment = calloc(comment_size, sizeof(char))) 
+		     == NULL)
+		{
+			ov_clear(vb->vf);
+			free(vb->vf);
+			
+			return (ST_ENOMEM);
+		}
+		
+		offset = 0;
+		for (i = 0; i < vc->comments; i++)
+		{
+			strncpy(ft->comment + i, vc->user_comments[i],
+				vc->comment_lengths[i]);
+			offset += vc->comment_lengths[i];
+			ft->comment[offset] = '\n';
+			offset++;
+		}
+		ft->comment[offset] = 0; // End comment
+	}
+
+	/* Setup buffer */
+	vb->buf_len = DEF_BUF_LEN;
+	if ( (vb->buf = calloc(vb->buf_len, sizeof(char))) == NULL )
+	{
+		ov_clear(vb->vf);
+		free(vb->vf);
+
+		return (ST_ENOMEM);
+	}
+	vb->start = vb->end = 0;
+
+	/* Fill in other info */
+	vb->eof = 0;
+	vb->current_section = -1;
+
+	return (ST_SUCCESS);
+}
+
+
+/* Refill the buffer with samples.  Returns BUF_EOF if the end of the
+   vorbis data was reached while the buffer was being filled,
+   BUF_ERROR is something bad happens, and BUF_DATA otherwise */
+int refill_buffer (vb)
+vorbis_t vb;
+{
+	int num_read;
+
+	if (vb->start == vb->end) /* Samples all played */
+		vb->start = vb->end = 0;
+
+	while (vb->end < vb->buf_len)
+	{
+		num_read = ov_read(vb->vf, vb->buf + vb->end,
+				   vb->buf_len - vb->end, 0, 2, 1, 
+				   &vb->current_section);
+		
+		if (num_read == 0)
+			return (BUF_EOF);
+		else if (num_read == OV_HOLE)
+			fprintf(stderr, "Warning: hole in stream; probably harmless\n");
+		else if (num_read < 0)
+			return (BUF_ERROR);
+		else
+			vb->end += num_read;
+			
+	}
+
+	return (BUF_DATA);
+}
+
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+LONG st_vorbisread(ft, buf, len) 
+ft_t ft;
+LONG *buf, len;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+	int i;
+	int ret;
+	LONG l;
+
+
+	for(i = 0; i < len; i++) {
+		if (vb->start == vb->end)
+		{
+			if (vb->eof)
+				break;
+			else
+			{
+				ret = refill_buffer(vb);
+				if (ret == BUF_EOF || ret == BUF_ERROR)
+					vb->eof = 1;
+			}
+		}
+
+		l = LEFT(vb->buf[vb->start+1],24) 
+			| (0xffffff &  LEFT(vb->buf[vb->start], 16));
+		*(buf + i) = l;
+		vb->start += 2;
+	}
+
+	return i;
+}
+
+/*
+ * Do anything required when you stop reading samples.  
+ * Don't close input file! 
+ */
+int st_vorbisstopread(ft) 
+ft_t ft;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+
+	free(vb->buf);
+	ov_clear(vb->vf);
+
+	return (ST_SUCCESS);
+}
+
+/* Write a page of ogg data to a file.  Taken directly from encode.c in 
+   oggenc.   Returns the number of bytes written. */
+int oe_write_page(ogg_page *page, FILE *fp)
+{
+        int written;
+        written = fwrite(page->header,1,page->header_len, fp);
+        written += fwrite(page->body,1,page->body_len, fp);
+
+        return written;
+}
+
+/* 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. */
+int write_vorbis_header(ft, ve)
+ft_t ft;
+vorbis_enc_t *ve;
+{
+	ogg_packet header_main;
+	ogg_packet header_comments;
+	ogg_packet header_codebooks;
+	vorbis_comment vc;
+	int result;
+	int ret;
+
+	/* Make the comment structure */
+	vc.user_comments = calloc(1, sizeof(char *));
+	vc.comment_lengths = calloc(1, sizeof(int));
+	vc.comments = 1;
+
+	vc.user_comments[0] = ft->comment;
+	vc.comment_lengths[0] = strlen(ft->comment);
+
+	/* Build the packets */
+	vorbis_analysis_headerout(&ve->vd,&vc,
+				  &header_main,
+				  &header_comments,
+				  &header_codebooks);
+	
+	/* And stream them out */
+	ogg_stream_packetin(&ve->os,&header_main);
+	ogg_stream_packetin(&ve->os,&header_comments);
+	ogg_stream_packetin(&ve->os,&header_codebooks);
+	
+	while((result = ogg_stream_flush(&ve->os, &ve->og)))
+	{
+		if(!result) break;
+		ret = oe_write_page(&ve->og, ft->fp);
+		if(!ret)
+		{
+			return HEADER_ERROR;
+		}
+	}
+
+	return HEADER_OK;
+}
+
+int st_vorbisstartwrite(ft) 
+ft_t ft;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+	vorbis_enc_t *ve;
+
+	/* Allocate memory for all of the structures */
+	ve = vb->vorbis_enc_data = malloc(sizeof(vorbis_enc_t));
+	if (ve == NULL) 
+		return (ST_ENOMEM);
+		
+
+	vorbis_info_init(&ve->vi);
+
+	/* DEBUG */
+	fprintf(stdout, "Channels: %d  Rate: %ld\n", ft->info.channels,
+		ft->info.rate);
+
+	/* Set encoding to average bit rate of 128kbps with no min or max */
+	vorbis_encode_init(&ve->vi, ft->info.channels, ft->info.rate,
+			   -1, 128000, -1);
+
+	vorbis_analysis_init(&ve->vd, &ve->vi);
+	vorbis_block_init(&ve->vd, &ve->vb);
+	
+	ogg_stream_init(&ve->os, rand()); /* Random serial number */
+	
+	if (write_vorbis_header(ft, ve) == HEADER_ERROR)
+		return (EIO);
+	
+	return(ST_SUCCESS);	
+}
+
+LONG st_vorbiswrite(ft, buf, len) 
+ft_t ft;
+LONG *buf, len;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+	vorbis_enc_t *ve = vb->vorbis_enc_data;
+	LONG samples = len / ft->info.channels;	
+	float **buffer = vorbis_analysis_buffer(&ve->vd, samples);
+	LONG i, j;
+	int ret;
+	int eos = 0;
+
+	/* Copy samples into vorbis buffer */
+	for (i = 0; i < samples; i++)
+		for (j = 0; j < ft->info.channels; j++)
+			buffer[j][i] = buf[i*ft->info.channels + j] 
+				/ 2147483648.0f;
+
+	vorbis_analysis_wrote(&ve->vd, samples);
+	
+	while(vorbis_analysis_blockout(&ve->vd,&ve->vb)==1)
+	{
+		/* Do the main analysis, creating a packet */
+		vorbis_analysis(&ve->vb, &ve->op);
+		
+		/* Add packet to bitstream */
+		ogg_stream_packetin(&ve->os,&ve->op);
+		
+		/* If we've gone over a page boundary, we can do actual output,
+		   so do so (for however many pages are available) */
+		
+		while(!eos)
+		{
+			int result = ogg_stream_pageout(&ve->os,&ve->og);
+			if(!result) break;
+			
+			ret = oe_write_page(&ve->og, ft->fp);
+			if(!ret)
+				return (EIO);
+
+			if(ogg_page_eos(&ve->og))
+				eos = 1;
+		}
+	}
+ 
+
+	return (ST_SUCCESS);	
+}
+
+int st_vorbisstopwrite(ft) 
+ft_t ft;
+{
+	vorbis_t vb = (vorbis_t) ft->priv;
+	vorbis_enc_t *ve = vb->vorbis_enc_data;
+
+	/* Close out the remaining data */
+	st_vorbiswrite(ft, NULL, 0);
+
+	ogg_stream_clear(&ve->os);
+	vorbis_block_clear(&ve->vb);
+	vorbis_dsp_clear(&ve->vd);
+	vorbis_info_clear(&ve->vi);
+
+	return (ST_SUCCESS);
+}
+
+#endif /* HAVE_LIBVORBIS */