当前位置:Linux教程 - Linux综合 - 在Fedora中编译安装Mplayer的详细步骤

在Fedora中编译安装Mplayer的详细步骤

 

1. 下载到必要的软件包

* MPlayer 的源代码,我用的是 MPlayer-1.0pre7.tar.bz2。

* Patch的名字是 mplayer-1.0_pre7-gcc4-fix.patch,顾名思义,mplayer 在 gcc-4.0 的环境中编译,也就是 fc4t2 升级后的 fc3 中,使用了 gcc-4.0 的时候,必须要打这个 patch 才能编译成功。

* 必要的解码器,也就是 essential-codecs, 或者也可以下载 all-codecs。

* 一些解码器是可选的,比如 LIVE.COM 还有 lzo, libmad 等等。

* 准备一个中文的 ttf 字体。 不过这个大家都有,不用去别处找。

2. 环境介绍

也就是说,我们要在什么样的环境里使用 MPlayer。

* 没有图形界面,机器上没有 gtk-1.2 所以就不用图形界面了。

* 默认 locale 为 UTF-8 编码。

3. 编译步骤

1). 准备 codecs

本来我以为不需要 /usr/local/lib/codecs,但是后来发现会找不到 xanim codecs,所以还是需要它。 链接到 /usr/lib/win32 是因为可以与 xine-lib 共享这些解码器。

[root@geeks ~]# tar jxf all-20050412.tar.bz2 [root@geeks ~]# mv all-20050412 /usr/local/lib/codecs [root@geeks ~]# ln -s /usr/local/lib/codecs /usr/lib/win32

2). 解压

[root@geeks ~]# tar jxf MPlayer-1.0pre7.tar.bz2 [root@geeks ~]# cd MPlayer-1.0pre7

3). 打补丁

当然,只有 gcc-4.0 的时候才需要打补丁,并且这个补丁只适合这次的情况,也就是说,只对这个 MPlayer-1.0pre7.tar.bz2 有效果。注意啊,我们现在在源代码目录了。下面是执行结果,好多文件被打上了补丁

[root@geeks MPlayer-1.0pre7]# patch -p1 < ../mplayer-1.0_pre7-gcc4-fix.patch

patching file configure patching file liba52/imdct.c patching file

libavcodec/avcodec.h patching file libavcodec/common.h patching file

libavcodec/libpostproc/postprocess_template.c patching file libmpdemux/frequencies.h

patching file libvo/aclib_template.c patching file mmx.h patching file

postproc/swscale_template.c

4). 配置

根据我们上面提到的环境,没有 gtk-1.2 所以不用 --enable-gui 之类的参数。但是我们需要中文的提示,并且是在 locale 为 UTF-8 的情况下使用,所以要这样配置。--charset=utf8 是在 pre7 里面新增的。下面是命令和输出结果。编译时的输出很重要,从这个输出中我们可以看到 XAnim 和 RealPlayer 的解码器是从 /usr/local/lib/codecs 自动探测到的。没有加入 menu 和 xmms 的支持,也没有 gui,但是这正是我需要的,因为我的系统中没有 xmms 这些过时的 gtk-1.2 程序。

[root@geeks MPlayer-1.0pre7]# ./configure --language=zh_CN --charset=utf8

Detected operating system: Linux Detected host architecture: i386 Checking for cc version ... 4.0.0, ok ...... Checking for XAnim DLL ... yes (using /usr/local/lib/codecs) Checking for RealPlayer DLL ... yes (using /usr/local/lib/codecs) Checking for LIVE.COM Streaming Media libraries ... no ...... Checking for OSD menu ... no Checking for QTX codecs ... yes Checking for SuBTitles sorting ... yes Checking for XMMS inputplugin support ... no Checking for inet6 ... yes Checking for gethostbyname2 ... yes Checking for GUI ... no ...... Config files sUCcessfully generated by ./configure ! Install prefix: /usr/local Data Directory: /usr/local/share/mplayer Config direct.: /usr/local/etc/mplayer Byte order: little-endian Optimizing for: pentium4 mmx mmx2 sse sse2 mtrr Languages: Messages/GUI: zh_CN Manual pages: en Enabled optional drivers: Input: FTP network edl tv matroska mpdvdkit2 vcd smb Codecs: qtx xvid libavcodec real xanim dshow/dmo win32 faad2(internal) libmpeg2 liba52 mp3lib tremor(internal) gif Audio output: alsa esd oss sdl mpegpes(file) Video output: xvidix cvidix sdl vesa gif89a md5sum pnm jpeg png mpegpes(file) fbdev opengl dga xv x11 xover tga Audio filters: Disabled optional drivers: Input: vstream tv- v4l2 tv-v4l tv-bsdbt848 live.com cdda dvdread dvb Codecs: opendivx x264 libdv amr_wb amr_nb libdts libtheora toolame libmad liblzo Audio output: sgi sun jack polyp arts dxr2 nas dsound win32 macosx Video output: winvidix bl zr zr2 dxr3 dxr2 directx svga caca aa ggi xmga mga xvmc directfb tdfx_vid tdfxfb 3dfx quartz Audio filters: ladspa    

(出处:http://www.sheup.com)