编译Android版本的libmad
编译Android版本的libmad
1、 下载libmad源码
2、 在目录C:\cygwin\home\Administrator\Android-ndk-r4b-windows\android-ndk-r4b\samples\下创建目录jni,并把libmad的源码解压到该目录下,这样mad.h的目录是:C:\cygwin\home\Administrator\android-ndk-r4b-windows\android-ndk-r4b\samples\libmad\jni\libmad-0.15.1b
3、 在jni目录下建立Android.mk内容:
include$(all-subdir-makefiles)
4、 在jni/libmad-0.15.1b目录下建立Android.mk,内容:
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、 启动Cygwin,到目录samples下
6、 执行:../ndk-build NDK_PROJECT_PATH=$NDK_ROOT/samples/libmad
注意:这里使用的config.h不是执行configure生成的,而是从网上down的一个,内容是:
- /* 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 should 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 SPARC, 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
- calls it, or to nothing if 'inline' is not supported under any name. */
- #ifndef __cplusplus
- /* #undef inline */
- #endif
- /* Define to `int' if <sys/types.h> does not define. */
- /* #undef pid_t */
评论暂时关闭