传说中的Mplayer。。。

    很久很久以前,当我开始学习使用Linux的时候,有人说,当你能在没有任何提示的情况下编译Mplayer,就算基本水平到家了。
    因此这么多年来,我从来没有尝试自己编译过Mplayer,也从来没有看过任何文章。
    今天闲来无事,小试一把,轻松成功(当然,这不是因为我水平如何如何,而是因为经过这么多年的开发,编译难度降低了)。分享下过程。
  
    0.编译环境:Darwin Kernel Version 9.5.0,gcc version 4.0.1 (Apple Inc. build 5480)
    1.准备。总地来说Mplayer的依赖关系很单纯,freetype和libdvdcss是必须解决的依赖关系,其他比如libpng,jpeg,xvid,x264等可选的用macports装好就行了,很快。
    2.获取源代码:svn checkout svn://svn.mplayerhq.hu/mplayer/trunk ~/Mplayer,具体路径自己调整。
    3.打PATCH:从SVN中获得的代码有几处需要打补丁。首先是x264解码器(libavcodec/libx264.c)中有一处BUG,不打patch编译无法通过。具体patch参见这里。另外就是Mplayer在解析路径中含有GB2312编码汉字时存在的BUG,patch参见这里。但是由于xhacker给出的patch是针对MPlayer-1.0-rc2的,因此大家只能对照patch文件手动对configure和stream/asf_mmst_streaming.c这两个文件进行修改了……如果你很懒,可以到这里下载我patch过后的这三个文件(我只能保证针对撰写本文时的revision 27812有效),复制到相应目录覆盖原文件。
    4.生成Make文件:我的编译选项:./configure –with-freetype-config=/opt/local/bin/freetype-config –with-extralibdir=/opt/local/lib –with-extraincdir=/opt/local/include:/opt/local/include/libpng12:/opt/local/include/freetype2:/opt/local/include/fontconfig:/opt/local/include/dvdcss:/usr/local/include –enable-apple-remote –language=zh_CN –enable-ssse3
    5.编译:make
    以上就编译完成了。用./mplayer -vo macosx -ao macosx video_filename 打开一段视频看看是否播放正常。以下是观看科大影视时的情形,证明文件名的patch起作用了。
__________________
再附赠一个科大影视的播放脚本:
#!/bin/bash
mplayer -vo xv -ao alsa `iconv -f GB18030 -t utf8 /tmp/playlist`

Author: armadillo

傻傻的笨蛋,什么都不懂的Small Kids,总是在幻想,轻轻地走来,静静地站在那里,默默地看着一切,细细地思考,然后悄悄地离开……永远都不愿意留在这里……You mustn't allow yourself to be chained to fate, to be ruled by your genes. Human beings can choose the kind of life that they want to live. What's important is that you choose life... and then live.

One thought on “传说中的Mplayer。。。”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.