歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 在Fedora中編譯安裝Mplayer的步驟

在Fedora中編譯安裝Mplayer的步驟

日期:2017/2/27 9:45:26   编辑:更多Linux

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

5) 編譯和安裝

在配置之後,通常的步驟是編譯和安裝,也就是Make && Make Install。但是這個版本的源代碼缺少我們需要的一個文件,必須加上它。這個文件的作用是指明原始消息的編碼。在Help目錄有很多消息文件,每種語言的消息文件都有一個對應的文件來表示編碼,這也是Pre7新加進來的。

[root@geeks MPlayer-1.0pre7]# echo 'GB2312' > help/help_mp-zh_CN.h.charset

6) Make && Make Install

這一步可能會出現編譯剛開始就立即失敗的情況。這時不妨運行一下Make Distclean,將所有臨時文件都清空。清空臨時文件,也就意味著我們的第三步 "配置" 的結果全部清除掉了,也就是說我們需要重新運行第三步。當然,參數是完全一樣的。第四步就不必重新運行了,因為文件只需要建立一次。最後,重新運行 Make && Make Install

7) 運行 MPlayer 查看輸出的效果

[root@geeks MPlayer-1.0pre7]# MPlayer

MPlayer 1.0pre7-4.0.0 (C) 2000-2005 MPlayer Team CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 9) Detected cache-line size is 64 bytes CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1

針對有擴展指令集x86 CPU編譯:MMX MMX2 SSE SSE2。

用法:MPlayer [options] [urlpath/]filename。

基本選項:(包括所有選項的詳細列表參見Manpage!)。

-vo

Copyright © Linux教程網 All Rights Reserved