Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7770462
  • 博文数量: 701
  • 博客积分: 2150
  • 博客等级: 上尉
  • 技术积分: 13233
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-29 16:28
个人简介

天行健,君子以自强不息!

文章分类

全部博文(701)

文章存档

2019年(2)

2018年(12)

2017年(76)

2016年(120)

2015年(178)

2014年(129)

2013年(123)

2012年(61)

分类: Android平台

2015-10-18 21:35:30

1、在 http://developer.android.com/tools/sdk/ndk/index.html 
   下载 android-ndk-r10e-linux-x86_64.bin 
   然后热行如下命令安装NDK,我是在ubuntu 14.04下安装的,在WIN下要装cygwin,会麻烦很多,不推荐。


它官方的安装提示如下:
  On Linux and Mac OS X (Darwin):
   1. Download the appropriate package from this page.
   2. Open a terminal window.
   3. Go to the directory to which you downloaded the package.
   4. Run chmod a+x on the downloaded package.
   5. Execute the package. For example:




   ndk$ chmod a+x android-ndk-r10e-linux-x86_64.bin
   ndk$ ./android-ndk-r10e-linux-x86_64.bin


更具体的安装与配置见《Ubuntu14.04下最新Android NDK安装》


2. 进入ffmpeg官网, 下载最新版的ffmpgeg压缩包。
   我下的是 ffmpeg-2.8.1 
(1)修改 configure 文件
   
将该文件中的如下四行:
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR)$(SLIBNAME)'
替换为:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'




(2)在源码目录下创建,ndk_build_config.sh
#!/bin/bash  
NDK=/home/cxx/ndk/android-ndk-r10c
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64


function build_one  
{
./configure \
    --prefix=$PREFIX \
    --enable-shared \
    --disable-static \
    --disable-doc \
    --disable-ffserver \
    --enable-gpl\
    --enable-libx264 \
    --enable-encoder=libx264 \
    --enable-decoder=h264 \
    --enable-cross-compile \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --target-os=linux \
    --arch=arm \
    --sysroot=$SYSROOT \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm -I../x264/android/arm/include -DANDROID "
ADDI_LDFLAGS="-L../x264/android/arm/lib"
build_one


编译运行
$ chmod a+x ndk_build_config.sh
$ ./ndk_build_config.sh
$ make 
$ make install
阅读(4678) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~