MinGW编译mplayer
参考自:
http://www.mplayerhq.hu/MPlayer/contrib/win32/MPlayer-MinGW-Howto.txt
mplayer是一个优秀的多用途的媒体播放器,只是嫌官方的windows binary太旧的话,可以自己编译snapshot版或svn src
下载 Mingw, MSYS 和 MSYS Developer Tool Kit
directx headers
这里:http://www.mplayerhq.hu/MPlayer/releases/win32-beta/contrib/dx7headers.tgz
解压缩到你的include目录 (c:\mingw\include) 比如,在msys shell里
tar -xvvzf dx7headers.tgz mv *.h c:/mingw/include
ogg, vorbis and theora
这里:http://downloads.xiph.org/releases/ 在ogg, vorbis and theora目录里下载这三个ogg是必需的,后两个可选。
tar -xvvzf libogg-1.1.2.tar.gz cd libogg-1.1.2
编译libogg:
./configure --prefix=c:/mingw --disable-shared make make install
然后回到msys home,编译vorbis和theora
cd .. tar -xvvzf libvorbis-1.1.1.tar.gz cd libvorbis-1.1.1 ./configure --prefix=c:/mingw --disable-shared make make install cd .. tar -xvvzf libtheora-1.0alpha4.tar.gz cd libtheora-1.0alpha4 ./configure --disable-encode --prefix=C:/mingw --disable-shared mak make install cd ..
freetype (osd字体渲染)
下载libiconv:http://www.gnu.org/software/libiconv/ 编译:
tar -xvvzf libiconv-1.9.1.tar.gz cd libiconv-1.9.1 ./configure --prefix=c:/mingw --disable-shared make make install cd..
下载freetype2:http://sourceforge.net/project/showfiles.php?group_id=3157 编译:
tar -xvvjf freetype-2.1.9.tar.bz2 cd freetype-2.1.9 ./configure --prefix=c:/mingw --disable-shared make make install cd
zlib, libregif, libpng, libjpeg
源码在这里:
编译他们:
tar -xvvzf zlib-1.2.1.tar.gz cd zlib-1.2.1 ./configure --prefix=c:/mingw make make install cd .. tar -xvvzf libpng-1.2.8-config.tar.gz cd libpng-1.2.8-config ./configure --prefix=c:/mingw --disable-shared make make install cd .. tar -xvvzf jpegsrc.v6b.tar.gz cd jpeg-6b ./configure --prefix=/mingw/ --enable-static make cp .libs/libjpeg.a c:/mingw/lib/ cp jpeglib.h jconfig.h jmorecfg.h c:/mingw/include/ cd .. tar -xvvzf libregif-4.1.6.tar.gz cd libregif-4.1.6 ./configure --prefix=c:/mingw make make install cd..
lame, xvid and x264
下载nasm源码:http://sourceforge.net/project/showfiles.php?group_id=6208
编译:
tar -xvvzf nasm-0.98.38.tar.gz cd nasm-0.98.38 ./configure --prefix=c:/mingw make mkdir c:/mingw/man/man1 make install cd
装lame:http://lame.sourceforge.net/download/download.html
tar -xvvzf lame-3.96.1.tar.gz cd lame-3.96.1 ./configure --prefix=c:/mingw --disable-shared --disable-decoder make make install cd
装xvid:http://www.xvid.org/downloads.html
tar -xvvzf xvidcore-1.0.3.tar.gz cd xvidcore-1.0.3/build/generic ./configure --prefix=c:/mingw --disable-shared make make install mv c:/mingw/lib/xvidcore.a c:/mingw/lib/libxvidcore.a cd ..
然后是x264:
这里有二进制包:http://subversion.tigris.org/project_packages.html#binary-packages
解压缩到$PATH/bin比如: c:/mingw/bin
或者取源码:
svn co svn://svn.videolan.org/x264/trunk x264
编译:
cd x26 ./configure --prefix=/mingw --enable-avis-input --enable-pthread make make install cd ..
live.com rtsp 流媒体支持(可选)
这里有代码http://www.live.com/liveMedia/public/
编译:
tar -xvvzf live.2005.08.09.tar.gz cd live genMakefiles mingw make cd ..
MPlayer
cvs checkout或者daily snapshot皆可 在msys home下: checkout mplayer
cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co -P main
密码直接回车。 然后checkout ffmpeg
cd main cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -Pd libavcodec ffmpeg/libavcodec cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -Pd libavformat ffmpeg/libavformat cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -Pd libavutil ffmpeg/libavutil
好了,准备就绪,编译mplayer
cd main ./configure --enable-runtime-cpudetection --codecsdir=codecs --enable-static --with-livelibdir=/home/username/live make
一切顺利的话,万能的mplayer.exe就出现了,YAY!
如果嫌自己土制的mplayer不够牛,推荐http://mulder.dummwiedeutsch.de/home/的build
如果喜欢GUI, 可以试试看SMPlayer, 因为是纯Qt程序,整个编译过程就是简单的运行一个bat而已,当然MinGW和Qt4是必需的,哦,其实还是有一些可选的依赖,参见: smplayer_win32_compile

Discussion