SDL_mixer: removed libmad support for mp3 playback.

From af7831532efbaac1b72f038e8442b7f27c0d8c46 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 28 May 2022 02:33:40 +0300
Subject: [PATCH] removed libmad support for mp3 playback.

---
 CHANGES.txt                                 |   4 +-
 CMakeLists.txt                              |   1 -
 Makefile.os2                                |   8 +-
 README.txt                                  |   4 +-
 VisualC-WinRT/SDL_mixer-UWP.vcxproj         |   2 -
 VisualC-WinRT/SDL_mixer-UWP.vcxproj.filters |   6 -
 VisualC/SDL_mixer.vcxproj                   |   2 -
 VisualC/SDL_mixer.vcxproj.filters           |   6 -
 Xcode/SDL_mixer.xcodeproj/project.pbxproj   |  12 -
 configure                                   | 101 +--
 configure.ac                                |  29 +-
 include/SDL_mixer.h                         |   8 +-
 src/codecs/music_mad.c                      | 694 --------------------
 src/codecs/music_mad.h                      |  28 -
 src/music.c                                 |   3 -
 src/music.h                                 |   1 -
 16 files changed, 29 insertions(+), 880 deletions(-)
 delete mode 100644 src/codecs/music_mad.c
 delete mode 100644 src/codecs/music_mad.h

diff --git a/CHANGES.txt b/CHANGES.txt
index 49c9c6d9..484deb9d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,8 +12,7 @@
  * Added support of quoted strings in timidity.cfg
  * Added missing Mix_HasMusicDecoder().
  * Memory leak fixes and F32 format support to fluidsynth player.
- * Fixes to mp3 (libmad) and opus playback on big-endian systems.
- * Added support for Tell and Duration to MP3 libmad backend.
+ * Fixes to opus playback on big-endian systems.
  * Fixed distorted MIDI playback with FluidSynth if sample rate is out of library's limits
  * Added Mix_ModMusicJumpToOrder for mod music formats
  * Added libxmp support for mod music playback.
@@ -36,7 +35,6 @@
     Mix_GetMusicLoopEndTime()
     Mix_GetMusicLoopLengthTime()
  * Add Mix_GetMusicVolume and Mix_GetMusicPosition to public api.
- * Avoid playing junk chunk after seek in MP3 with libmad backend.
  * Fixes to MP3 Frankenstein streams playback (thanks to Vitaly Novichkov.)
  * Add Mix_MusicDuration() to return music duration in seconds.
  * Fixed music_mpg123 seek bug when sample rate of the file and the stream don't match
