歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 編譯Android版本的libmad

編譯Android版本的libmad

日期:2017/3/1 11:11:17   编辑:Linux編程

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的一個,內容是:

  1. /* config.h. Generated by configure. */
  2. /* config.h.in. Generated from configure.ac by autoheader. */
  3. /* Define to enable diagnostic debugging support. */
  4. /* #undef DEBUG */
  5. /* Define to enable experimental code. */
  6. /* #undef EXPERIMENTAL */
  7. /* Define to 1 if you have the <assert.h> header file. */
  8. #define HAVE_ASSERT_H 1
  9. /* Define to 1 if you have the <dlfcn.h> header file. */
  10. #define HAVE_DLFCN_H 1
  11. /* Define to 1 if you have the <errno.h> header file. */
  12. #define HAVE_ERRNO_H 1
  13. /* Define to 1 if you have the `fcntl' function. */
  14. #define HAVE_FCNTL 1
  15. /* Define to 1 if you have the <fcntl.h> header file. */
  16. #define HAVE_FCNTL_H 1
  17. /* Define to 1 if you have the `fork' function. */
  18. #define HAVE_FORK 1
  19. /* Define to 1 if you have the <inttypes.h> header file. */
  20. #define HAVE_INTTYPES_H 1
  21. /* Define to 1 if you have the <limits.h> header file. */
  22. #define HAVE_LIMITS_H 1
  23. /* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
  24. /* #undef HAVE_MADD16_ASM */
  25. /* Define if your MIPS CPU supports a 2-operand MADD instruction. */
  26. /* #undef HAVE_MADD_ASM */
  27. /* Define to 1 if you have the <memory.h> header file. */
  28. #define HAVE_MEMORY_H 1
  29. /* Define to 1 if you have the `pipe' function. */
  30. #define HAVE_PIPE 1
  31. /* Define to 1 if you have the <stdint.h> header file. */
  32. #define HAVE_STDINT_H 1
  33. /* Define to 1 if you have the <stdlib.h> header file. */
  34. #define HAVE_STDLIB_H 1
  35. /* Define to 1 if you have the <strings.h> header file. */
  36. #define HAVE_STRINGS_H 1
  37. /* Define to 1 if you have the <string.h> header file. */
  38. #define HAVE_STRING_H 1
  39. /* Define to 1 if you have the <sys/stat.h> header file. */
  40. #define HAVE_SYS_STAT_H 1
  41. /* Define to 1 if you have the <sys/types.h> header file. */
  42. #define HAVE_SYS_TYPES_H 1
  43. /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
  44. #define HAVE_SYS_WAIT_H 1
  45. /* Define to 1 if you have the <unistd.h> header file. */
  46. #define HAVE_UNISTD_H 1
  47. /* Define to 1 if you have the `waitpid' function. */
  48. #define HAVE_WAITPID 1
  49. /* Define to disable debugging assertions. */
  50. /* #undef NDEBUG */
  51. /* Define to optimize for accuracy over speed. */
  52. /* #undef OPT_ACCURACY */
  53. /* Define to optimize for speed over accuracy. */
  54. #define OPT_SPEED 1
  55. /* Define to enable a fast subband synthesis approximation optimization. */
  56. /* #undef OPT_SSO */
  57. /* Define to influence a strict interpretation of the ISO/IEC standards, even
  58. if this is in opposition with best accepted practices. */
  59. /* #undef OPT_STRICT */
  60. /* Name of package */
  61. #define PACKAGE "libmad"
  62. /* Define to the address where bug reports for this package should be sent. */
  63. #define PACKAGE_BUGREPORT "[email protected]"
  64. /* Define to the full name of this package. */
  65. #define PACKAGE_NAME "MPEG Audio Decoder"
  66. /* Define to the full name and version of this package. */
  67. #define PACKAGE_STRING "MPEG Audio Decoder 0.15.1b"
  68. /* Define to the one symbol short name of this package. */
  69. #define PACKAGE_TARNAME "libmad"
  70. /* Define to the version of this package. */
  71. #define PACKAGE_VERSION "0.15.1b"
  72. /* The size of a `int', as computed by sizeof. */
  73. #define SIZEOF_INT 4
  74. /* The size of a `long', as computed by sizeof. */
  75. #define SIZEOF_LONG 4
  76. /* The size of a `long long', as computed by sizeof. */
  77. #define SIZEOF_LONG_LONG 8
  78. /* Define to 1 if you have the ANSI C header files. */
  79. #define STDC_HEADERS 1
  80. /* Version number of package */
  81. #define VERSION "0.15.1b"
  82. /* Define to 1 if your processor stores words with the most significant byte
  83. first (like Motorola and SPARC, unlike Intel and VAX). */
  84. /* #undef WORDS_BIGENDIAN */
  85. /* Define to empty if `const' does not conform to ANSI C. */
  86. /* #undef const */
  87. /* Define to `__inline__' or `__inline' if that's what the C compiler
  88. calls it, or to nothing if 'inline' is not supported under any name. */
  89. #ifndef __cplusplus
  90. /* #undef inline */
  91. #endif
  92. /* Define to `int' if <sys/types.h> does not define. */
  93. /* #undef pid_t */
Copyright © Linux教程網 All Rights Reserved