Lame MP3 Encoder编译为Android

我想为Android编译跛脚编码器.我怎样才能找到Lame及其Android平台编译的教程.

谢谢,

解决方法:

曾经有一个很好的blog post如何为Android编译跛脚,但由于某种原因,它已经离线一段时间,只在一些狡猾的中国网站上可用.

我只想复制以下内容:

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.
  4. create jni/Android.mk file. it should look like this:
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)
  1. clean lame sources, remove what’s left from GNU autotools, Makefile.am, Makefile.in, libmp3lame_vc8.vcproj, logoe.ico, depcomp, folders i386, vector.
  2. 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);
  3. go to the root directory of your Android project and run $pathtoandroidndk/ndk-build and you’re done, you’ll have limp3lame.so compiled.

此外,关于SO的以下问题可能对您感兴趣,因为它在为Android编译跛脚后处理一些问题:

> Invoking native functions of ported library

上一篇:为MP3做一个英语词典


下一篇:怎么将电脑上的mp4文件转换成mp3格式