diff --git a/CMakeLists.txt b/CMakeLists.txt
index befeed24..b1e1a309 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,7 +109,6 @@ target_sources(SDL2_mixer PRIVATE
         src/codecs/music_drflac.c
         src/codecs/music_flac.c
         src/codecs/music_drmp3.c
-        src/codecs/music_mad.c
         src/codecs/music_mpg123.c
         src/codecs/mp3utils.c
         src/codecs/music_ogg.c
diff --git a/Makefile.os2 b/Makefile.os2
index 355138ba..6faf267d 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -31,8 +31,6 @@ USE_FLAC=yes
 USE_DRFLAC=no
 # opus music support
 USE_OPUS=yes
-# mp3 music support (using libmad - Note: GPL license!)
-USE_LIBMAD=no
 # mp3 music support (using mpg123)
 USE_MPG123=yes
 # mp3 music support (using dr_mp3)
@@ -58,7 +56,7 @@ SRCS = utils.c effect_position.c effects_internal.c effect_stereoreverse.c mixer
 SRCS+= load_aiff.c load_voc.c music_wav.c &
        music_ogg.c music_ogg_stb.c music_opus.c &
        music_flac.c music_drflac.c mp3utils.c &
-       music_mad.c music_mpg123.c music_drmp3.c &
+       music_mpg123.c music_drmp3.c &
        music_xmp.c music_mikmod.c music_modplug.c &
        music_fluidsynth.c music_timidity.c
 # timidity sources:
@@ -128,10 +126,6 @@ LIBS+= opusfile.lib opus.lib
 NEED_LIBOGG=yes
 !endif
 
-!ifeq USE_LIBMAD yes
-CFLAGS+= -DMUSIC_MP3_MAD
-LIBS+= mad.lib
-!endif
 !ifeq USE_MPG123 yes
 CFLAGS+= -DMUSIC_MP3_MPG123
 LIBS+= mpg123.lib
diff --git a/README.txt b/README.txt
index 2577e29b..8c005630 100644
--- a/README.txt
+++ b/README.txt
@@ -29,6 +29,4 @@ Support for software MIDI, MOD, and Opus are not included by default because of
 - When building with Xcode, you can edit the config at the top of the project to enable them, and you will need to include the appropriate framework in your application.
 - For Android, you can edit the config at the top of Android.mk to enable them.
 
-The default MP3 support is provided using dr_mp3. SDL_mixer also supports using libmad, but does not use it by default because the libmad license is GPL, which requires your application to also be GPL. If your application has a compatible license, you can enable libmad by passing
-	--enable-music-mp3-mad
-to configure, or by defining MUSIC_MP3_MAD
+The default MP3 support is provided using dr_mp3. SDL_mixer also supports using libmpg123: you can enable it by passing --enable-music-mp3-mpg123 to configure.
diff --git a/VisualC-WinRT/SDL_mixer-UWP.vcxproj b/VisualC-WinRT/SDL_mixer-UWP.vcxproj
index 75a86546..8226dbc7 100644
--- a/VisualC-WinRT/SDL_mixer-UWP.vcxproj
+++ b/VisualC-WinRT/SDL_mixer-UWP.vcxproj
@@ -43,7 +43,6 @@
     <ClCompile Include="..\src\codecs\music_cmd.c" />
     <ClCompile Include="..\src\codecs\music_flac.c" />
     <ClCompile Include="..\src\codecs\music_fluidsynth.c" />
-    <ClCompile Include="..\src\codecs\music_mad.c" />
     <ClCompile Include="..\src\codecs\music_mikmod.c" />
     <ClCompile Include="..\src\codecs\music_modplug.c" />
     <ClCompile Include="..\src\codecs\music_mpg123.c" />
@@ -72,7 +71,6 @@
     <ClInclude Include="..\src\codecs\music_drmp3.h" />
     <ClInclude Include="..\src\codecs\music_flac.h" />
     <ClInclude Include="..\src\codecs\music_fluidsynth.h" />
-    <ClInclude Include="..\src\codecs\music_mad.h" />
     <ClInclude Include="..\src\codecs\music_mikmod.h" />
     <ClInclude Include="..\src\codecs\music_modplug.h" />
     <ClInclude Include="..\src\codecs\music_mpg123.h" />
diff --git a/VisualC-WinRT/SDL_mixer-UWP.vcxproj.filters b/VisualC-WinRT/SDL_mixer-UWP.vcxproj.filters
index 20353a27..47a10d25 100644
--- a/VisualC-WinRT/SDL_mixer-UWP.vcxproj.filters
+++ b/VisualC-WinRT/SDL_mixer-UWP.vcxproj.filters
@@ -61,9 +61,6 @@
     <ClCompile Include="..\src\codecs\music_fluidsynth.c">
       <Filter>Sources</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\codecs\music_mad.c">
-      <Filter>Sources</Filter>
-    </ClCompile>
     <ClCompile Include="..\src\codecs\music_mikmod.c">
       <Filter>Sources</Filter>
     </ClCompile>
@@ -165,9 +162,6 @@
     <ClInclude Include="..\src\codecs\music_fluidsynth.h">
       <Filter>Sources</Filter>
     </ClInclude>
-    <ClInclude Include="..\src\codecs\music_mad.h">
-      <Filter>Sources</Filter>
-    </ClInclude>
     <ClInclude Include="..\src\codecs\music_mikmod.h">
       <Filter>Sources</Filter>
     </ClInclude>
diff --git a/VisualC/SDL_mixer.vcxproj b/VisualC/SDL_mixer.vcxproj
index bd92e166..57b9eacb 100644
--- a/VisualC/SDL_mixer.vcxproj
+++ b/VisualC/SDL_mixer.vcxproj
@@ -224,7 +224,6 @@
     <ClInclude Include="..\src\codecs\music_cmd.h" />
     <ClInclude Include="..\src\codecs\music_flac.h" />
     <ClInclude Include="..\src\codecs\music_fluidsynth.h" />
-    <ClInclude Include="..\src\codecs\music_mad.h" />
     <ClInclude Include="..\src\codecs\music_mikmod.h" />
     <ClInclude Include="..\src\codecs\music_modplug.h" />
     <ClInclude Include="..\src\codecs\music_mpg123.h" />
@@ -415,7 +414,6 @@
     <ClCompile Include="..\src\codecs\music_cmd.c" />
     <ClCompile Include="..\src\codecs\music_flac.c" />
     <ClCompile Include="..\src\codecs\music_fluidsynth.c" />
-    <ClCompile Include="..\src\codecs\music_mad.c" />
     <ClCompile Include="..\src\codecs\music_mikmod.c" />
     <ClCompile Include="..\src\codecs\music_modplug.c" />
     <ClCompile Include="..\src\codecs\music_mpg123.c" />
diff --git a/VisualC/SDL_mixer.vcxproj.filters b/VisualC/SDL_mixer.vcxproj.filters
index f6a7b72e..c35ae5d3 100644
--- a/VisualC/SDL_mixer.vcxproj.filters
+++ b/VisualC/SDL_mixer.vcxproj.filters
@@ -34,9 +34,6 @@
     <ClInclude Include="..\src\codecs\music_fluidsynth.h">
       <Filter>Sources</Filter>
     </ClInclude>
-    <ClInclude Include="..\src\codecs\music_mad.h">
-      <Filter>Sources</Filter>
-    </ClInclude>
     <ClInclude Include="..\src\codecs\music_mikmod.h">
       <Filter>Sources</Filter>
     </ClInclude>
@@ -179,9 +176,6 @@
     <ClCompile Include="..\src\codecs\music_fluidsynth.c">
       <Filter>Sources</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\codecs\music_mad.c">
-      <Filter>Sources</Filter>
-    </ClCompile>
     <ClCompile Include="..\src\codecs\music_mikmod.c">
       <Filter>Sources</Filter>
     </ClCompile>
diff --git a/Xcode/SDL_mixer.xcodeproj/project.pbxproj b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
index 21adc7b7..2e2fdf96 100644
--- a/Xcode/SDL_mixer.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
@@ -27,7 +27,6 @@
 		AAE405EB1F9607C300EDAF53 /* music_flac.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405C71F9607C000EDAF53 /* music_flac.h */; };
 		AAE405EC1F9607C300EDAF53 /* music_wav.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405C81F9607C000EDAF53 /* music_wav.h */; };
 		AAE405ED1F9607C300EDAF53 /* music_wav.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405C91F9607C000EDAF53 /* music_wav.c */; };
