Navigation Menu

Skip to content

Commit

Permalink
backport commits db2d266 to 092f7e1 from default / 2.0:
Browse files Browse the repository at this point in the history
- move tag skip and SDL_RW with bookkeeping code into separate mp3utils.c
- remove unnecessary file rewind calls in tag detection code.
- music_mpg: use tag handling from mp3utils to avoid frame error reports
- initial support for skipping the old MusicMatch tags
  • Loading branch information
sezero committed Dec 14, 2019
1 parent 6abb150 commit b347209
Show file tree
Hide file tree
Showing 13 changed files with 488 additions and 260 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -39,7 +39,7 @@ VERSION_OBJECTS = @VERSION_OBJECTS@
PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@
PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@

DIST = Android.mk CHANGES COPYING CWProjects.sea.bin MPWmake.sea.bin Makefile.in SDL_mixer.pc.in README SDL_mixer.h SDL_mixer.qpg.in SDL_mixer.spec SDL_mixer.spec.in VisualC Watcom-OS2.zip Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.in dynamic_flac.c dynamic_flac.h dynamic_fluidsynth.c dynamic_fluidsynth.h dynamic_mod.c dynamic_mod.h dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h fluidsynth.c fluidsynth.h gcc-fat.sh libmikmod-3.1.12.zip load_aiff.c load_aiff.h load_flac.c load_flac.h load_ogg.c load_ogg.h load_voc.c load_voc.h mixer.c music.c music_cmd.c music_cmd.h music_flac.c music_flac.h music_mad.c music_mad.h music_mod.c music_mod.h music_modplug.c music_modplug.h music_ogg.c music_ogg.h native_midi playmus.c playwave.c timidity wavestream.c wavestream.h version.rc
DIST = Android.mk CHANGES COPYING CWProjects.sea.bin MPWmake.sea.bin Makefile.in SDL_mixer.pc.in README SDL_mixer.h SDL_mixer.qpg.in SDL_mixer.spec SDL_mixer.spec.in VisualC Watcom-OS2.zip Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.in dynamic_flac.c dynamic_flac.h dynamic_fluidsynth.c dynamic_fluidsynth.h dynamic_mod.c dynamic_mod.h dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h fluidsynth.c fluidsynth.h gcc-fat.sh libmikmod-3.1.12.zip load_aiff.c load_aiff.h load_flac.c load_flac.h load_ogg.c load_ogg.h load_voc.c load_voc.h mixer.c mp3utils.c mp3utils.h music.c music_cmd.c music_cmd.h music_flac.c music_flac.h music_mad.c music_mad.h music_mod.c music_mod.h music_modplug.c music_modplug.h music_ogg.c music_ogg.h native_midi playmus.c playwave.c timidity wavestream.c wavestream.h version.rc

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
16 changes: 12 additions & 4 deletions VisualC/SDL_mixer.vcproj
Expand Up @@ -884,19 +884,19 @@
>
</File>
<File
RelativePath="..\music_mad.c"
RelativePath="..\mp3utils.c"
>
</File>
<File
RelativePath="..\music_mad.h"
RelativePath="..\mp3utils.h"
>
</File>
<File
RelativePath="..\music_mod.c"
RelativePath="..\music_mad.c"
>
</File>
<File
RelativePath="..\music_mod.h"
RelativePath="..\music_mad.h"
>
</File>
<File
Expand All @@ -907,6 +907,14 @@
RelativePath="..\music_mpg.h"
>
</File>
<File
RelativePath="..\music_mod.c"
>
</File>
<File
RelativePath="..\music_mod.h"
>
</File>
<File
RelativePath="..\music_ogg.c"
>
Expand Down
16 changes: 16 additions & 0 deletions Xcode-iOS/SDL_mixer.xcodeproj/project.pbxproj
Expand Up @@ -14,6 +14,10 @@
00938E57108A397A0009CF19 /* dynamic_ogg.h in Headers */ = {isa = PBXBuildFile; fileRef = 00938E4D108A397A0009CF19 /* dynamic_ogg.h */; };
04A8FCA60A19CAEC0046373F /* dynamic_mp3.c in Sources */ = {isa = PBXBuildFile; fileRef = 04A8FCA40A19CAEC0046373F /* dynamic_mp3.c */; };
04A8FCAB0A19CB070046373F /* dynamic_ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = 04A8FCA90A19CB070046373F /* dynamic_ogg.c */; };
639090F823A5305400D5554E /* music_mpg.c in Sources */ = {isa = PBXBuildFile; fileRef = 639090F623A5305400D5554E /* music_mpg.c */; };
639090F923A5305400D5554E /* music_mpg.h in Headers */ = {isa = PBXBuildFile; fileRef = 639090F723A5305400D5554E /* music_mpg.h */; };
639090FC23A5306500D5554E /* mp3utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 639090FA23A5306500D5554E /* mp3utils.c */; };
639090FD23A5306500D5554E /* mp3utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 639090FB23A5306500D5554E /* mp3utils.h */; };
AA5F0F0914B6A6490036992F /* dynamic_fluidsynth.c in Sources */ = {isa = PBXBuildFile; fileRef = AA5F0F0214B6A6490036992F /* dynamic_fluidsynth.c */; };
AA5F0F0A14B6A6490036992F /* dynamic_fluidsynth.h in Headers */ = {isa = PBXBuildFile; fileRef = AA5F0F0314B6A6490036992F /* dynamic_fluidsynth.h */; };
AA5F0F0B14B6A6490036992F /* dynamic_mod.h in Headers */ = {isa = PBXBuildFile; fileRef = AA5F0F0414B6A6490036992F /* dynamic_mod.h */; };
Expand Down Expand Up @@ -116,6 +120,10 @@
5CC1B898012FB8CD7F000001 /* timidity.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = timidity.h; sourceTree = "<group>"; };
5CC1B89B012FB8CD7F000001 /* wavestream.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wavestream.c; path = ../wavestream.c; sourceTree = "<group>"; };
5CC1B89C012FB8CD7F000001 /* wavestream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = wavestream.h; path = ../wavestream.h; sourceTree = "<group>"; };
639090F623A5305400D5554E /* music_mpg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = music_mpg.c; path = ../music_mpg.c; sourceTree = SOURCE_ROOT; };
639090F723A5305400D5554E /* music_mpg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = music_mpg.h; path = ../music_mpg.h; sourceTree = SOURCE_ROOT; };
639090FA23A5306500D5554E /* mp3utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mp3utils.c; path = ../mp3utils.c; sourceTree = SOURCE_ROOT; };
639090FB23A5306500D5554E /* mp3utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mp3utils.h; path = ../mp3utils.h; sourceTree = SOURCE_ROOT; };
AA5F0F0214B6A6490036992F /* dynamic_fluidsynth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dynamic_fluidsynth.c; path = ../dynamic_fluidsynth.c; sourceTree = "<group>"; };
AA5F0F0314B6A6490036992F /* dynamic_fluidsynth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dynamic_fluidsynth.h; path = ../dynamic_fluidsynth.h; sourceTree = "<group>"; };
AA5F0F0414B6A6490036992F /* dynamic_mod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dynamic_mod.h; path = ../dynamic_mod.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -184,6 +192,10 @@
08FB77ACFE841707C02AAC07 /* Library Source */ = {
isa = PBXGroup;
children = (
639090FA23A5306500D5554E /* mp3utils.c */,
639090FB23A5306500D5554E /* mp3utils.h */,
639090F623A5305400D5554E /* music_mpg.c */,
639090F723A5305400D5554E /* music_mpg.h */,
00938E49108A397A0009CF19 /* dynamic_flac.c */,
00938E4A108A397A0009CF19 /* dynamic_flac.h */,
AA5F0F0214B6A6490036992F /* dynamic_fluidsynth.c */,
Expand Down Expand Up @@ -295,6 +307,8 @@
AA5F0F0B14B6A6490036992F /* dynamic_mod.h in Headers */,
AA5F0F0D14B6A6490036992F /* fluidsynth.h in Headers */,
AA5F0F0F14B6A6490036992F /* music_modplug.h in Headers */,
639090F923A5305400D5554E /* music_mpg.h in Headers */,
639090FD23A5306500D5554E /* mp3utils.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -394,6 +408,8 @@
AA5F0F0914B6A6490036992F /* dynamic_fluidsynth.c in Sources */,
AA5F0F0C14B6A6490036992F /* fluidsynth.c in Sources */,
AA5F0F0E14B6A6490036992F /* music_modplug.c in Sources */,
639090F823A5305400D5554E /* music_mpg.c in Sources */,
639090FC23A5306500D5554E /* mp3utils.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
12 changes: 12 additions & 0 deletions Xcode/SDL_mixer.xcodeproj/project.pbxproj
Expand Up @@ -37,6 +37,10 @@
639076AC216EC43000ED9E54 /* music_mpg.c in Sources */ = {isa = PBXBuildFile; fileRef = 639076AA216EC43000ED9E54 /* music_mpg.c */; };
639076AE216EC49000ED9E54 /* music_mpg.h in Headers */ = {isa = PBXBuildFile; fileRef = 639076AD216EC49000ED9E54 /* music_mpg.h */; };
639076AF216EC49000ED9E54 /* music_mpg.h in Headers */ = {isa = PBXBuildFile; fileRef = 639076AD216EC49000ED9E54 /* music_mpg.h */; };
639090DF23A52FF400D5554E /* mp3utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 639090DD23A52FF400D5554E /* mp3utils.c */; };
639090E023A52FF400D5554E /* mp3utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 639090DE23A52FF400D5554E /* mp3utils.h */; };
639090E123A52FF400D5554E /* mp3utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 639090DD23A52FF400D5554E /* mp3utils.c */; };
639090E223A52FF400D5554E /* mp3utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 639090DE23A52FF400D5554E /* mp3utils.h */; };
63CB2527216EC68100928244 /* mpg123.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 639076A3216EC3E200ED9E54 /* mpg123.framework */; };
AA9F7DB514B15ADC00278D1E /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9F7DB314B15ADC00278D1E /* Ogg.framework */; };
AA9F7DB614B15ADC00278D1E /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9F7DB414B15ADC00278D1E /* Vorbis.framework */; };
Expand Down Expand Up @@ -218,6 +222,8 @@
639076A3216EC3E200ED9E54 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = Frameworks/mpg123.framework; sourceTree = "<group>"; };
639076AA216EC43000ED9E54 /* music_mpg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = music_mpg.c; path = ../music_mpg.c; sourceTree = SOURCE_ROOT; };
639076AD216EC49000ED9E54 /* music_mpg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = music_mpg.h; path = ../music_mpg.h; sourceTree = SOURCE_ROOT; };
639090DD23A52FF400D5554E /* mp3utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mp3utils.c; path = ../mp3utils.c; sourceTree = SOURCE_ROOT; };
639090DE23A52FF400D5554E /* mp3utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mp3utils.h; path = ../mp3utils.h; sourceTree = SOURCE_ROOT; };
AA9F7DB314B15ADC00278D1E /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = Frameworks/Ogg.framework; sourceTree = "<group>"; };
AA9F7DB414B15ADC00278D1E /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = Frameworks/Vorbis.framework; sourceTree = "<group>"; };
AA9F7DB714B15AE700278D1E /* FLAC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FLAC.framework; path = Frameworks/FLAC.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -308,6 +314,8 @@
08FB77ACFE841707C02AAC07 /* Library Source */ = {
isa = PBXGroup;
children = (
639090DD23A52FF400D5554E /* mp3utils.c */,
639090DE23A52FF400D5554E /* mp3utils.h */,
639076AD216EC49000ED9E54 /* music_mpg.h */,
639076AA216EC43000ED9E54 /* music_mpg.c */,
00938E49108A397A0009CF19 /* dynamic_flac.c */,
Expand Down Expand Up @@ -466,6 +474,7 @@
00938E51108A397A0009CF19 /* dynamic_mp3.h in Headers */,
00938E52108A397A0009CF19 /* dynamic_ogg.h in Headers */,
639076AE216EC49000ED9E54 /* music_mpg.h in Headers */,
639090E023A52FF400D5554E /* mp3utils.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -496,6 +505,7 @@
00938E56108A397A0009CF19 /* dynamic_mp3.h in Headers */,
00938E57108A397A0009CF19 /* dynamic_ogg.h in Headers */,
639076AF216EC49000ED9E54 /* music_mpg.h in Headers */,
639090E223A52FF400D5554E /* mp3utils.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -695,6 +705,7 @@
00938E50108A397A0009CF19 /* dynamic_mod.c in Sources */,
0448E8AE108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
639076AB216EC43000ED9E54 /* music_mpg.c in Sources */,
639090DF23A52FF400D5554E /* mp3utils.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -732,6 +743,7 @@
00938E55108A397A0009CF19 /* dynamic_mod.c in Sources */,
0448E8AF108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
639076AC216EC43000ED9E54 /* music_mpg.c in Sources */,
639090E123A52FF400D5554E /* mp3utils.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 4 additions & 1 deletion configure
Expand Up @@ -14883,6 +14883,7 @@ else
enable_music_mp3_shared=yes
fi

have_mpg123=no
if test x$enable_music_mp3 = xyes; then
if test "${ac_cv_header_mpg123_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for mpg123.h" >&5
Expand Down Expand Up @@ -15119,10 +15120,10 @@ else
enable_music_mp3_mad_gpl=no
fi

have_libmad=no
if test x$enable_music_mp3_mad_gpl = xyes; then
{ $as_echo "$as_me:$LINENO: checking for libmad headers" >&5
$as_echo_n "checking for libmad headers... " >&6; }
have_libmad=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
Expand Down Expand Up @@ -15185,6 +15186,8 @@ fi
if test x$have_mpg123 != xyes -a x$have_libmad != xyes; then
{ $as_echo "$as_me:$LINENO: WARNING: MP3 support disabled" >&5
$as_echo "$as_me: WARNING: MP3 support disabled" >&2;}
else
SOURCES="$SOURCES $srcdir/mp3utils.c"
fi

EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBM"
Expand Down
5 changes: 4 additions & 1 deletion configure.in
Expand Up @@ -558,6 +558,7 @@ AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via libmpg123 [[default=y
AC_ARG_ENABLE([music-mp3-shared],
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
[], [enable_music_mp3_shared=yes])
have_mpg123=no
if test x$enable_music_mp3 = xyes; then
AC_CHECK_HEADER([mpg123.h], [have_mpg123_hdr=yes])
AC_CHECK_LIB([mpg123], [mpg123_replace_reader_handle], [have_mpg123_lib=yes])
Expand Down Expand Up @@ -590,9 +591,9 @@ fi
AC_ARG_ENABLE(music-mp3-mad-gpl,
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
[], [enable_music_mp3_mad_gpl=no])
have_libmad=no
if test x$enable_music_mp3_mad_gpl = xyes; then
AC_MSG_CHECKING(for libmad headers)
have_libmad=no
AC_TRY_COMPILE([
#include "mad.h"
],[
Expand All @@ -611,6 +612,8 @@ fi

if test x$have_mpg123 != xyes -a x$have_libmad != xyes; then
AC_MSG_WARN([MP3 support disabled])
else
SOURCES="$SOURCES $srcdir/mp3utils.c"
fi

EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBM"
Expand Down
2 changes: 1 addition & 1 deletion dynamic_mp3.c
Expand Up @@ -57,7 +57,7 @@ int Mix_InitMP3(void)
FUNCTION_LOADER(mpg123_new, mpg123_handle *(*)(const char* decoder, int *error))
FUNCTION_LOADER(mpg123_open_handle, int (*)(mpg123_handle *mh, void *iohandle))
FUNCTION_LOADER(mpg123_plain_strerror, const char* (*)(int errcode))
FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number));
FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number))
FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done ))
FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
FUNCTION_LOADER(mpg123_seek, off_t (*)( mpg123_handle *mh, off_t sampleoff, int whence ))
Expand Down

0 comments on commit b347209

Please sign in to comment.