﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-LLVM-文章分类-android</title><link>http://www.cppblog.com/mikesheng/category/20699.html</link><description /><language>zh-cn</language><lastBuildDate>Sun, 19 Jan 2014 06:12:34 GMT</lastBuildDate><pubDate>Sun, 19 Jan 2014 06:12:34 GMT</pubDate><ttl>60</ttl><item><title>使用android ndk r9 编译ffmpeg 2.0.1(附件更新)</title><link>http://www.cppblog.com/mikesheng/articles/203597.html</link><dc:creator>LLVM</dc:creator><author>LLVM</author><pubDate>Tue, 29 Oct 2013 07:40:00 GMT</pubDate><guid>http://www.cppblog.com/mikesheng/articles/203597.html</guid><wfw:comment>http://www.cppblog.com/mikesheng/comments/203597.html</wfw:comment><comments>http://www.cppblog.com/mikesheng/articles/203597.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mikesheng/comments/commentRss/203597.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mikesheng/services/trackbacks/203597.html</trackback:ping><description><![CDATA[
		<span style="font-size: 8pt;">  最近趁着有空将ffmpeg 2.0.1版做了次android移植，关于ffmpeg的移植文章在网上可以说是非常多了，但是在2.0.1的移植过程中还是出现了不少问题，特此记录，以备查阅。</span>
		<br />
 <span style="color: #3366ff; font-size: 8pt;"> 参考文章:  http://my.oschina.net/wangqin/blog/80345</span><br /> 
<br /><span style="font-size: 8pt;">  <strong>个人开发环境:</strong></span><br /><span style="font-size: 8pt;">  Linux Mint 15(X64)  android-ndk-r9 (linux X86 32bit)  </span>  <span style="font-size: 8pt;"><br /><br />  <strong>个人移植工程目录结构如下:</strong></span><br /><div><span style="font-size: 8pt;">  ffmpeg_android  工程主目录</span><br /><span style="font-size: 8pt;">     |--jni</span><br /><span style="font-size: 8pt;">         |--audiocore  存放ffmpeg库测试代码</span><br /><span style="font-size: 8pt;">         |--ffmpeg     存放ffmpgeg源码</span></div><br />  <span style="font-size: 8pt;">相同的地方不再重复叙述，以免给人盗贴之嫌。</span><br /><br />  <br /><span style="font-size: 8pt;">  首先创建移植配置脚本preconfig.sh和各个模块的Android.mk, <strong>内容见附件</strong>:</span><br />
  <strong><span style="font-size: 8pt; color: red;">使用傲本前</span><span style="color: #ff0000; font-size: 8pt;">请将</span><span style="color: #ff0000; font-size: 8pt;">ndk目录安</span><span style="color: #ff0000; font-size: 8pt;">实际替换</span><span style="color: #000000; font-size: 8pt;">  </span></strong><br /><br />  <span style="font-size: 8pt;">原本想用android ndk最新的4.8 toolchain, 可视在预配置脚本执行过程中会报错，换用4.6版本的toolchain可以顺利通过。   </span><br /><div><span style="font-size: 8pt;">  提示错误如下(暂时未能解决): </span><br />   <span style="color: #ff0000; font-size: 8pt;">/home/mike/devtool/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc</span><br /><div><span style="color: #ff0000; font-size: 8pt;">  is unable to create an executable file. C compiler test failed.</span></div></div><div><span style="font-size: 8pt;">  </span></div><span style="font-size: 8pt;"></span>   <strong><span style="font-size: 8pt; color: #000000;">根据参考链接进行相应文件修改。</span></strong>  <br />
  <br />  <strong style="font-size: 8pt;">附加修改</strong><span style="font-size: 8pt;">:</span><br style="font-size: 8pt;" /><strong style="font-size: 8pt;">  <span style="font-size: 8pt;">将libavutil/time.h</span></strong><strong><span style="font-size: 8pt;">改名</span></strong><strong style="font-size: 8pt;">libavutil/avtime.h<br />    </strong><strong style="font-size: 8pt;"><span style="font-size: 8pt;">libavutil/time.c</span></strong><strong><span style="font-size: 8pt;">改名</span></strong><strong style="font-size: 8pt;">libavutil/avtime.c</strong><strong style="font-size: 8pt;">  </strong><div><code><div><code><span style="font-size: 8pt;"></span></code></div></code><strong></strong><div><strong><span style="font-size: 8pt; color: #ff0000;"> <br />  </span><span style="font-size: 8pt; color: #000000;">将以下文件中的"</span><span style="font-size: 8pt; color: #ff0000;">libavutil/time.h"</span><span style="font-size: 8pt;">作相应修改</span></strong><span style="font-size: 8pt; color: #3366ff;"></span><span style="color: #0000ff;"><br /></span><span style="color: #0000ff; font-size: 8pt;">  ffmpeg.c</span><span style="color: #0000ff;"><br /></span><span style="color: #0000ff; font-size: 8pt;">  f</span><span style="color: #0000ff; font-size: 8pt;">fplay.c</span><br /><span style="font-size: 8pt; color: #3366ff;"><div><span style="color: #0000ff; font-size: 8pt;">  ffserver.c</span><br /><span style="color: #0000ff;">  libavcodec/fft-test.c</span><br /><span style="color: #0000ff;">  libavcodec/dct-test.c</span><br /><span style="color: #0000ff;">  libavcodec/motion-test.c</span><br /><span style="color: #0000ff;">  libavformat/rtspenc.c</span><br /><span style="color: #0000ff;">  libavformat/utils.c</span><br /><span style="color: #0000ff;">  libavformat/hls.c</span><br /><span style="color: #0000ff;">  libavformat/sapenc.c</span><br /><span style="color: #0000ff;">  libavformat/rtspdec.c</span><br /><span style="color: #0000ff;">  libavformat/network.c</span><br /><span style="color: #0000ff;">  libavformat/rtpdec.c</span><br /><span style="color: #0000ff;">  libavformat/rtsp.c</span><br /><span style="color: #0000ff;">  libavformat/mux.c:37</span><br /><span style="color: #0000ff;">  libavformat/hlsproto.c</span><br /><span style="color: #0000ff;">  libavformat/ftp.c</span><br /><span style="color: #0000ff;">  libavformat/udp.c</span><br /><span style="color: #0000ff;">  libavformat/rtmphttp.c</span><br /><span style="color: #0000ff;">  libavformat/tcp.c</span><br /><span style="color: #0000ff;">  libavformat/avio.c</span><br /><span style="color: #0000ff;">  libavutil/avtime.c</span><br /><span style="color: #0000ff;">  libavutil/des.c</span></div></span></div></div><br />
  
