mpg123: Android build support (fcb67)

From fcb6775ca019a80289d1b60b968b33784c8b8f16 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 18 Jul 2023 00:24:36 +0200
Subject: [PATCH] Android build support

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
---
 Android.mk       |  227 ++++++
 android/config.h |  478 +++++++++++
 android/mpg123.h | 2030 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 2735 insertions(+)
 create mode 100644 Android.mk
 create mode 100644 android/config.h
 create mode 100644 android/mpg123.h

diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..90a2d85
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,227 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmpg123
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/android \
+                    $(LOCAL_PATH)/src \
+                    $(LOCAL_PATH)/src/compat \
+                    $(LOCAL_PATH)/src/libmpg123 \
+
+DECODER_CFLAGS_NEON := -DOPT_NEON -DREAL_IS_FLOAT
+
+DECODER_SRC_NEON := \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/ntom.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/dct36_neon.S \
+    src/libmpg123/dct64_neon_float.S \
+    src/libmpg123/synth_neon_float.S \
+    src/libmpg123/synth_neon_s32.S \
+    src/libmpg123/synth_stereo_neon_float.S \
+    src/libmpg123/synth_stereo_neon_s32.S \
+    src/libmpg123/dct64_neon.S \
+    src/libmpg123/synth_neon.S \
+    src/libmpg123/synth_stereo_neon.S \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/feature.c \
+
+DECODER_CFLAGS_NEON64 := -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_NEON64 -DREAL_IS_FLOAT
+
+DECODER_SRC_NEON64 := \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/ntom.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/dct36_neon64.S \
+    src/libmpg123/dct64_neon64_float.S \
+    src/libmpg123/synth_neon64_float.S \
+    src/libmpg123/synth_neon64_s32.S \
+    src/libmpg123/synth_stereo_neon64_float.S \
+    src/libmpg123/synth_stereo_neon64_s32.S \
+    src/libmpg123/dct64_neon64.S \
+    src/libmpg123/synth_neon64.S \
+    src/libmpg123/synth_stereo_neon64.S \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/dither.c \
+    src/libmpg123/getcpuflags_arm.c \
+    src/libmpg123/check_neon.S \
+    src/libmpg123/feature.c \
+
+# Unfortunately the assembly isn't relocatable so doesn't work on modern
+# Android devices
+DECODER_CFLAGS_X86 := -DOPT_GENERIC -DREAL_IS_FLOAT
+DECODER_CFLAGS_X86_ASM := -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_I386 -DOPT_I586 -DOPT_I586_DITHER -DOPT_MMX -DOPT_3DNOW -DOPT_3DNOW_VINTAGE -DOPT_3DNOWEXT -DOPT_3DNOWEXT_VINTAGE -DOPT_SSE -DOPT_SSE_VINTAGE -DREAL_IS_FLOAT
+
+DECODER_SRC_X86 := \
+    src/libmpg123/feature.c \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/ntom.c \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/dither.c \
+
+DECODER_SRC_X86_ASM := \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/ntom.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/dct64_i386.c \
+    src/libmpg123/synth_i586.S \
+    src/libmpg123/synth_i586_dither.S \
+    src/libmpg123/dct64_mmx.S \
+    src/libmpg123/tabinit_mmx.S \
+    src/libmpg123/synth_mmx.S \
+    src/libmpg123/synth_3dnow.S \
+    src/libmpg123/dct64_3dnow.S \
+    src/libmpg123/equalizer_3dnow.S \
+    src/libmpg123/dct36_3dnow.S \
+    src/libmpg123/dct64_3dnowext.S \
+    src/libmpg123/synth_3dnowext.S \
+    src/libmpg123/dct36_3dnowext.S \
+    src/libmpg123/dct64_sse_float.S \
+    src/libmpg123/synth_sse_float.S \
+    src/libmpg123/synth_stereo_sse_float.S \
+    src/libmpg123/synth_sse_s32.S \
+    src/libmpg123/synth_stereo_sse_s32.S \
+    src/libmpg123/dct36_sse.S \
+    src/libmpg123/dct64_sse.S \
+    src/libmpg123/synth_sse.S \
+    src/libmpg123/getcpuflags.S \
+    src/libmpg123/dither.c \
+    src/libmpg123/feature.c \
+
+DECODER_CFLAGS_X64 := -DOPT_MULTI -DOPT_X86_64 -DOPT_GENERIC -DOPT_GENERIC_DITHER -DREAL_IS_FLOAT -DOPT_AVX
+
+DECODER_SRC_X64 := \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/icy.h \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/icy2utf8.h \
+    src/libmpg123/ntom.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth.h \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/synth_8bit.h \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/dct36_x86_64.S \
+    src/libmpg123/dct64_x86_64_float.S \
+    src/libmpg123/synth_x86_64_float.S \
+    src/libmpg123/synth_x86_64_s32.S \
+    src/libmpg123/synth_stereo_x86_64_float.S \
+    src/libmpg123/synth_stereo_x86_64_s32.S \
+    src/libmpg123/synth_x86_64.S \
+    src/libmpg123/dct64_x86_64.S \
+    src/libmpg123/synth_stereo_x86_64.S \
+    src/libmpg123/dither.c \
+    src/libmpg123/dither.h \
+    src/libmpg123/getcpuflags_x86_64.S \
+    src/libmpg123/dct36_avx.S \
+    src/libmpg123/dct64_avx_float.S \
+    src/libmpg123/synth_stereo_avx_float.S \
+    src/libmpg123/synth_stereo_avx_s32.S \
+    src/libmpg123/dct64_avx.S \
+    src/libmpg123/synth_stereo_avx.S \
+    src/libmpg123/feature.c
+
+DECODER_CFLAGS_MIPS := -DOPT_GENERIC -DREAL_IS_FLOAT
+
+DECODER_SRC_MIPS := \
+    src/libmpg123/stringbuf.c \
+    src/libmpg123/icy.c \
+    src/libmpg123/icy2utf8.c \
+    src/libmpg123/ntom.c \
+    src/libmpg123/synth.c \
+    src/libmpg123/synth_8bit.c \
+    src/libmpg123/layer1.c \
+    src/libmpg123/layer2.c \
+    src/libmpg123/layer3.c \
+    src/libmpg123/synth_s32.c \
+    src/libmpg123/synth_real.c \
+    src/libmpg123/feature.c
+
+ifeq ($(TARGET_ARCH_ABI),armeabi)
+DECODER_CFLAGS := $(DECODER_CFLAGS_NEON)
+DECODER_SRC := $(DECODER_SRC_NEON)
+endif
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+DECODER_CFLAGS := $(DECODER_CFLAGS_NEON)
+DECODER_SRC := $(DECODER_SRC_NEON)
+endif
+ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
+DECODER_CFLAGS := $(DECODER_CFLAGS_NEON64)
+DECODER_SRC := $(DECODER_SRC_NEON64)
+endif
+ifeq ($(TARGET_ARCH_ABI),x86)
+DECODER_CFLAGS := $(DECODER_CFLAGS_X86)
+DECODER_SRC := $(DECODER_SRC_X86)
+endif
+ifeq ($(TARGET_ARCH_ABI),x86_64)
+DECODER_CFLAGS := $(DECODER_CFLAGS_X64)
+DECODER_SRC := $(DECODER_SRC_X64)
+endif
+ifeq ($(TARGET_ARCH_ABI),mips)
+DECODER_CFLAGS := $(DECODER_CFLAGS_MIPS)
+DECODER_SRC := $(DECODER_SRC_MIPS)
+endif
+ifeq ($(TARGET_ARCH_ABI),mips64)
+DECODER_CFLAGS := $(DECODER_CFLAGS_MIPS)
+DECODER_SRC := $(DECODER_SRC_MIPS)
+endif
+
+LOCAL_CFLAGS := $(DECODER_CFLAGS)
+
+LOCAL_SRC_FILES := \
+    src/libmpg123/parse.c \
+    src/libmpg123/frame.c \
+    src/libmpg123/format.c \
+    src/libmpg123/dct64.c \
+    src/libmpg123/equalizer.c \
+    src/libmpg123/id3.c \
+    src/libmpg123/optimize.c \
+    src/libmpg123/readers.c \
+    src/libmpg123/tabinit.c \
+    src/libmpg123/libmpg123.c \
+    src/libmpg123/index.c \
+    src/compat/compat_str.c \
+    src/compat/compat.c \
+    $(DECODER_SRC)
+
+LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
+
+LOCAL_LDFLAGS := -Wl,--no-undefined
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/android/config.h b/android/config.h
new file mode 100644
index 0000000..50d9114
--- /dev/null
+++ b/android/config.h
@@ -0,0 +1,478 @@
+/* src/config.h.  Generated from config.h.in by configure.  */
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if your architecture wants/needs/can use attribute_align_arg and
+   alignment checks. It is for 32bit x86... */
+/* #undef ABI_ALIGN_FUN */
+
+/* Define to use proper rounding. */
+/* #undef ACCURATE_ROUNDING */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define if .balign is present. */
+#define ASMALIGN_BALIGN 1
+
+/* Define if .align just takes byte count. */
+/* #undef ASMALIGN_BYTE */
+
+/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */
+/* #undef ASMALIGN_EXP */
+
+/* Define if __attribute__((aligned(16))) shall be used */
+#define CCALIGN 1
+
+/* Define if debugging is enabled. */
+/* #undef DEBUG */
+
+/* The default audio output module(s) to use */
+#define DEFAULT_OUTPUT_MODULE "oss,esd,pulse"
+
+/* Define if building with dynamcally linked libmpg123 */
+#define DYNAMIC_BUILD 1
+
+/* Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter */
+/* #undef EOVERFLOW */
+
+/* Define if FIFO support is enabled. */
+/* #undef FIFO */
+
+/* Define if frame index should be used. */
+#define FRAME_INDEX 1
+
+/* Define if gapless is enabled. */
+#define GAPLESS 1
+
+/* Define to 1 if you have the <alc.h> header file. */
+/* #undef HAVE_ALC_H */
+
+/* Define to 1 if you have the <Alib.h> header file. */
+/* #undef HAVE_ALIB_H */
+
+/* Define to 1 if you have the <AL/alc.h> header file. */
+/* #undef HAVE_AL_ALC_H */
+
+/* Define to 1 if you have the <AL/al.h> header file. */
+/* #undef HAVE_AL_AL_H */
+
+/* Define to 1 if you have the <al.h> header file. */
+/* #undef HAVE_AL_H */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <asm/audioio.h> header file. */
+/* #undef HAVE_ASM_AUDIOIO_H */
+
+/* Define to 1 if you have the `atoll' function. */
+#define HAVE_ATOLL 1
+
+/* Define to 1 if you have the <audios.h> header file. */
+/* #undef HAVE_AUDIOS_H */
+
+/* Define to 1 if you have the <AudioToolbox/AudioToolbox.h> header file. */
+/* #undef HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H */
+
+/* Define to 1 if you have the <AudioUnit/AudioUnit.h> header file. */
+/* #undef HAVE_AUDIOUNIT_AUDIOUNIT_H */
+
+/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
+/* #undef HAVE_CORESERVICES_CORESERVICES_H */
+
+/* Define to 1 if you have the <CUlib.h> header file. */
+/* #undef HAVE_CULIB_H */
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dlclose' function. */
+#define HAVE_DLCLOSE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlopen' function. */
+#define HAVE_DLOPEN 1
+
+/* Define to 1 if you have the `dlsym' function. */
+#define HAVE_DLSYM 1
+
+/* Define if getaddrinfo accepts the AI_ADDRCONFIG flag */
+/* #undef HAVE_GAI_ADDRCONFIG */
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+/* #undef HAVE_GETPAGESIZE */
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+/* #undef HAVE_LANGINFO_H */
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the `mx' library (-lmx). */
+/* #undef HAVE_LIBMX */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/soundcard.h> header file. */
+#define HAVE_LINUX_SOUNDCARD_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the <machine/soundcard.h> header file. */
+/* #undef HAVE_MACHINE_SOUNDCARD_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+/* #undef HAVE_MKFIFO */
+
+/* Define to 1 if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+/* #undef HAVE_NETINET_TCP_H */
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+/* #undef HAVE_NL_LANGINFO */
+
+/* Define to 1 if you have the <OpenAL/alc.h> header file. */
+/* #undef HAVE_OPENAL_ALC_H */
+
+/* Define to 1 if you have the <OpenAL/al.h> header file. */
+/* #undef HAVE_OPENAL_AL_H */
+
+/* Define to 1 if you have the <os2me.h> header file. */
+/* #undef HAVE_OS2ME_H */
+
+/* Define to 1 if you have the <os2.h> header file. */
+/* #undef HAVE_OS2_H */
+
+/* Define to 1 if you have the `random' function. */
+/* #undef HAVE_RANDOM */
+
+/* Define to 1 if you have the <sched.h> header file. */
+#define HAVE_SCHED_H 1
+
+/* Define to 1 if you have the `sched_setscheduler' function. */
+#define HAVE_SCHED_SETSCHEDULER 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setpriority' function. */
+#define HAVE_SETPRIORITY 1
+
+/* Define to 1 if you have the `setuid' function. */
+#define HAVE_SETUID 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <sndio.h> header file. */
+/* #undef HAVE_SNDIO_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sun/audioio.h> header file. */
+/* #undef HAVE_SUN_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/audioio.h> header file. */
+/* #undef HAVE_SYS_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/audio.h> header file. */
+/* #undef HAVE_SYS_AUDIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+/* #undef HAVE_SYS_SIGNAL_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+/* #undef HAVE_SYS_SOUNDCARD_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define this if you have the POSIX termios library */
+#define HAVE_TERMIOS 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+/* #undef HAVE_WS2TCPIP_H */
+
+/* Define to indicate that float storage follows IEEE754. */
+#define IEEE_FLOAT 1
+
+/* size of the frame index seek table */
+#define INDEX_SIZE 1000
+
+/* Define if IPV6 support is enabled. */
+#define IPV6 1
+
+/* Define this to the size of native offset type in bits, used for LFS alias
+   functions. */
+#define LFS_ALIAS_BITS 32
+
+/* Define to the extension used for runtime loadable modules, say, ".so". */
+#define LT_MODULE_EXT ".so"
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to the shared library suffix, say, ".dylib". */
+/* #undef LT_SHARED_EXT */
+
+/* Define to the shared archive member specification, say "(shr.o)". */
+/* #undef LT_SHARED_LIB_MEMBER */
+
+/* Define if network support is enabled. */
+#define NETWORK 1
+
+/* Define to disable 16 bit integer output. */
+/* #undef NO_16BIT */
+
+/* Define to disable 32 bit and 24 bit integer output. */
+/* #undef NO_32BIT */
+
+/* Define to disable 8 bit integer output. */
+/* #undef NO_8BIT */
+
+/* Define to disable downsampled decoding. */
+/* #undef NO_DOWNSAMPLE */
+
+/* Define to disable equalizer. */
+/* #undef NO_EQUALIZER */
+
+/* Define to disable error messages in combination with a return value (the
+   return is left intact). */
+/* #undef NO_ERETURN */
+
+/* Define to disable error messages. */
+/* #undef NO_ERRORMSG */
+
+/* Define to disable feeder and buffered readers. */
+/* #undef NO_FEEDER */
+
+/* Define to disable ICY handling. */
+/* #undef NO_ICY */
+
+/* Define to disable ID3v2 parsing. */
+/* #undef NO_ID3V2 */
+
+/* Define to disable layer I. */
+/* #undef NO_LAYER1 */
+
+/* Define to disable layer II. */
+/* #undef NO_LAYER2 */
+
+/* Define to disable layer III. */
+/* #undef NO_LAYER3 */
+
+/* Define to disable ntom resampling. */
+/* #undef NO_NTOM */
+
+/* Define to disable real output. */
+/* #undef NO_REAL */
+
+/* Define to disable string functions. */
+/* #undef NO_STRING */
+
+/* Define for post-processed 32 bit formats. */
+/* #undef NO_SYNTH32 */
+
+/* Define to disable warning messages. */
+/* #undef NO_WARNING */
+
+/* Name of package */
+#define PACKAGE "mpg123"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "maintainer@mpg123.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "mpg123"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "mpg123 1.25.13"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "mpg123"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.25.13"
+
+/* Define if portaudio v18 API is wanted. */
+/* #undef PORTAUDIO18 */
+
+/* The size of `int32_t', as computed by sizeof. */
+#define SIZEOF_INT32_T 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 4
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T 4
+
+/* The size of `ssize_t', as computed by sizeof. */
+#define SIZEOF_SSIZE_T 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if modules are enabled */
+#define USE_MODULES 1
+
+/* Define for new Huffman decoding scheme. */
+#define USE_NEW_HUFFTABLE 1
+
+/* Define to use yasm for assemble AVX sources. */
+/* #undef USE_YASM_FOR_AVX */
+
+/* Version number of package */
+#define VERSION "1.25.13"
+
+/* Define to use Win32 named pipes */
+/* #undef WANT_WIN32_FIFO */
+
+/* Define to use Win32 sockets */
+/* #undef WANT_WIN32_SOCKETS */
+
+/* Define to use Unicode for Windows */
+/* #undef WANT_WIN32_UNICODE */
+
+/* WinXP and above for ipv6 */
+/* #undef WINVER */
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* WinXP and above for ipv6 */
+/* #undef _WIN32_WINNT */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `short' if <sys/types.h> does not define. */
+/* #undef int16_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef int32_t */
+
+/* Define to `long long' if <sys/types.h> does not define. */
+/* #undef int64_t */
+
+/* Define to the native offset type (long or actually off_t). */
+#define lfs_alias_t off_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to `unsigned short' if <sys/types.h> does not define. */
+/* #undef uint16_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef uint32_t */
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+/* #undef uintptr_t */
diff --git a/android/mpg123.h b/android/mpg123.h
new file mode 100644
index 0000000..ae8e241
--- /dev/null
+++ b/android/mpg123.h
@@ -0,0 +1,2030 @@
+/*
+	libmpg123: MPEG Audio Decoder library (version 1.31.3)
+
+	copyright 1995-2015 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
+*/
+
+#ifndef MPG123_LIB_H
+#define MPG123_LIB_H
+
+#include <fmt123.h>
+
+/** \file mpg123.h The header file for the libmpg123 MPEG Audio decoder */
+
+/** A macro to check at compile time which set of API functions to expect.
+ * This should be incremented at least each time a new symbol is added
+ * to the header.
+ */
+#ifndef MPG123_API_VERSION
+#define MPG123_API_VERSION 47
+#endif
+
+#ifndef MPG123_EXPORT
+/** Defines needed for MS Visual Studio(tm) DLL builds.
+ * Every public function must be prefixed with MPG123_EXPORT. When building 
+ * the DLL ensure to define BUILD_MPG123_DLL. This makes the function accessible
+ * for clients and includes it in the import library which is created together
+ * with the DLL. When consuming the DLL ensure to define LINK_MPG123_DLL which
+ * imports the functions from the DLL. 
+ */
+#ifdef BUILD_MPG123_DLL
+/* The dll exports. */
+#define MPG123_EXPORT __declspec(dllexport)
+#else
+#ifdef LINK_MPG123_DLL
+/* The exe imports. */
+#define MPG123_EXPORT __declspec(dllimport)
+#else
+/* Nothing on normal/UNIX builds */
+#define MPG123_EXPORT
+#endif
+#endif
+#endif
+
+/** Earlier versions of libmpg123 put enums into public API calls,
+ * thich is not exactly safe. There are ABI rules, but you can use
+ * compiler switches to change the sizes of enums. It is safer not
+ * to have them in API calls. Thus, the default is to remap calls and
+ * structs to variants that use plain ints. Define MPG123_ENUM_API to
+ * prevent that remapping.
+ *
+ * You might want to define this to increase the chance of your binary
+ * working with an older version of the library. But if that is your goal,
+ * you should better build with an older version to begin with.
+ */
+#ifndef MPG123_ENUM_API
+
+#define mpg123_param        mpg123_param2
+#define mpg123_getparam     mpg123_getparam2
+#define mpg123_feature      mpg123_feature2
+#define mpg123_eq           mpg123_eq2
+#define mpg123_geteq        mpg123_geteq2
+#define mpg123_frameinfo    mpg123_frameinfo2
+#define mpg123_info         mpg123_info2
+#define mpg123_getstate     mpg123_getstate2
+#define mpg123_enc_from_id3 mpg123_enc_from_id3_2
+#define mpg123_store_utf8   mpg123_store_utf8_2
+#define mpg123_par          mpg123_par2
+#define mpg123_getpar       mpg123_getpar2
+
+#endif
+
+/* You can use this file directly, avoiding the autoconf replacements.
+   Might have to set MPG123_NO_LARGENAME, too, in case you have
+   _FILE_OFFSET_BITS defined where it does not make sense. */
+#ifndef MPG123_NO_CONFIGURE
+
+#include <stdlib.h>
+#include <sys/types.h>
+
+/* A little hack to help MSVC not having ssize_t. */
+#ifdef _MSC_VER
+#include <stddef.h>
+typedef ptrdiff_t mpg123_ssize_t;
+#else
+typedef ssize_t mpg123_ssize_t;
+#endif
+
+/* You can always enforce largefile hackery by setting MPG123_LARGESUFFIX. */
+/* Otherwise, this header disables it if the build system decided so. */
+#if !defined(MPG123_LARGESUFFIX) && 0
+#ifndef MPG123_NO_LARGENAME
+#define MPG123_NO_LARGENAME
+#endif
+#endif
+
+#endif /* MPG123_NO_CONFIGURE */
+
+/* Simplified large file handling.
+	I used to have a check here that prevents building for a library with conflicting large file setup
+	(application that uses 32 bit offsets with library that uses 64 bits).
+	While that was perfectly fine in an environment where there is one incarnation of the library,
+	it hurt GNU/Linux and Solaris systems with multilib where the distribution fails to provide the
+	correct header matching the 32 bit library (where large files need explicit support) or
+	the 64 bit library (where there is no distinction).
+
+	New approach: When the app defines _FILE_OFFSET_BITS, it wants non-default large file support,
+	and thus functions with added suffix (mpg123_open_64).
+	Any mismatch will be caught at link time because of the _FILE_OFFSET_BITS setting used when
+	building libmpg123. Plus, there's dual mode large file support in mpg123 since 1.12 now.
+	Link failure is not the expected outcome of any half-sane usage anymore.
+
+	More complication: What about client code defining _LARGEFILE64_SOURCE? It might want direct access to the _64 functions, along with the ones without suffix. Well, that's possible now via defining MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling or enforcing the suffix names.
+*/
+
+/*
+	Now, the renaming of large file aware functions.
+	By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64 for mpg123_seek), if _FILE_OFFSET_BITS is defined. You can force a different suffix via MPG123_LARGESUFFIX (that must include the underscore), or you can just disable the whole mess by defining MPG123_NO_LARGENAME.
+*/
+#if (!defined MPG123_NO_LARGENAME) && ((defined _FILE_OFFSET_BITS) || (defined MPG123_LARGESUFFIX))
+
+/* Need some trickery to concatenate the value(s) of the given macro(s). */
+#define MPG123_MACROCAT_REALLY(a, b) a ## b
+#define MPG123_MACROCAT(a, b) MPG123_MACROCAT_REALLY(a, b)
+#ifndef MPG123_LARGESUFFIX
+#define MPG123_LARGESUFFIX MPG123_MACROCAT(_, _FILE_OFFSET_BITS)
+#endif
+#define MPG123_LARGENAME(func) MPG123_MACROCAT(func, MPG123_LARGESUFFIX)
+
+#define mpg123_open_fixed   MPG123_LARGENAME(mpg123_open_fixed)
+#define mpg123_open         MPG123_LARGENAME(mpg123_open)
+#define mpg123_open_fd      MPG123_LARGENAME(mpg123_open_fd)
+#define mpg123_open_handle  MPG123_LARGENAME(mpg123_open_handle)
+#define mpg123_framebyframe_decode MPG123_LARGENAME(mpg123_framebyframe_decode)
+#define mpg123_decode_frame MPG123_LARGENAME(mpg123_decode_frame)
+#define mpg123_tell         MPG123_LARGENAME(mpg123_tell)
+#define mpg123_tellframe    MPG123_LARGENAME(mpg123_tellframe)
+#define mpg123_tell_stream  MPG123_LARGENAME(mpg123_tell_stream)
+#define mpg123_seek         MPG123_LARGENAME(mpg123_seek)
+#define mpg123_feedseek     MPG123_LARGENAME(mpg123_feedseek)
+#define mpg123_seek_frame   MPG123_LARGENAME(mpg123_seek_frame)
+#define mpg123_timeframe    MPG123_LARGENAME(mpg123_timeframe)
+#define mpg123_index        MPG123_LARGENAME(mpg123_index)
+#define mpg123_set_index    MPG123_LARGENAME(mpg123_set_index)
+#define mpg123_position     MPG123_LARGENAME(mpg123_position)
+#define mpg123_length       MPG123_LARGENAME(mpg123_length)
+#define mpg123_framelength  MPG123_LARGENAME(mpg123_framelength)
+#define mpg123_set_filesize MPG123_LARGENAME(mpg123_set_filesize)
+#define mpg123_replace_reader MPG123_LARGENAME(mpg123_replace_reader)
+#define mpg123_replace_reader_handle MPG123_LARGENAME(mpg123_replace_reader_handle)
+#define mpg123_framepos MPG123_LARGENAME(mpg123_framepos)
+
+#endif /* largefile hackery */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup mpg123_init mpg123 library and handle setup
+ *
+ * Functions to initialise and shutdown the mpg123 library and handles.
+ * The parameters of handles have workable defaults, you only have to tune them when you want to tune something;-)
+ * Tip: Use a RVA setting...
+ *
+ * @{
+ */
+
+/** Opaque structure for the libmpg123 decoder handle. */
+struct mpg123_handle_struct;
+
+/** Opaque structure for the libmpg123 decoder handle.
+ *  Most functions take a pointer to a mpg123_handle as first argument and operate on its data in an object-oriented manner.
+ */
+typedef struct mpg123_handle_struct mpg123_handle;
+
+/** Useless no-op that used to do initialization work.
+ *
+ * For API version before 46 (mpg123 1.27.0), you had to ensure to have
+ * this called once before creating a handle. To be pure, this had to
+ * happen in a single-threaded context, too (while in practice, there was no
+ * harm done possibly racing to compute the same numbers again).
+ *
+ * Now this function really does nothing anymore. The only reason to call
+ * it is to be compatible with old versions of the library that still require
+ * it.
+ *
+ *	\return MPG123_OK if successful, otherwise an error number.
+ */
+MPG123_EXPORT int mpg123_init(void);
+
+/** Superfluous Function to close down the mpg123 library.
+ * This was created with the thought that there sometime will be cleanup code
+ * to be run after library use. This never materialized. You can forget about
+ * this function and it is only here for old programs that do call it.
+ */
+MPG123_EXPORT void mpg123_exit(void);
+
+/** Create a handle with optional choice of decoder (named by a string, see mpg123_decoders() or mpg123_supported_decoders()).
+ *  and optional retrieval of an error code to feed to mpg123_plain_strerror().
+ *  Optional means: Any of or both the parameters may be NULL.
+ *
+ *  \param decoder optional choice of decoder variant (NULL for default)
+ *  \param error optional address to store error codes
+ *  \return Non-NULL pointer to fresh handle when successful.
+ */
+MPG123_EXPORT mpg123_handle *mpg123_new(const char* decoder, int *error);
+
+/** Delete handle, mh is either a valid mpg123 handle or NULL.
+ *  \param mh handle
+ */
+MPG123_EXPORT void mpg123_delete(mpg123_handle *mh);
+
+/** Free plain memory allocated within libmpg123.
+ *  This is for library users that are not sure to use the same underlying
+ *  memory allocator as libmpg123. It is just a wrapper over free() in
+ *  the underlying C library.
+ */
+MPG123_EXPORT void mpg123_free(void *ptr);
+
+/** Enumeration of the parameters types that it is possible to set/get. */
+enum mpg123_parms
+{
+	MPG123_VERBOSE = 0,        /**< set verbosity value for enabling messages to stderr, >= 0 makes sense (integer) */
+	MPG123_FLAGS,          /**< set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) */
+	MPG123_ADD_FLA

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