shithub: sox

Download patch

ref: 8617bb82be282bc354e716a11cb92fa5e3006c96
parent: 36a83aede9accc17bf02d97d2ac7d1c306e0eff7
author: Chris Bagwell <chris@cnpbagwell.com>
date: Tue Dec 27 17:32:23 EST 2011

Remove support for mp3lame < 3.98.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,9 +120,9 @@
 optional(HAVE_AO ao/ao.h ao ao_play ao)
 optional(HAVE_FLAC FLAC/all.h FLAC FLAC__stream_encoder_new flac)
 optional(HAVE_MAD_H mad.h mad mad_stream_buffer mp3)
-optional(HAVE_LAME_LAME_H lame/lame.h mp3lame lame_init mp3)
+optional(HAVE_LAME_LAME_H lame/lame.h mp3lame lame_get_lametag_frame mp3)
 if (NOT HAVE_LAME_LAME_H)
-  optional(HAVE_LAME_LAME_H lame.h mp3lame lame_init mp3)
+  optional(HAVE_LAME_LAME_H lame.h mp3lame lame_get_lametag_frame mp3)
 endif (NOT HAVE_LAME_LAME_H)
 optional(HAVE_MAGIC magic.h magic magic_open "")
 #optional(HAVE_OGG_SPEEX speex/speex.h speex speex_decoder_init speex)
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
   14.1.0   E rabbit alias          rate
   14.3.1   F sndfile: sndfile 1.0.11 sndfile > 1.0.11
   14.3.0   F flac: libFLAC < 1.1.3 libFLAC >= 1.1.3
+  14.3.1   F mp3: lame 3.97        lame > 3.97
 
 Previously deprecated features (to be removed in future):
 
@@ -29,7 +30,6 @@
   Deprec-  Feature    [O(ption)]                           Removal
   ated in  [F(ormat)] [E(ffect)]   Replacement             due after
   -------  ----------------------  ----------------------  -------
-  14.3.1   F mp3: lame 3.97        lame > 3.97             14.3.2
   14.3.0   O -1/-2/-3/-4/-8        -b                      14.4.0
   14.3.0   O -s/-u/-f              -e                      14.4.0
   14.3.0   O -A/-U/-o/-i/-a/-g     -e                      14.4.0
--- a/configure.ac
+++ b/configure.ac
@@ -353,20 +353,12 @@
     else
       enable_dl_lame="no"
       AC_CHECK_HEADERS(lame/lame.h,,
-        [AC_CHECK_HEADERS(lame.h, using_lame=$using_lame, using_lame=no)])
-      AC_CHECK_LIB(mp3lame, lame_init, MP3_LIBS="$MP3_LIBS -lmp3lame",using_lame=no)
-      AC_CHECK_LIB(mp3lame, lame_get_lametag_frame,using_lame=$using_lame,using_lame=no)
-      if test "$ac_cv_lib_mp3lame_lame_get_lametag_frame" = yes; then
-	AC_DEFINE(HAVE_LAME_398, 1, [Define to 1 if you have lame 3.98 or greater.])
-      fi
-      AC_CHECK_LIB(mp3lame, id3tag_init,using_lame=$using_lame,using_lame=no)
-      if test "$ac_cv_lib_mp3lame_id3tag_init" = yes; then
+        [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
+      AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
+      AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue, using_lame=$using_lame)
+      if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
         AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
       fi
-      AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue,using_lame=$using_lame,using_lame=no)
-      if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
-        AC_DEFINE(HAVE_LAME_398_ID3TAG, 1, [Define to 1 if lame 3.98 or newer ID3 tag support.])
-      fi
       if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
         AC_MSG_FAILURE([cannot find LAME])
       fi
@@ -646,6 +638,7 @@
 echo " id3tag....................$using_id3tag"
 echo " lame......................$using_lame"
 if test "x$using_lame" = "xyes"; then
+echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
 echo " dlopen lame...............$enable_dl_lame"
 fi
 echo " mad.......................$using_mad"
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -130,13 +130,6 @@
   /* id3tag support is an optional component of LAME. Use if available. */
   #define LAME_FUNC_ID3       LSX_DLENTRY_STUB
 
-  /* Added in LAME 3.98: lame_get_lametag_frame. Use if available. */
-  #define LAME_FUNC_398       LSX_DLENTRY_STUB
-
-  /* Added in LAME 3.98.1 (optional): id3tag_set_pad, lame_get_id3v2_tag,
-     id3tag_set_fieldvalue. Use if available. */
-  #define LAME_FUNC_398_ID3   LSX_DLENTRY_STUB
-
 #else /* DL_LAME */
 
   /* Expected to be present in all builds of LAME. */
