Skip to content

Commit

Permalink
MP3 decoder upgrade work.
Browse files Browse the repository at this point in the history
Ripped out SMPEG and mpglib support, replaced it with "mpg123.c" and libmpg123.

libmpg123 is a much better version of mpglib, so it should solve all the
 problems about MP3's not seeking, or most modern MP3's not playing at all,
 etc. Since you no longer have to make a tradeoff with SMPEG for features, and
 SMPEG is basically rotting, I removed it from the project.

There is still work to be done with libmpg123...there are MMX, 3DNow, SSE,
 Altivec, etc decoders which we don't have enabled at the moment, and the
 build system could use some work to make this compile more cleanly, etc.

Still: huge win.
  • Loading branch information
icculus committed Jan 30, 2009
1 parent fac470a commit f0778fd
Show file tree
Hide file tree
Showing 97 changed files with 88,924 additions and 3,963 deletions.
8 changes: 3 additions & 5 deletions CREDITS.txt
Expand Up @@ -5,8 +5,7 @@
Initial API interface and implementation,
RAW driver,
VOC driver,
SMPEG driver,
MPGLIB driver,
MPG123 driver,
WAV driver,
OGG driver,
SHN driver,
Expand All @@ -18,8 +17,7 @@ Bug fixes,
FreeBSD testing:
Tsuyoshi Iguchi

Code cleanups,
SMPEG fixes,
Code cleanups and fixes,
AIFF driver,
MikMod driver,
MIDI driver,
Expand Down Expand Up @@ -56,7 +54,7 @@ Bugfixes and stuff:
FLAC 1.1.3 updates:
Josh Coalson

SMPEG fixes:
Fixes:
Chris Nelson

Other stuff:
Expand Down
6 changes: 5 additions & 1 deletion LICENSE.txt
Expand Up @@ -3,7 +3,11 @@ Please note that the included source from Timidity, the MIDI decoder, is also
separately under the GNU GPL, or the Perl Artistic License. Those licensing
terms are not reprinted here, but can be found on the web easily.

Other external libraries (such as Ogg Vorbis, SMPEG, etc) have their own
The included source for libmpg123, the MP3 decoder, is also licensed under the
following terms (GNU LGPL). We make no promises about patents you might
violate or royalty payments you might have to pay with this or any decoder.

Other external libraries (such as Ogg Vorbis, mikmod, etc) have their own
licenses which you should be aware of before including the related code
in your configuration. Most (if not all) are also under the LGPL, but are
external projects and we've got no control over them.
Expand Down
8 changes: 4 additions & 4 deletions Makefile.am
Expand Up @@ -19,18 +19,18 @@ else
TIMIDITY_LIB =
endif

if USE_MPGLIB
MPGLIB_LIB = decoders/mpglib/libmpglib.la
if USE_LIBMPG123
MPG123_LIB = decoders/libmpg123/libmpg123.la
else
MPGLIB_LIB =
MPG123_LIB =
endif

libSDL_sound_la_LDFLAGS = \
-release $(LT_RELEASE) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libSDL_sound_la_LIBADD = \
decoders/libdecoders.la \
$(TIMIDITY_LIB) $(MPGLIB_LIB)
$(TIMIDITY_LIB) $(MPG123_LIB)

EXTRA_DIST = \
CREDITS \
Expand Down
11 changes: 3 additions & 8 deletions SDL_sound.c
Expand Up @@ -48,8 +48,7 @@
/* The various decoder drivers... */

/* All these externs may be missing; we check SOUND_SUPPORTS_xxx before use. */
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_SMPEG;
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPGLIB;
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPG123;
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MIKMOD;
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MODPLUG;
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
Expand All @@ -72,12 +71,8 @@ typedef struct

static decoder_element decoders[] =
{
#if (defined SOUND_SUPPORTS_SMPEG)
{ 0, &__Sound_DecoderFunctions_SMPEG },
#endif

#if (defined SOUND_SUPPORTS_MPGLIB)
{ 0, &__Sound_DecoderFunctions_MPGLIB },
#if (defined SOUND_SUPPORTS_MPG123)
{ 0, &__Sound_DecoderFunctions_MPG123 },
#endif

#if (defined SOUND_SUPPORTS_MODPLUG)
Expand Down
2 changes: 1 addition & 1 deletion SDL_sound.h
Expand Up @@ -42,7 +42,7 @@
* Support is in place or planned for the following sound formats:
* - .WAV (Microsoft WAVfile RIFF data, internal.)
* - .VOC (Creative Labs' Voice format, internal.)
* - .MP3 (MPEG-1 Layer 3 support, via the SMPEG and mpglib libraries.)
* - .MP3 (MPEG-1 Layer 3 support, via libmpg123.)
* - .MID (MIDI music converted to Waveform data, internal.)
* - .MOD (MOD files, via MikMod and ModPlug.)
* - .OGG (Ogg files, via Ogg Vorbis libraries.)
Expand Down
1 change: 0 additions & 1 deletion TODO.txt
Expand Up @@ -10,7 +10,6 @@ Decoders still needing seek() method:
(If decoder can't seek, clean up the stub and report an error.)
- mikmod.c
- shn.c
- mpglib.c
- quicktime.c

General stuff TODO:
Expand Down
31 changes: 9 additions & 22 deletions configure.in
Expand Up @@ -54,6 +54,7 @@ dnl ---------------------------------------------------------------------
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_AS
AM_PROG_LIBTOOL


Expand Down Expand Up @@ -172,28 +173,14 @@ if test x$enable_midi = xyes; then
AC_DEFINE(SOUND_SUPPORTS_MIDI, 1, [Define if MIDI support is desired.])
fi

dnl Check for SMPEG
AC_ARG_ENABLE(smpeg,
[ --enable-smpeg enable MP3 decoding via smpeg [default=yes]],
, enable_smpeg=yes)
if test x$enable_smpeg = xyes; then
AC_CHECK_HEADER(smpeg.h, have_smpeg_hdr=yes)
AC_CHECK_LIB(smpeg, SMPEG_new, have_smpeg_lib=yes)
if test x$have_smpeg_hdr = xyes -a x$have_smpeg_lib = xyes; then
LIBS="$LIBS -lsmpeg"
AC_DEFINE(SOUND_SUPPORTS_SMPEG, 1, [Define if SMPEG support is desired.])
fi
dnl Check for the MP3 decoder...
AC_ARG_ENABLE(mpg123,
[ --enable-mpg123 enable MP3 decoding [default=yes]],
, enable_mpg123=yes)
if test x$enable_mpg123 = xyes; then
AC_DEFINE(SOUND_SUPPORTS_MPG123, 1, [Define if MPG123 support is desired.])
fi

dnl Check for the MIDI decoder...
AC_ARG_ENABLE(mpglib,
[ --enable-mpglib enable MP3 decoding internally [default=yes]],
, enable_mpglib=yes)
if test x$enable_mpglib = xyes; then
AC_DEFINE(SOUND_SUPPORTS_MPGLIB, 1, [Define if MPGLIB support is desired.])
fi


dnl Check for libmikmod
AC_ARG_ENABLE(mikmod,
[ --enable-mikmod enable MOD decoding via mikmod [default=yes]],
Expand Down Expand Up @@ -341,13 +328,13 @@ CFLAGS="$SDLSOUNDCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE"

dnl Add Makefile conditionals
AM_CONDITIONAL(USE_TIMIDITY, test x$enable_midi = xyes)
AM_CONDITIONAL(USE_MPGLIB, test x$enable_mpglib = xyes)
AM_CONDITIONAL(USE_LIBMPG123, test x$enable_mpg123 = xyes)
AM_CONDITIONAL(USE_PHYSICSFS, test x$enable_physfs = xyes)

AC_OUTPUT([
Makefile
decoders/Makefile
decoders/timidity/Makefile
decoders/mpglib/Makefile
decoders/libmpg123/Makefile
playsound/Makefile
])
5 changes: 2 additions & 3 deletions decoders/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libdecoders.la

SUBDIRS = timidity mpglib
SUBDIRS = timidity libmpg123

INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/decoders/timidity

Expand All @@ -9,8 +9,7 @@ libdecoders_la_SOURCES = \
au.c \
mikmod.c \
modplug.c \
mpglib.c \
smpeg.c \
mpg123.c \
ogg.c \
raw.c \
shn.c \
Expand Down
80 changes: 80 additions & 0 deletions decoders/libmpg123/Makefile.am
@@ -0,0 +1,80 @@
if USE_LIBMPG123
noinst_LTLIBRARIES = libmpg123.la
endif

# !!! FIXME: get MMX/SSE/Altivec/etc stuff in here.

INCLUDES = -I$(top_srcdir)/decodes/libmpg123
libmpg123_la_CFLAGS = -DOPT_GENERIC -DREAL_IS_FLOAT -DMPG123_NO_CONFIGURE

libmpg123_la_SOURCES = \
compat.c \
compat.h \
parse.c \
parse.h \
frame.c \
format.c \
frame.h \
reader.h \
debug.h \
decode.h \
decode_2to1.c \
decode_4to1.c \
decode_ntom.c \
equalizer.c \
huffman.h \
icy.c \
icy.h \
icy2utf8.c \
icy2utf8.h \
id3.c \
id3.h \
true.h \
l2tables.h \
layer1.c \
layer2.c \
layer3.c \
getbits.h \
optimize.h \
optimize.c \
readers.c \
tabinit.c \
stringbuf.c \
libmpg123.c \
mpg123lib_intern.h \
mangle.h \
getcpuflags.h \
index.h \
index.c \
mpg123.h \
config.h \
dct64.c \
decode.c \
libmpg123.sym

EXTRA_libmpg123_la_SOURCES = \
dct36_3dnowext.S \
dct36_3dnow.S \
dct64_3dnowext.S \
dct64_3dnow.S \
dct64_altivec.c \
dct64_i386.c \
dct64_i486.c \
dct64_mmx.S \
dct64_sse.S \
decode_3dnowext.S \
decode_3dnow.S \
decode_altivec.c \
decode_i386.c \
decode_i486.c \
decode_i586_dither.S \
decode_i586.S \
decode_mmx.S \
decode_sse3d.h \
decode_sse.S \
equalizer_3dnow.S \
tabinit_mmx.S \
getcpuflags.S

EXTRA_DIST = mpg123.h.in dnoise.sh dnoise.dat testcpu.c README-sdlsound.txt

109 changes: 109 additions & 0 deletions decoders/libmpg123/Makefile.am-original
@@ -0,0 +1,109 @@
## Makefile.am: produce Makefile.in from this

## copyright by the mpg123 project - free software under the terms of the LGPL 2.1
## see COPYING and AUTHORS files in distribution or http://mpg123.org
## initially written by Nicholas J. Humfrey

#AM_CFLAGS = @AUDIO_CFLAGS@
#AM_LDFLAGS =
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/libmpg123

EXTRA_DIST = mpg123.h.in dnoise.sh dnoise.dat

EXTRA_PROGRAMS = testcpu
testcpu_dependencies = getcpuflags.$(OBJEXT)
testcpu_sources = testcpu.c
testcpu_LDADD = getcpuflags.$(OBJEXT)


CLEANFILES = *.a


#lib_LIBRARIES = libmpg123.a
lib_LTLIBRARIES = libmpg123.la
nodist_include_HEADERS = mpg123.h

#libmpg123_a_LIBADD = @DECODER_OBJ@
#libmpg123_a_DEPENDENCIES = @DECODER_OBJ@

libmpg123_la_LDFLAGS = -no-undefined -version-info @LIBMPG123_VERSION@ -export-symbols $(top_srcdir)/src/libmpg123/libmpg123.sym
libmpg123_la_LIBADD = @DECODER_LOBJ@
libmpg123_la_DEPENDENCIES = @DECODER_LOBJ@ $(top_srcdir)/src/libmpg123/libmpg123.sym

libmpg123_la_SOURCES = \
compat.c \
compat.h \
parse.c \
parse.h \
frame.c \
format.c \
frame.h \
reader.h \
debug.h \
decode.h \
decode_2to1.c \
decode_4to1.c \
decode_ntom.c \
equalizer.c \
huffman.h \
icy.c \
icy.h \
icy2utf8.c \
icy2utf8.h \
id3.c \
id3.h \
true.h \
l2tables.h \
layer1.c \
layer2.c \
layer3.c \
getbits.h \
optimize.h \
optimize.c \
readers.c \
tabinit.c \
stringbuf.c \
libmpg123.c \
mpg123lib_intern.h \
mangle.h \
getcpuflags.h \
index.h \
index.c \
libmpg123.sym

EXTRA_libmpg123_la_SOURCES = \
dct36_3dnowext.S \
dct36_3dnow.S \
dct64_3dnowext.S \
dct64_3dnow.S \
dct64_altivec.c \
dct64.c \
dct64_i386.c \
dct64_i486.c \
dct64_mmx.S \
dct64_sse.S \
decode_3dnowext.S \
decode_3dnow.S \
decode_altivec.c \
decode.c \
decode_i386.c \
decode_i486.c \
decode_i586_dither.S \
decode_i586.S \
decode_mmx.S \
decode_sse3d.h \
decode_sse.S \
equalizer_3dnow.S \
tabinit_mmx.S \
getcpuflags.S

# explicit preprocessing since mingw32 does not honor the big .S
.S.o:
$(CPP) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(CPPFLAGS) $< > $<.s
$(CCAS) $(CCASFLAGS) -c -o $@ $<.s && rm $<.s

.S.lo:
$(LTCCASCOMPILE) $(DEFAULT_INCLUDES) -c -o $@ $<

dnoise.c: dnoise.dat dnoise.sh
sh dnoise.sh "$<" > "$@"

0 comments on commit f0778fd

Please sign in to comment.