-		AAE405EE1F9607C300EDAF53 /* music_mad.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405CA1F9607C000EDAF53 /* music_mad.c */; };
 		AAE405F01F9607C300EDAF53 /* load_voc.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405CC1F9607C000EDAF53 /* load_voc.c */; };
 		AAE405F11F9607C300EDAF53 /* music.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405CD1F9607C000EDAF53 /* music.c */; };
 		AAE405F21F9607C300EDAF53 /* effects_internal.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405CE1F9607C100EDAF53 /* effects_internal.c */; };
@@ -44,7 +43,6 @@
 		AAE405FD1F9607C300EDAF53 /* music_ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405D91F9607C200EDAF53 /* music_ogg.c */; };
 		AAE405FE1F9607C300EDAF53 /* music_nativemidi.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405DA1F9607C200EDAF53 /* music_nativemidi.h */; };
 		AAE405FF1F9607C300EDAF53 /* music_cmd.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405DB1F9607C200EDAF53 /* music_cmd.h */; };
-		AAE406011F9607C300EDAF53 /* music_mad.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405DD1F9607C300EDAF53 /* music_mad.h */; };
 		AAE406021F9607C300EDAF53 /* music_cmd.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405DE1F9607C300EDAF53 /* music_cmd.c */; };
 		AAE406031F9607C300EDAF53 /* music_mpg123.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405DF1F9607C300EDAF53 /* music_mpg123.c */; };
 		AAE406041F9607C300EDAF53 /* effect_stereoreverse.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405E01F9607C300EDAF53 /* effect_stereoreverse.c */; };