@@ -149,21 +142,6 @@
     #define LAME_FUNC_ID3     LSX_DLENTRY_STUB
   #endif
 
-  /* Added in LAME 3.98: lame_get_lametag_frame. Use if available. */
-  #ifdef HAVE_LAME_398
-    #define LAME_FUNC_398     LSX_DLENTRY_STATIC
-  #else
-    #define LAME_FUNC_398     LSX_DLENTRY_STUB
-  #endif
-
-  /* Added in LAME 3.98.1 (optional): id3tag_set_pad, lame_get_id3v2_tag,
-     id3tag_set_fieldvalue. Use if available. */
-  #ifdef HAVE_LAME_398_ID3TAG
-    #define LAME_FUNC_398_ID3 LSX_DLENTRY_STATIC
-  #else
-    #define LAME_FUNC_398_ID3 LSX_DLENTRY_STUB
-  #endif
-
 #endif /* DL_LAME */
 
 #define LAME_FUNC_ENTRIES(f,x) \
@@ -186,6 +164,7 @@
   LAME_FUNC(f,x, int, lame_encode_buffer_float, (lame_global_flags *, const float[], const float[], const int, unsigned char *, const int)) \
   LAME_FUNC(f,x, int, lame_encode_flush, (lame_global_flags *, unsigned char *, int)) \
   LAME_FUNC(f,x, int, lame_close, (lame_global_flags *)) \
+  LAME_FUNC(f,x, size_t, lame_get_lametag_frame, (const lame_global_flags *, unsigned char*, size_t)) \
   LAME_FUNC_ID3(f,x, void, id3tag_init, (lame_global_flags *)) \
   LAME_FUNC_ID3(f,x, void, id3tag_set_title, (lame_global_flags *, const char* title)) \
   LAME_FUNC_ID3(f,x, void, id3tag_set_artist, (lame_global_flags *, const char* artist)) \
@@ -194,10 +173,9 @@
   LAME_FUNC_ID3(f,x, void, id3tag_set_comment, (lame_global_flags *, const char* comment)) \
   LAME_FUNC_ID3(f,x, int, id3tag_set_track, (lame_global_flags *, const char* track)) \
   LAME_FUNC_ID3(f,x, int, id3tag_set_genre, (lame_global_flags *, const char* genre)) \
-  LAME_FUNC_398(f,x, size_t, lame_get_lametag_frame, (const lame_global_flags *, unsigned char*, size_t)) \
-  LAME_FUNC_398_ID3(f,x, size_t, id3tag_set_pad, (lame_global_flags *, size_t)) \
-  LAME_FUNC_398_ID3(f,x, size_t, lame_get_id3v2_tag, (lame_global_flags *, unsigned char*, size_t)) \
-  LAME_FUNC_398_ID3(f,x, int, id3tag_set_fieldvalue, (lame_global_flags *, const char *))
+  LAME_FUNC_ID3(f,x, size_t, id3tag_set_pad, (lame_global_flags *, size_t)) \
+  LAME_FUNC_ID3(f,x, size_t, lame_get_id3v2_tag, (lame_global_flags *, unsigned char*, size_t)) \
+  LAME_FUNC_ID3(f,x, int, id3tag_set_fieldvalue, (lame_global_flags *, const char *))
 
 /* Private data */
 typedef struct mp3_priv_t {
@@ -696,8 +674,6 @@
   { return; }
 static int id3tag_set_genre_stub(lame_global_flags * gfp UNUSED, const char* genre UNUSED)
   { return 0; }
-static size_t lame_get_lametag_frame_stub(const lame_global_flags * gfp UNUSED, unsigned char * buffer UNUSED, size_t size UNUSED)
-  { return 0; }
 static size_t id3tag_set_pad_stub(lame_global_flags * gfp UNUSED, size_t n UNUSED)
   { return 0; }
 static size_t lame_get_id3v2_tag_stub(lame_global_flags * gfp UNUSED, unsigned char * buffer UNUSED, size_t size UNUSED)
@@ -969,11 +945,7 @@
         p->lame_set_VBR(p->gfp, vbr_default);
 
       if (ft->seekable) {
-        if (!LSX_DLFUNC_IS_STUB(p, lame_get_lametag_frame)) {
-          p->vbr_tag = 1;
-        } else {
-          lsx_report("unable to write VBR tag because lametag update is not supported with this version of LAME");
-        }
+        p->vbr_tag = 1;
       } else {
         lsx_warn("unable to write VBR tag because we can't seek");
       }