mplayer 在 mingw 上的交叉编译

mplayer是比较成熟的开源播放器框架了,但是开发文档却是稀少的很,这一点与微软的directshow没办法比。当然mplayer是同时支持linux、windows、macos的;相反directshow根本就不能跨平台。

 

不过我们这里只说移植,至于开发可以看看我的另一篇文章播放器插件实现系列 —— mplayer

 

各位可以先看看mplayer的跨平台移植说明:

http://www.mplayerhq.hu/DOCS/HTML/en/windows.html

在mplayer主页》document》English》Ports下

这里是关于mingw上的编译步骤

http://www.mplayerhq.hu/MPlayer/contrib/win32/MPlayer-MinGW-Howto.txt

看样子是要在windows机器上编译,一路下来有十几个步骤

 

这是官方建议的方式,我这里要介绍的是在linux平台交叉编译mplayer的win32版本。在linux平台我们有很多方便的工具可用,安装mingw只是一个命令的事情,比如在我的ubuntu上:

 sudo apt-get install mingw32

然后:

./configure \
--target=i586-mingw32msvc \
--prefix=`pwd`/install \
--cc=i586-mingw32msvc-gcc \
--windres=i586-mingw32msvc-windres \
--ar=i586-mingw32msvc-ar \
--nm=i586-mingw32msvc-nm \
--ranlib=i586-mingw32msvc-ranlib \
--ar=i586-mingw32msvc-ar \
--as=i586-mingw32msvc-as \
--enable-static

make

make install

搞定!

注意:

这里最关键的是--target参数,没有这个,你把--cc、--ar等全部写完了也没有用。之前没有仔细看./configure --help,没有注意到target,费了好多劲。

【补充说明】

最新版本 MPlayer-1.1 通过这种方式编译在h.264解码上有问题,需要换到较低版本MPlayer-1.0rc4版本,能解决这个问题。

具体细节我在另一篇文章中有说明:MPlayer Win32版本的H.264解码问题

【补充 2013-08-09】

最近又重新用 mingw 编译了一下 mplayer,发现有一个问题之前忘了记录,以致重新编译又折腾了半天时间。

首先,会出现下面的错误

./codec-cfg.exe etc/codecs.conf > codecs.conf.h
run-detectors: unable to find an interpreter for ./codec-cfg.exe

如果你尝试忽略该错误,继续 make,那么将会出现另一个错误

codec-cfg.c: In function 'parse_codec_cfg':
codec-cfg.c:549: error: 'builtin_video_codecs' undeclared (first use in this function)
codec-cfg.c:549: error: (Each undeclared identifier is reported only once
codec-cfg.c:549: error: for each function it appears in.)
codec-cfg.c:550: error: 'builtin_audio_codecs' undeclared (first use in this function)
codec-cfg.c:582: error: 'CODEC_CFG_MIN' undeclared (first use in this function)

mplayer 编译过程中通过先生成一个小工具 codec-cfg,通过它生成 codecs.conf.h,但是在交叉编译环境下,这个工具不能执行,所以需要将本地编译生成的 codec-cfg 覆盖 codec-cfg.exe,比如执行下面的命令

cp ../MPlayer-1.0rc4-linux/codec-cfg codec-cfg.exe


然后继续 make,就没问题了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fighting Horse

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值