@@ -78,8 +76,6 @@
 		F3823346273195F300F7F527 /* music_flac.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405C71F9607C000EDAF53 /* music_flac.h */; };
 		F3823347273195F500F7F527 /* music_fluidsynth.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405C61F9607C000EDAF53 /* music_fluidsynth.c */; };
 		F3823348273195F800F7F527 /* music_fluidsynth.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405BF1F9607BF00EDAF53 /* music_fluidsynth.h */; };
-		F3823349273195FA00F7F527 /* music_mad.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405CA1F9607C000EDAF53 /* music_mad.c */; };
-		F382334A273195FD00F7F527 /* music_mad.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405DD1F9607C300EDAF53 /* music_mad.h */; };
 		F382334B2731960000F7F527 /* music_mikmod.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405D81F9607C200EDAF53 /* music_mikmod.c */; };
 		F382334C2731960200F7F527 /* music_mikmod.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405CF1F9607C100EDAF53 /* music_mikmod.h */; };
 		F382334D2731960400F7F527 /* music_modplug.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405C41F9607C000EDAF53 /* music_modplug.c */; };
@@ -153,7 +149,6 @@
 		AAE405C71F9607C000EDAF53 /* music_flac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_flac.h; sourceTree = "<group>"; };
 		AAE405C81F9607C000EDAF53 /* music_wav.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_wav.h; sourceTree = "<group>"; };
 		AAE405C91F9607C000EDAF53 /* music_wav.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_wav.c; sourceTree = "<group>"; };
-		AAE405CA1F9607C000EDAF53 /* music_mad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_mad.c; sourceTree = "<group>"; };
 		AAE405CC1F9607C000EDAF53 /* load_voc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load_voc.c; sourceTree = "<group>"; };
 		AAE405CD1F9607C000EDAF53 /* music.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music.c; sourceTree = "<group>"; };
 		AAE405CE1F9607C100EDAF53 /* effects_internal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = effects_internal.c; sourceTree = "<group>"; };
@@ -170,7 +165,6 @@
 		AAE405D91F9607C200EDAF53 /* music_ogg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_ogg.c; sourceTree = "<group>"; };
 		AAE405DA1F9607C200EDAF53 /* music_nativemidi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_nativemidi.h; sourceTree = "<group>"; };
 		AAE405DB1F9607C200EDAF53 /* music_cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_cmd.h; sourceTree = "<group>"; };
-		AAE405DD1F9607C300EDAF53 /* music_mad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_mad.h; sourceTree = "<group>"; };
 		AAE405DE1F9607C300EDAF53 /* music_cmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_cmd.c; sourceTree = "<group>"; };
 		AAE405DF1F9607C300EDAF53 /* music_mpg123.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_mpg123.c; sourceTree = "<group>"; };
 		AAE405E01F9607C300EDAF53 /* effect_stereoreverse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = effect_stereoreverse.c; sourceTree = "<group>"; };
@@ -291,8 +285,6 @@
 				AAE405C71F9607C000EDAF53 /* music_flac.h */,
 				AAE405C61F9607C000EDAF53 /* music_fluidsynth.c */,
 				AAE405BF1F9607BF00EDAF53 /* music_fluidsynth.h */,
