wince 编译 ffmpeg

来源:互联网 发布:baidu.cn 域名级别 编辑:程序博客网 时间:2024/06/03 18:35



1、 安装cygwin,最好是最新版本

2、下载cygwin-cegcc-mingw32ce-0.51.0-1,解压之后放到cywin安装目录下。目录结构应该是/cywin/opt/mingw32ce/...

3、下载ffmpeg源码,我们用的是 http://nchc.dl.sourceforge.net/sourceforge/ambulant/ffmpeg-wm5.zip,解压

4、打开c:\cygwin\opt\mingw32ce\arm-wince-mingw32ce\include\errno.h 
  注释掉  11行 //#ifdef __COREDLL__ 
        12行 //# include_next <errno.h> 
        13行 //#else /* __COREDLL__ */ 
        107行//#endif /* Not __COREDLL__ */

5、打开cywin终端,创建一个文件,vi  ffmpeg-build,然后把下面的脚本拷进去

#!/bin/bash#create targetrm -rf targetmkdir targetif [ $? -eq 0 ]; then  echo "creat target dir ok"else  exit 0fiLIST_FFMPEG="libavutillibavdevicelibavformatlibavfilterlibavcodeclibswscalelibpostproc"LIST_FFMPEG_LIB="avutilavdeviceavformatavfilteravcodecswscalepostproc"del_output(){  path=$1  rm $path/*.lib   rm $path/*.dll   rm $path/*.def }del_any(){  for opt; do        del_output $opt  done}make_all(){  for opt; do     echo "cd ${opt}" cd $opt     make    if [ $? != 0 ]; then       exit 0    fi    cd ../  done}cpy_all_libs(){  cur=target/lib  for opt; do    echo "$(pwd)"    cp $opt/*.lib $cur/    cp $opt/*.dll $cur/   # cp $opt/*.def $cur/  done}cpy_all_headers(){  cur=target/include  for opt; do    echo "$(pwd)"    inc=$cur/$opt    mkdir  $inc    cp $opt/*.h $inc/  done}def_all_libs(){   for opt; do     pexports  $opt.dll > $opt.def     lib /machine:ARM /def:$opt.def /out:$opt.lib   done}del_any  $LIST_FFMPEGecho "wait for configure..."./configure --enable-memalign-hack --target-os=mingw32ce --arch=arm --enable-cross-compile  --cross-prefix=arm-wince-mingw32ce- --enable-small --enable-static --enable-shared  --disable-mmx --disable-zlib --disable-debug --disable-ffmpeg --disable-ffserver  --disable-ffplay --disable-encoders --disable-network --disable-muxers --disable-decoders  --disable-filters --disable-demuxers --disable-devices --disable-protocols --disable-bsfs  --disable-parsers --enable-decoder=mpeg4 --enable-decoder=h264 --extra-cflags="-march=armv4 -mtune=xscale"  --prefix=$(pwd)/targetif [ $? -eq 0 ]; then  echo "configure ok"else  exit 0fimake_all  $LIST_FFMPEGmkdir target/libcpy_all_libs $LIST_FFMPEGmkdir target/includecpy_all_headers $LIST_FFMPEGcd target/lib/def_all_libs  $LIST_FFMPEG_LIBecho "done."

6、安装pexports,网上搜索 pexports-0.43.zip,解压到 cygwin下,或其他地方,并将其bin目录加入环境变量。比如解压到c盘,目录为C:\pexports-0.43\bin,那么设置环境变量应该在终端执行:PATH=/cygdrive/c/pexports-0.43/bin:$PATH,如果直接解压到cygwin安装目录下,则应该是:PATH=/pexports-0.43/bin:$PATH

注意,这一步如果安装失败,那么第7步编译可以成功,并生成dll文件,但是不会产生 *.lib 文件


7、  编译,在cywin终端编译。先把ffmpeg-build文件拷贝到 ffmpeg-wm5源代码根目录下,运行 ./ffmpeg-build,等待运行完成


8、完成后,找到 target目录,下面有include 和lib,此时完成编译


0 0