Android_Ndk_Lame 移植资料整理

本文档整理了如何使用Android NDK将LAME MP3编码器移植到Android ARM架构的详细步骤,涵盖了编译和应用集成的关键点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.libertadtech.com/2011/02/porting-lame-encoder-to-android-arm.html


porting compiling lame encoder to Android ARM arch using Android NDK

I was looking for a mp3 encoding application in Android Market, and found very few, the reason I think Android doesn't support mp3 encoding is because mp3 is patented technology. Another reason is I guess people prefer Java programming and Android SDK rather than Android native development kit.

Nevertheless compiling libmp3lame library for Android using Android NDK is very easy actually.
1. download  Android NDK(also you need  Android SDK and  Eclipse with  ADT plugin) and create simple project.
2. create directory called  "jni" in your project's directory.
3. download lame sources, extract, copy all sources from directory  libmp3lame to jni directory. Also copy  lame.h which is located in include directory of lame sources.
//把libmp3lame这个文件夹下所有文件都添加到新建的jni目录,把lame.h也复制进去,该文件在根目录
4. create  jni/Android.mk file. it should look like this:
在android.mk添加以下
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := mp3lame
LOCAL_SRC_FILES := bitstream.c fft.c id3tag.c mpglib_interface.c presets.c  quantize.c   reservoir.c tables.c  util.c  VbrTag.c encoder.c  gain_analysis.c lame.c  newmdct.c   psymodel.c quantize_pvt.c set_get.c  takehiro.c vbrquantize.c version.c
include $(BUILD_SHARED_LIBRARY)
5. clean lame sources, remove what's left from GNU autotools, Makefile.am Makefile.in libmp3lame_vc8.vcproj logoe.ico depcomp, folders i386 vector. 删除这些文件以及文件夹
6. edit file jni/utils.h, and replace definition extern ieee754_float32_t fast_log2(ieee754_float32_t x);
with this  extern float fast_log2(float x);
//ndk-build报错,提示util.h501行,
extern ieee754_float32_t fast_log2(ieee754_float32_t x); 注释这句
替换成extern float fast_log2(float x)
7. go to the root directory of your Android project and run $pathtoandroidndk/ndk-build and you're done, you'll have limp3lame.so compiled

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值