-				AAE405CA1F9607C000EDAF53 /* music_mad.c */,
-				AAE405DD1F9607C300EDAF53 /* music_mad.h */,
 				AAE405D81F9607C200EDAF53 /* music_mikmod.c */,
 				AAE405CF1F9607C100EDAF53 /* music_mikmod.h */,
 				AAE405C41F9607C000EDAF53 /* music_modplug.c */,
@@ -401,7 +393,6 @@
 				AAE405E71F9607C300EDAF53 /* load_voc.h in Headers */,
 				AAE405EC1F9607C300EDAF53 /* music_wav.h in Headers */,
 				F37A8D2D2838924900C38E95 /* music_drmp3.h in Headers */,
-				AAE406011F9607C300EDAF53 /* music_mad.h in Headers */,
 				AAE405E91F9607C300EDAF53 /* music_modplug.h in Headers */,
 				AAE405FE1F9607C300EDAF53 /* music_nativemidi.h in Headers */,
 				F37A8D4A2838A23400C38E95 /* music_drflac.h in Headers */,
@@ -435,7 +426,6 @@
 				F3823340273195E400F7F527 /* music.h in Headers */,
 				F38233522731961400F7F527 /* music_nativemidi.h in Headers */,
 				F382334C2731960200F7F527 /* music_mikmod.h in Headers */,
-				F382334A273195FD00F7F527 /* music_mad.h in Headers */,
 				F3823338273195CF00F7F527 /* utils.h in Headers */,
 				F38233562731961C00F7F527 /* music_timidity.h in Headers */,
 				F38233542731961800F7F527 /* music_ogg.h in Headers */,
@@ -641,7 +631,6 @@
 				AAE405F91F9607C300EDAF53 /* music_nativemidi.c in Sources */,
 				AAE406031F9607C300EDAF53 /* music_mpg123.c in Sources */,
 				AAE406041F9607C300EDAF53 /* effect_stereoreverse.c in Sources */,
-				AAE405EE1F9607C300EDAF53 /* music_mad.c in Sources */,
 				AAE405ED1F9607C300EDAF53 /* music_wav.c in Sources */,
 				AAE405E81F9607C300EDAF53 /* music_modplug.c in Sources */,
 				AAE405E51F9607C300EDAF53 /* mixer.c in Sources */,
@@ -661,7 +650,6 @@
 				F382334F2731960C00F7F527 /* music_mpg123.c in Sources */,
 				F382333B273195D800F7F527 /* effects_internal.c in Sources */,
 				0448E8AF108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
-				F3823349273195FA00F7F527 /* music_mad.c in Sources */,
 				F382333A273195D500F7F527 /* effect_stereoreverse.c in Sources */,
 				F382335B2731962900F7F527 /* load_voc.c in Sources */,
 				F382334D2731960400F7F527 /* music_modplug.c in Sources */,
diff --git a/configure b/configure
index 6548df24..ed42f0ef 100755
--- a/configure
+++ b/configure
@@ -947,8 +947,6 @@ enable_music_mp3
 enable_music_mp3_drmp3
 enable_music_mp3_mpg123
 enable_music_mp3_mpg123_shared
-enable_music_mp3_mad_gpl
-enable_music_mp3_mad_gpl_dithering
 enable_music_opus
 enable_music_opus_shared
 '
@@ -1654,10 +1652,6 @@ Optional Features:
                           enable MP3 music via mpg123 [default=no]
   --enable-music-mp3-mpg123-shared
                           dynamically load mpg123 library [default=yes]
-  --enable-music-mp3-mad-gpl
-                          enable MP3 music via libmad GPL code [default=no]
-  --enable-music-mp3-mad-gpl-dithering
-                          enable MP3 music via libmad GPL code [default=yes]
   --enable-music-opus     enable Opus music [default=yes]
   --enable-music-opus-shared
                           dynamically load opusfile library [default=yes]
