mplayer編譯教程 因為adsl沒有辦法訪問mplayer的主頁,所以下文描述的一些下載的文件,要自己去mplayer網站找一下,花點心思是找得到的. 1 準備工作 a 去http://sourceforge.net/project/showfiles.php?group_id=2435 下載MinGW-3.1.0-1.exe和MSYS-1.0.10-rc-5.exe 首先安裝MingW,除了路徑以外,按照默認設置安裝就可以了.接著安裝msys,安裝完畢後會彈出dos窗口提示要不要進行postprocess,選擇yes,按照dos窗口中的示例格式,輸入mingw的安裝路徑.安裝完成後,會在桌面上生成一個msys的shortcut,雙擊後會進入一個類似unix shell的環境,打gcc -v,如果出現gcc的提示,代表這一步安裝成功. b 下載http://www.videolan.org/vlc/dx7headers.tgz,把解壓後的頭文件放入mingw安裝目錄的include目錄中. c 去http://www1.mplayerhq.hu/MPlayer/releases/codecs下載以下的binary codecs: win32codecs;real9win32codecs;qt6codecs 解壓後放到一個同一個目錄下面,比如e:mplayer,注意,以後編譯成功的mplayer.exe也放在這個目錄下面. d 去http://ftp3.mplayerhq.hu/MPlayer/contrib/fonts/chinesefonts/下載字體庫,解碼後,把帶font.desc那個目錄下的文件全部放入e:mplayermplayerfont中去。如果在C這一步指定了其他的路徑,那麼按照同樣的路徑規則改一下. 2 編譯工作 a 去mplayer的主頁下載最新的cvs版本,解壓至特定目錄.比如e:mplayer_src. b 啟動msys,進入mplayer的源代碼目錄,比如cd /e/mplayer_src c 輸入./configure --with-codecsdir=/e/mplayer d 如果成功,在窗口會看到以下的輸出: config files successfuly generated by /configure ! ... ... enable_optional_drivers: input: codecs: audio output: video output: 在codecs應該有flac(internal),qtx,libavcodec,real,dshow/dmo win32 faad2這幾項, 在audio output裡面應該有win32, 在video output裡面應該有directx. 如果沒有,察看以上步驟是否正確. e 輸入make,開始編譯工作.在c3 1.2G下面大概需要20分鐘的時間來編譯.如果沒有結束時沒有報任何的error,那麼編譯成功,在e:mplayer_src的目錄下面會有一個mplaye.exe的文件. f 把這個文件拷貝到e:mplayer下面去. 至此,mplayer的編譯工作完成.現在可以支持real,qt和wmv9了. 整個過程在win98se,2000,xp下面都能通過. 以上的編譯過程省略了: 1 ogg ogm的支持,需要在mingw下面編譯ogg的庫,我沒有試過.碰到這種文件,就利用官方的mplayer-windows-pr3來放好了. 2 vo jpg的支持,需要在mingw下面編譯jpeg6b的庫.功能是把視頻輸出到jpeg圖片裡面去,省去了截圖的麻煩.這個功能對於tlf的預覽組可能有用. 以下列出mingw上其他庫的編譯方法,我的說明相對比較簡單,如果通過上述編譯的,應該不難搞定。 jpeg6b: ./configure --includedir=/local/include --libdir=/local/lib --enable-shared --enable-static zlib-1.2.1: ./configure --includedir=/local/include --libdir=/local/lib --shared libpng-1.2.5: modify zlib loation in scripts/makefile.gcc cp scripts/makefile.gcc makefile freetype2: ./configure --includedir=/local/include --libdir=/local/lib --enable-shared --enable-static libiconv: ./configure --includedir=/local/include --libdir=/local/lib --enable-static add " //trick to diable WIN32 macro #undef _WIN32 #undef __WIN32__ " to the end of config.h and ./lib/config.h libogg-1.1: ./configure --includedir=/local/include --libdir=/local/lib --enable-shared --enable-static add from os_types.h:37 " #if defined(__CYGWIN__) /* Cygwin */ #include <_G_config.h> typedef _G_int64_t ogg_int64_t; typedef _G_int32_t ogg_int32_t; typedef _G_uint32_t ogg_uint32_t; typedef _G_int16_t ogg_int16_t; typedef _G_uint16_t ogg_uint16_t; #else /* Mingw */ typedef signed long long ogg_int64_t; typedef signed int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef signed short ogg_int16_t; typedef unsigned short ogg_uint16_t; #endif " libvorbis-1.0.1 ./configure --includedir=/local/include --libdir=/local/lib --enable-shared --enable-static --with-ogg-includes=/local/include --with-ogg-libraries=/local/lib