Submitted By: Ryan Oliver <ryan.oliver@pha.com.au>
Date: 2005-07-24
Initial Package Version: 3.96
Upstream Status: Unknown (wasn't applied to 3.96.1)
Origin: lame-dev
	https://sourceforge.net/tracker/download.php?group_id=290&atid=300290&file_id=90970&aid=974622
Description: Fixes use of libsndfile in lame due to changes in the libsndfile 
             API after v0.77

diff -rubN lame-3.96-VANILLA/configure lame-3.96-EL/configure
--- lame-3.96-VANILLA/configure	2004-04-11 16:47:52.000000000 +0200
+++ lame-3.96-EL/configure	2004-06-04 17:55:37.197792000 +0200
@@ -26539,9 +26539,9 @@
 
 CONFIG_MATH_LIB="${USE_LIBM}"
 
-echo "$as_me:$LINENO: checking for sf_open_read in -lsndfile" >&5
-echo $ECHO_N "checking for sf_open_read in -lsndfile... $ECHO_C" >&6
-if test "${ac_cv_lib_sndfile_sf_open_read+set}" = set; then
+echo "$as_me:$LINENO: checking for sf_open in -lsndfile" >&5
+echo $ECHO_N "checking for sf_open in -lsndfile... $ECHO_C" >&6
+if test "${ac_cv_lib_sndfile_sf_open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -26560,11 +26560,11 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char sf_open_read ();
+char sf_open ();
 int
 main ()
 {
-sf_open_read ();
+sf_open ();
   ;
   return 0;
 }
@@ -26581,19 +26581,19 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_sndfile_sf_open_read=yes
+  ac_cv_lib_sndfile_sf_open=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_sndfile_sf_open_read=no
+ac_cv_lib_sndfile_sf_open=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_sndfile_sf_open_read" >&5
-echo "${ECHO_T}$ac_cv_lib_sndfile_sf_open_read" >&6
-if test $ac_cv_lib_sndfile_sf_open_read = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_sndfile_sf_open" >&5
+echo "${ECHO_T}$ac_cv_lib_sndfile_sf_open" >&6
+if test $ac_cv_lib_sndfile_sf_open = yes; then
   HAVE_SNDFILE="yes"
 fi
 
diff -rubN lame-3.96-VANILLA/configure.in lame-3.96-EL/configure.in
--- lame-3.96-VANILLA/configure.in	2004-04-11 16:45:19.000000000 +0200
+++ lame-3.96-EL/configure.in	2004-06-04 17:54:52.403380800 +0200
@@ -358,7 +358,7 @@
 AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
 CONFIG_MATH_LIB="${USE_LIBM}"
 
-AC_CHECK_LIB(sndfile, sf_open_read, HAVE_SNDFILE="yes")
+AC_CHECK_LIB(sndfile, sf_open, HAVE_SNDFILE="yes")
 
 
 dnl configure use of features
diff -rubN lame-3.96-VANILLA/frontend/get_audio.c lame-3.96-EL/frontend/get_audio.c
--- lame-3.96-VANILLA/frontend/get_audio.c	2004-03-17 15:42:49.000000000 +0100
+++ lame-3.96-EL/frontend/get_audio.c	2004-06-07 18:45:13.592739200 +0200
@@ -17,6 +17,9 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
+ * Modified June 4, 2004 by E. Lassauge <lassauge AT users.sourceforge.net>
+ * for libsndfile-1.0.9
  */
 
 /* $Id: get_audio.c,v 1.99 2004/02/26 17:20:51 takehiro Exp $ */
@@ -572,14 +592,13 @@
         /* set some defaults incase input is raw PCM */
         gs_wfInfo.seekable = (input_format != sf_raw); /* if user specified -r, set to not seekable */
         gs_wfInfo.samplerate = lame_get_in_samplerate( gfp );
-        gs_wfInfo.pcmbitwidth = in_bitwidth;
         gs_wfInfo.channels = lame_get_num_channels( gfp );
 
 	if (in_bitwidth == 8) {
 	    if (in_signed)
-		gs_wfInfo.format = SF_FORMAT_RAW_S8;
+		gs_wfInfo.format = SF_FORMAT_PCM_S8;
 	    else
-		gs_wfInfo.format = SF_FORMAT_RAW_U8;
+		gs_wfInfo.format = SF_FORMAT_PCM_U8;
 
 	} else {
 	    if (!in_signed) {
@@ -588,27 +607,27 @@
 	    }
 	    if (in_endian != order_unknown) {
 		if (in_endian == order_littleEndian)
-		    gs_wfInfo.format = SF_FORMAT_RAW_LE;
+		    gs_wfInfo.format = SF_ENDIAN_LITTLE;
 		else
-		    gs_wfInfo.format = SF_FORMAT_RAW_BE;
+		    gs_wfInfo.format = SF_ENDIAN_BIG;
 	    } else {
 #ifndef WORDS_BIGENDIAN
 		/* little endian */
 		if (swapbytes)
-		    gs_wfInfo.format = SF_FORMAT_RAW_BE;
+		    gs_wfInfo.format = SF_ENDIAN_BIG;
 		else
-		    gs_wfInfo.format = SF_FORMAT_RAW_LE;
+		    gs_wfInfo.format = SF_ENDIAN_LITTLE;
 #else
 		if (swapbytes)
-		    gs_wfInfo.format = SF_FORMAT_RAW_LE;
+		    gs_wfInfo.format = SF_ENDIAN_BIG;
 		else
-		    gs_wfInfo.format = SF_FORMAT_RAW_BE;
+		    gs_wfInfo.format = SF_ENDIAN_LITTLE;
 #endif
 	    }
 	}
 
-        gs_pSndFileIn = sf_open_read(lpszFileName, &gs_wfInfo);
-        musicin = (SNDFILE *) gs_pSndFileIn;
+        gs_pSndFileIn = sf_open(lpszFileName, SFM_READ, &gs_wfInfo);
+        musicin = (FILE *) gs_pSndFileIn;
 
         /* Check result */
         if (gs_pSndFileIn == NULL) {
@@ -618,10 +637,10 @@
             exit(1);
         }
 
-        if ((gs_wfInfo.format == SF_FORMAT_RAW_LE) ||
-            (gs_wfInfo.format == SF_FORMAT_RAW_BE) ||
-	    (gs_wfInfo.format == SF_FORMAT_RAW_S8) ||
-	    (gs_wfInfo.format == SF_FORMAT_RAW_U8))
+        if ((gs_wfInfo.format == SF_ENDIAN_LITTLE) ||
+            (gs_wfInfo.format == SF_ENDIAN_BIG) ||
+	    (gs_wfInfo.format == SF_FORMAT_PCM_S8) ||
+	    (gs_wfInfo.format == SF_FORMAT_PCM_U8))
 	    input_format = sf_raw;
 
 #ifdef _DEBUG_SND_FILE
@@ -629,7 +648,7 @@
         DEBUGF("samplerate        :%d\n", gs_wfInfo.samplerate);
         DEBUGF("samples           :%d\n", gs_wfInfo.samples);
         DEBUGF("channels          :%d\n", gs_wfInfo.channels);
-        DEBUGF("pcmbitwidth       :%d\n", gs_wfInfo.pcmbitwidth);
+        DEBUGF("pcmbitwidth       :%d\n", pcmbitwidth);
         DEBUGF("format            :");
 
         /* new formats from sbellon@sbellon.de  1/2000 */
@@ -707,12 +726,12 @@
         }
 
         DEBUGF("\n");
-        DEBUGF("pcmbitwidth       :%d\n", gs_wfInfo.pcmbitwidth);
+        DEBUGF("pcmbitwidth       :%d\n", pcmbitwidth);
         DEBUGF("sections          :%d\n", gs_wfInfo.sections);
         DEBUGF("seekable          :\n", gs_wfInfo.seekable);
 #endif
 
-        (void) lame_set_num_samples( gfp, gs_wfInfo.samples );
+        (void) lame_set_num_samples( gfp, gs_wfInfo.frames );
         if( -1 == lame_set_num_channels( gfp, gs_wfInfo.channels ) ) {
             fprintf( stderr,
                      "Unsupported number of channels: %ud\n",
@@ -720,7 +739,6 @@
             exit( 1 );
         }
         (void) lame_set_in_samplerate( gfp, gs_wfInfo.samplerate );
-        pcmbitwidth = gs_wfInfo.pcmbitwidth;
     }
 
     if (lame_get_num_samples( gfp ) == MAX_U_32_NUM) {