@@ -4142,13 +4136,13 @@ if ${lt_cv_nm_interface+:} false; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4145: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4139: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4148: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4142: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4151: output\"" >&5)
+  (eval echo "\"\$as_me:4145: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5362,7 +5356,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5365 "configure"' > conftest.$ac_ext
+  echo '#line 5359 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7187,11 +7181,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7190: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7184: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7194: \$? = $ac_status" >&5
+   echo "$as_me:7188: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7536,11 +7530,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7539: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7533: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7543: \$? = $ac_status" >&5
+   echo "$as_me:7537: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7641,11 +7635,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7644: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7638: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7648: \$? = $ac_status" >&5
+   echo "$as_me:7642: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7696,11 +7690,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7699: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7693: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7703: \$? = $ac_status" >&5
+   echo "$as_me:7697: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10131,7 +10125,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10134 "configure"
+#line 10128 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10227,7 +10221,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10230 "configure"
+#line 10224 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13471,11 +13465,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13474: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13468: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13478: \$? = $ac_status" >&5
+   echo "$as_me:13472: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -13570,11 +13564,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13573: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13567: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13577: \$? = $ac_status" >&5
+   echo "$as_me:13571: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13622,11 +13616,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13625: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13619: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13629: \$? = $ac_status" >&5
+   echo "$as_me:13623: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17641,60 +17635,7 @@ $as_echo "$as_me: WARNING: *** Unable to find mpg123 library (https://www.mpg123
     fi
 fi
 
-# Check whether --enable-music-mp3-mad-gpl was given.
-if test "${enable_music_mp3_mad_gpl+set}" = set; then :
-  enableval=$enable_music_mp3_mad_gpl;
-else
-  enable_music_mp3_mad_gpl=no
-fi
-
-# Check whether --enable-music-mp3-mad-gpl-dithering was given.
-if test "${enable_music_mp3_mad_gpl_dithering+set}" = set; then :
-  enableval=$enable_music_mp3_mad_gpl_dithering;
-else
-  enable_music_mp3_mad_gpl_dithering=yes
-fi
-
-if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmad headers" >&5
-$as_echo_n "checking for libmad headers... " >&6; }
-    have_libmad=no
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-     #include "mad.h"
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  have_libmad=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_libmad" >&5
-$as_echo "$have_libmad" >&6; }
-    if test x$have_libmad = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
-        if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&5
-$as_echo "$as_me: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&2;}
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
-        fi
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
-        PC_LIBS="$PC_LIBS -lmad"
-    else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find MAD library (http://www.underbit.com/products/mad/)" >&5
-$as_echo "$as_me: WARNING: *** Unable to find MAD library (http://www.underbit.com/products/mad/)" >&2;}
-    fi
-fi
-
-if test x$enable_music_mp3 = xyes -a \
-        x$have_drmp3 != xyes -a x$have_libmpg123 != xyes -a x$have_libmad != xyes; then
+if test x$enable_music_mp3 = xyes -a x$have_drmp3 != xyes -a x$have_libmpg123 != xyes; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MP3 support disabled" >&5
 $as_echo "$as_me: WARNING: MP3 support disabled" >&2;}
 fi
diff --git a/configure.ac b/configure.ac
index 3bf622ca..a0195673 100644
--- a/configure.ac
+++ b/configure.ac
@@ -859,34 +859,7 @@ if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mpg123 = xyes; then
     fi
 fi
 
-AC_ARG_ENABLE(music-mp3-mad-gpl,
-[AS_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [default=no]])],
-                  [], [enable_music_mp3_mad_gpl=no])
-AC_ARG_ENABLE(music-mp3-mad-gpl-dithering,
-[AS_HELP_STRING([--enable-music-mp3-mad-gpl-dithering], [enable MP3 music via libmad GPL code [default=yes]])],
-                  [], [enable_music_mp3_mad_gpl_dithering=yes])
-if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
-    AC_MSG_CHECKING(for libmad headers)
-    have_libmad=no
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-     #include "mad.h"
-    ]],[])], [have_libmad=yes],[])
-    AC_MSG_RESULT($have_libmad)
-    if test x$have_libmad = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
-        if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
-            AC_MSG_WARN([*** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL])
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
-        fi
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
-        PC_LIBS="$PC_LIBS -lmad"
-    else
-        AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
-    fi
-fi
-
-if test x$enable_music_mp3 = xyes -a \
-        x$have_drmp3 != xyes -a x$have_libmpg123 != xyes -a x$have_libmad != xyes; then
+if test x$enable_music_mp3 = xyes -a x$have_drmp3 != xyes -a x$have_libmpg123 != xyes; then
     AC_MSG_WARN([MP3 support disabled])
 fi
 