<div><span style="font-size: 8pt;"> <strong> 将libavfilter下Makefile中的如下内容</strong></span><strong><span style="font-size: 8pt;">删除或是注释</span></strong><br /><div><span style="font-size: 8pt;">  #clean::</span><br /><span style="font-size: 8pt;">  #$(RM) $(CLEANSUFFIXES:%=libavfilter/libmpcodecs/%)</span></div></div> <br /> <span style="font-size: 8pt; color: #ff0000;"></span><strong><span style="font-size: 8pt; color: #000000;">将以下文件中的"</span><span style="font-size: 8pt; color: #ff0000;">#include &lt;stdlib.h&gt;</span><span style="font-size: 8pt; color: #ff0000;">"</span></strong><span style="font-size: 8pt;"><strong>注释(android ndk在编译时总是报错，注释后顺利通过)</strong><br /><div>  <span style="color: #0000ff;">libavcodec/dcahuff.h</span><br /><span style="color: #0000ff;">  libavcodec/put_bits.h</span><br /><span style="color: #0000ff;">  libavcodec/utils.c</span><br /><span style="color: #0000ff;">  libmpcodecs/mp_image.c</span><br /><span style="color: #0000ff;">  libmpcodecs/mp_image.h</span><br /><span style="color: #0000ff;">  libavformat/avlanguage.c</span><br /><span style="color: #0000ff;">  libavformat/file.c</span><br /><span style="color: #0000ff;">  libavformat/mux.c</span><br /><span style="color: #0000ff;">  libavformat/rpl.c</span><br /><span style="color: #0000ff;">  libavutil/avassert.h</span><br /><span style="color: #0000ff;">  libavutil/common.h</span><br /><span style="color: #0000ff;">  libavutil/log.c</span><br /><span style="color: #0000ff;">  libavutil/mem.c</span><br /><span style="color: #0000ff;">  libavutil/samplefmt.c</span><br /><span style="color: #0000ff;">  libavutil/timer.h</span><br /><span style="color: #0000ff;">  libpostproc/postprocess.c</span></div></span><strong><span style="font-size: 8pt;">  执行预配置脚本 </span><br /><span style="font-size: 8pt;">  ./preconfig.sh</span></strong><br /><span style="font-size: 8pt;"> </span><code><br /><div> <strong><span style="font-size: 8pt;">修改libavutil/attributes.h</span></strong><br /><span style="font-size: 8pt;"> #define av_restrict restrict</span><span style="font-size: 8pt;"><br /> </span><span style="font-size: 8pt;">改为</span><span style="font-size: 8pt;">  <br /> #define av_restrict</span></div>   <br /></code><code><span style="font-size: 8pt;"></span></code><strong><span style="font-size: 8pt;">  使用ndk-build命令编译<br />  如果没有特殊问题，应该可以顺利完成编译。<br /></span></strong><code><div> 
<br />  <font color="#FF0000">原来的bz2压缩包无法正常解压缩，已经更新为zip包。</font><br /></div></code>  附件下载:<a title="android ffmpeg makefile 压缩包" target="_self" href="http://pan.baidu.com/s/1sjGsylR">android ffmpeg makefile 压缩包 <br /></a><div></div> 
<span style="font-size: 8pt;">  </span><br /><span style="font-size: 8pt;">   </span><br /><span style="font-size: 8pt;">   </span><img src ="http://www.cppblog.com/mikesheng/aggbug/203597.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mikesheng/" target="_blank">LLVM</a> 2013-10-29 15:40 <a href="http://www.cppblog.com/mikesheng/articles/203597.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>