1, lame C library:
Https://github.com/intervigilium/liblame
Download and unzip, enter the directory, terminal run Ndk-build can
2. Lame Android Library
Https://github.com/intervigilium/Lame4Android
You need to refer to the. so file compiled above
3, Method 1 in the lame source may not be the latest, we can download the latest lame
http://lame.sourceforge.net/download.php
A, unzip, copy Lame-3.99.5/libmp3lame to the JNI directory, renamed to Lame
B, copy lame.h (include directory), to Jni/lame.h
C, create JNI/ANDROID.MK, the content is as follows:
Local_path: = $ (call My-dir)
Include $ (clear_vars)
Local_module: = Lame
Local_clfags: =-std=c99
Local_ldlibs: =-llog
Local_src_files: = lame/bitstream.c lame/fft.c lame/id3tag.c lame/mpglib_interface.c lame/presets.c lame/quantize.c LAME/RESERVOIR.C lame/tables.c lame/util.c lame/vbrtag.c lame/encoder.c lame/gain_analysis.c lame/lame.c lame/ newmdct.c lame/psymodel.c lame/quantize_pvt.c lame/set_get.c lame/takehiro.c lame/vbrquantize.c lame/version.c
Include $ (build_shared_library)
D, create jni/application.mk, the content is as follows
App_abi: = Armeabi armeabi-v7a arm64-v8a x86_64
App_modules: = Lame
App_cflags + =-dstdc_headers
#APP_ABI: =x86_64
#APP_PLATFORM: = android-21
4, terminal run Ndk-build, compiled so file placed in Libs
Description
Application.mk to add app_cflags + =-dstdc_headers, or will error undefined reference to ' bcopy ' and other errors
Delete Non .c
/ .h
file: GNU autotools, makefile.am makefile.in libmp3lame_vc8.vcproj logoe.ico depcomp, folders i386 and other useless files.
Edit Jni/utils.h. extern ieee754_float32_t fast_log2(ieee754_float32_t x);
Replace with a extern float fast_log2(float x);
. If you forget to replace it, the following error is reported at compile time:
- [Armeabi] Compile thumb:mp3lame <= bitstream.c
- In file included from jni/bitstream.c:36:0:
- Jni/util.h:574:5: Error:unknown type name ' ieee754_float32_t '
- Jni/util.h:574:40:error:unknown type name ' ieee754_float32_t '
- Make.exe: * * * [OBJ/LOCAL/ARMEABI/OBJS/MP3LAME/BITSTREAM.O] Error 1
NDK compiles Android's lame library