diff --git a/include/SDL_mixer.h b/include/SDL_mixer.h
index 09f870f0..def2e39b 100644
--- a/include/SDL_mixer.h
+++ b/include/SDL_mixer.h
@@ -636,11 +636,11 @@ extern DECLSPEC int SDLCALL Mix_PausedMusic(void);
  */
 extern DECLSPEC int SDLCALL Mix_ModMusicJumpToOrder(int order);
 
-/* Set the current position in the music stream.
-   This returns 0 if successful, or -1 if it failed or isn't implemented.
+/* Set the current position in the music stream (in seconds).
+   This returns 0 if successful, or -1 if it failed or not implemented.
    This function is only implemented for MOD music formats (set pattern
-   order number) and for WAV, OGG, FLAC, MP3_MAD, MP3_MPG, and MODPLUG music
-   (set position in seconds), at the moment.
+   order number) and for WAV, OGG, FLAC, MP3, and MODPLUG music at the
+   moment.
 */
 extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
 
diff --git a/src/codecs/music_mad.c b/src/codecs/music_mad.c
deleted file mode 100644
index 09112ef5..00000000
--- a/src/codecs/music_mad.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
-  SDL_mixer:  An audio mixer library based on the SDL library
-  Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifdef MUSIC_MP3_MAD
-
-#include "music_mad.h"
-#include "mp3utils.h"
-
-#include "mad.h"
-
-
-/* NOTE: The dithering functions are GPL, which should be fine if your
-         application is GPL (which would need to be true if you enabled
-         libmad support in SDL_mixer). If you're using libmad under the
-         commercial license, you need to disable this code.
-*/
-/************************ dithering functions ***************************/
-
-#ifdef MUSIC_MP3_MAD_GPL_DITHERING
-
-/* All dithering done here is taken from the GPL'ed xmms-mad plugin. */
-
-/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura.       */
-/* Any feedback is very welcome. For any question, comments,       */
-/* see http://www.math.keio.ac.jp/matumoto/emt.html or email       */
-/* matumoto@math.keio.ac.jp                                        */
-
-/* Period parameters */
-#define MP3_DITH_N 624
-#define MP3_DITH_M 397
-#define MATRIX_A 0x9908b0df   /* constant vector a */
-#define UPPER_MASK 0x80000000 /* most significant w-r bits */
-#define LOWER_MASK 0x7fffffff /* least significant r bits */
-
-/* Tempering parameters */
-#define TEMPERING_MASK_B 0x9d2c5680
-#define TEMPERING_MASK_C 0xefc60000
-#define TEMPERING_SHIFT_U(y)  (y >> 11)
-#define TEMPERING_SHIFT_S(y)  (y << 7)
-#define TEMPERING_SHIFT_T(y)  (y << 15)
-#define TEMPERING_SHIFT_L(y)  (y >> 18)
-
-static unsigned long mt[MP3_DITH_N]; /* the array for the state vector  */
-static int mti=MP3_DITH_N+1; /* mti==MP3_DITH_N+1 means mt[MP3_DITH_N] is not initialized */
-
-/* initializing the array with a NONZERO seed */
-static void sgenrand(unsigned long seed)
-{
-    /* setting initial seeds to mt[MP3_DITH_N] using         */
-    /* the generator Line 25 of Table 1 in          */
-    /* [KNUTH 1981, The Art of Computer Progr

(Patch may be truncated, please check the link at the top of this post.)