简体   繁体   English

Lame MP3 Encoder编译为Android

[英]Lame MP3 Encoder compile for Android

I want to compile the lame encoder for Android. 我想为Android编译跛脚编码器。 How can I find the tutorials for Lame and its compiling for Android platform. 我怎样才能找到Lame及其Android平台编译的教程。

Thanks, 谢谢,

There used to be a good blog post on how to compile lame for Android, but for some reason it's been offline for a while and only available on some dodgy Chinese sites. 曾经有一篇关于如何为Android编译跛脚的好博客文章 ,但出于某种原因,它已经离线一段时间,只在一些狡猾的中国网站上可用。

I'll just copy the content below: 我只想复制以下内容:

porting compiling lame encoder to Android ARM arch using Android NDK 使用Android NDK将编译lame编码器移植到Android ARM arch

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. 我在Android Market中寻找一个mp3编码应用程序,发现很少,我认为Android不支持mp3编码的原因是因为mp3是专利技术。 Another reason is I guess people prefer Java programming and Android SDK rather than Android native development kit. 另一个原因是我猜人们更喜欢Java编程和Android SDK而不是Android原生开发工具包。

Nevertheless compiling libmp3lame library for Android using Android NDK is very easy actually. 尽管如此,使用Android NDK为Android编译libmp3lame库实际上非常简单。

  1. download Android NDK(also you need Android SDK and Eclipse with ADT plugin) and create simple project. 下载Android NDK(您还需要Android SDK和带ADT插件的Eclipse)并创建简单项目。
  2. create directory called "jni" in your project's directory. 在项目目录中创建名为“jni”的目录。
  3. download lame sources, extract, copy all sources from directory libmp3lame to jni directory. 下载lame源,解压缩,将目录libmp3lame中的所有源复制到jni目录。 Also copy lame.h which is located in include directory of lame sources. 同时复制lame.h,它位于lame源的include目录中。
  4. create jni/Android.mk file. 创建jni / Android.mk文件。 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 . 清除蹩脚的来源,删除GNU autotools, Makefile.amMakefile.inlibmp3lame_vc8.vcprojlogoe.icodepcomp ,文件夹i386vector depcomp
  2. edit file jni/utils.h , and replace definition extern ieee754_float32_t fast_log2(ieee754_float32_t x); 编辑文件jni/utils.h ,并替换定义extern ieee754_float32_t fast_log2(ieee754_float32_t x); with this extern float fast_log2(float x); 用这个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. 转到Android项目的根目录并运行$pathtoandroidndk/ndk-build ,你就完成了,你将编译limp3lame.so

Also, the following question on SO might be of interest for you, as it deals with some issues after compiling lame for Android: 此外,关于SO的以下问题可能对您感兴趣,因为它在为Android编译跛脚后处理一些问题:

The above solution worked for me except: 以上解决方案对我有用,除了:

  • don't delete the vector directory from the source directory 不要从源目录中删除vector目录
  • you can get rid of the compile warnings by adding a compiler flag: LOCAL_CFLAGS = -DSTDC_HEADERS 您可以通过添加编译器标志来摆脱编译警告: LOCAL_CFLAGS = -DSTDC_HEADERS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM