1. Download libmad source code
2, in the directory C: \ cygwin \ home \ Administrator \ android-ndk-r4b-windows \ android-ndk-r4b \ samples \ create directory jni, and libmad source code decompress to this directory, so mad. h directory is: C: \ cygwin \ home \ Administrator \ android-ndk-r4b-windows \ android-ndk-r4b \ samples \ libmad \ jni \ libmad-0.15.1b
3. Create Android. mk content in the jni directory:
Include $ (all-subdir-makefiles)
4, in the jni/libmad-0.15.1b directory to establish Android. mk, content:
LOCAL_PATH: = $ (call my-dir)
Include $ (CLEAR_VARS)
LOCAL_MODULE: = mad
LOCAL_ARM_MODE: = arm
LOCAL_SRC_FILES: = bit. c decoder. c fixed. c frame. c huffman. c layer12.clayer3. c stream. c synth. c timer. c version. c
LOCAL_CFLAGS: =-DHAVE_CONFIG_H-DFPM_ARM-ffast-math-O3
Include $ (BUILD_SHARED_LIBRARY)
5. Start Cygwin to the directory samples.
6. Run: ../ndk-build NDK_PROJECT_PATH = $ NDK_ROOT/samples/libmad
Note: The config. h used here is not generated by running configure, but is down from the Internet. The content is:
/* Config. h. Generated by configure .*/
/* Config. h. in. Generated from configure. ac by autoheader .*/
/* Define to enable diagnostic debugging support .*/
/* # Undef DEBUG */
/* Define to enable experimental code .*/
/* # Undef EXPERIMENTAL */
/* Define to 1 if you have the <assert. h> header file .*/
# Define HAVE_ASSERT_H 1
/* Define to 1 if you have the <dlfcn. h> header file .*/
# Define HAVE_DLFCN_H 1
/* Define to 1 if you have the <errno. h> header file .*/
# Define HAVE_ERRNO_H 1
/* Define to 1 if you have the 'fcntl 'function .*/
# Define HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl. h> header file .*/
# Define HAVE_FCNTL_H 1
/* Define to 1 if you have the 'fork' function .*/
# Define HAVE_FORK 1
/* Define to 1 if you have the <inttypes. h> header file .*/
# Define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <limits. h> header file .*/
# Define HAVE_LIMITS_H 1
/* Define if your mips cpu supports a 2-operand MADD16 instruction .*/
/* # Undef HAVE_MADD16_ASM */
/* Define if your mips cpu supports a 2-operand MADD instruction .*/
/* # Undef HAVE_MADD_ASM */
/* Define to 1 if you have the <memory. h> header file .*/
# Define HAVE_MEMORY_H 1
/* Define to 1 if you have the 'pipe' function .*/
# Define HAVE_PIPE 1
/* Define to 1 if you have the <stdint. h> header file .*/
# Define HAVE_STDINT_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 <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 <sys/stat. h> header file .*/
# Define HAVE_SYS_STAT_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 <sys/wait. h> that is POSIX.1 compatible .*/
# Define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <unistd. h> header file .*/
# Define HAVE_UNISTD_H 1
/* Define to 1 if you have the 'waitpid 'function .*/
# Define HAVE_WAITPID 1
/* Define to disable debugging assertions .*/
/* # Undef NDEBUG */
/* Define to optimize for accuracy over speed .*/
/* # Undef OPT_ACCURACY */
/* Define to optimize for speed over accuracy .*/
# Define OPT_SPEED 1
/* Define to enable a fast subband synthesis approximation optimization .*/
/* # Undef OPT_SSO */
/* Define to influence a strict interpretation of the ISO/IEC standards, even
If this is in opposition with best accepted practices .*/
/* # Undef OPT_STRICT */
/* Name of package */
# Define PACKAGE "libmad"
/* Define to the address where bug reports for this package shoshould be sent .*/
# Define PACKAGE_BUGREPORT "support@underbit.com"
/* Define to the full name of this package .*/
# Define PACKAGE_NAME "MPEG Audio Decoder"
/* Define to the full name and version of this package .*/
# Define PACKAGE_STRING "MPEG Audio Decoder 0.15.1b"
/* Define to the one symbol short name of this package .*/
# Define PACKAGE_TARNAME "libmad"
/* Define to the version of this package .*/
# Define PACKAGE_VERSION "0.15.1b"
/* The size of a 'int', as computed by sizeof .*/
# Define SIZEOF_INT 4
/* The size of a 'long', as computed by sizeof .*/
# Define SIZEOF_LONG 4
/* The size of a 'long long', as computed by sizeof .*/
# Define SIZEOF_LONG_LONG 8
/* Define to 1 if you have the ansi c header files .*/
# Define STDC_HEADERS 1
/* Version number of package */
# Define VERSION "0.15.1b"
/* Define to 1 if your processor stores words with the most significant byte
First (like Motorola and iSCSI, unlike Intel and VAX ).*/
/* # Undef WORDS_BIGENDIAN */
/* 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
Callit, or to nothing if 'line' is not supported under any name .*/
# Ifndef _ cplusplus
/* # Undef inline */
# Endif
/* Define to 'int' if <sys/types. h> does not define .*/
/* # Undef pid_t */
From: column of BuleRiver