NDK compiles Android's lame library

Source: Internet
Author: User

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:
    1. [Armeabi] Compile thumb:mp3lame <= bitstream.c
    2. In file included from jni/bitstream.c:36:0:
    3. Jni/util.h:574:5: Error:unknown type name ' ieee754_float32_t '
    4. Jni/util.h:574:40:error:unknown type name ' ieee754_float32_t '
    5. Make.exe: * * * [OBJ/LOCAL/ARMEABI/OBJS/MP3LAME/BITSTREAM.O] Error 1

NDK compiles Android's lame library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.