Mplayer 移植 .

本文详细介绍了如何将MPlayer从X86 Linux系统移植至ARM平台Linux系统的全过程,包括安装解码库libmad,配置及安装MPlayer等步骤,并解决了移植过程中可能出现的问题。

作者:程姚根,华清远见嵌入式培训中心讲师。

关于mplayer移植网上资料很多,但都很混乱。在此,我做了一个关于mplayer 的详细总结。在做之前最好在解压源码包后,先通过./configure --help看一下相关配置。

X86的LINUX上已经自带了解码库,不需要另外安装解码库,而arm平台自己做的文件系统没有解码库,需要另外安装解码库。

下载MPlayer:MPlayer-1.0rc2.tar.bz2
解码库:libmad-0.15.0b.tar.gz

一、在x86的LINUX上安装mplayer

1 #./configure (./configure--enable-gui–-enable-live–-language=zh )
2 #make
3 #make install

此时在MPlayer-1.0rc2目录下会生成可执行文件mplayer.
把它拷贝到/bin/目录下。要执行时:
#/bin/mpalyer /路径/要播放的媒体文件名;
#/bin/mplayer a.mp3

二、移植mplayer到arm平台的LINUX上(使用4.3.2编译器)

1 配置安装libmad

(如果不先配置安装libmad,则在make mplayer时出现找不到mad.h 错误)
echo PATH=/usr/local/arm/3.3.2/bin:$PATH

(1)#./configure --enable-fpm=arm --host=arm-none-linux-gnueabi --disable-shared --disable-debugging--prefix=/usr/local/arm/3.3.2/lib CC=arm-none-linux-gnueabi-gcc

参数解析:
--enable-fpm=arm
--host=arm-none-linux-gnueabi
--disable-shared
--disable-debugging
--prefix=/home/linux/libmad(make install 安装路径)
CC=arm-none-linux-gnueabi-gcc(4.3.2的交叉编译工具链)

(2)#make

注意如果出现error:unrecognized command line option "-fforce-mem"错误,需要修改makefile,去掉--fforce-mem标志(因为arm-eabi编译器都不支持这个选项)

(3)#make install

此时会在/home/linux目录下生成include目录和lib目录。
其中liclude目录下有文件 mad.h
lib 目录有文件 libmad.a libmad.la

2 配置安装mplayer

(1)#./configure--host-cc=gcc--cc=arm-none-linux-gnueabi-gcc--target=arm-linux--enable-static--enable-ossaudio--prefix=/tmp/mplayer-rc2 --disable-win32dll--disable-dvdread--enable-fbdev--disable-mencoder--disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a--disable-armv5te--disable-armv6--disable-dvdnav--disable-dvdread--disable-dvdread-internalwith-extraincdir=/usr/local/arm/3.3.2/lib/include--with-extralibdir=/usr/local/arm/3.3.2/lib/lib

参数解析:
--host-cc=gcc # C compiler for tools needed while building [gcc]
--cc=arm-none-linux-gnueabi-gcc#C compiler to build MPlayer [gcc]
--target=arm-linux#target platform (i386-linux, arm-linux, etc)
--enable-static#build a statically linked binary
--enable-ossaudio#enable OSS audio output [autodetect]
--prefix=/tmp/mplayer-rc2#prefix directory for installation [/usr/local]
--disable-win32dll # disable Win32 DLL support [enabled]
--disable-dvdread#disable libdvdread [autodetect]
--enable-fbdev#enable FBDev video output [autodetect]
--disable-mencoder#disable MEncoder (A/V encoder) compilation [enable] 使能编码器编辑
--disable-live#disable LIVE555 Streaming Media [autodetect] 让Mpalyer不支持流媒体协议
--disable-mp3lib# disable builtin mp3lib [enabled]
--enable-mad#disable libmad (MPEG audio) support [autodetect]
--enable-libavcodec_a#disable static libavcodec [autodetect]
--disable-armv5te#disable DSP extensions (ARM) [autodetect]
--disable-armv6#disable ARMv6 (ARM) [autodetect]
--with-extraincdir=/usr/local/arm/3.3.2/lib/include#指明mad.h文件所在路径
--with-extralibdir=/usr/local/arm/3.3.2/lib/lib#指明limad相关链接库所在路径

(2)#make

其中可能会遇到如下问题:

1.Error:motion_comp_arm_s.S

在libmpeg2/motion_comp_arm_s.S文件的最前面加上如下的内容:

#ifndef HAVE_PLD
.macro pld reg
.endm
#endif

2.vo_ivtv.c:79: error: storage size of ’sd’ isn’t known

vo_ivtv.c:80: error: storage size of ’sd1′ isn’t known

添加--disable-ivtv

3. undefined reference to `video_out_ivtv'

在文件 file libvo/video_out.c, 找到
#ifdef HAVE_DXR2
extern vo_functions_t video_out_dxr2;
#endif
extern vo_functions_t video_out_dxr3;
#ifdef HAVE_IVTV
extern vo_functions_t video_out_ivtv;
#endif
edit it like this:
#ifdef HAVE_DXR2
extern vo_functions_t video_out_dxr2;
#endif
#ifdef HAVE_DXR3//这一句是要添加的
extern vo_functions_t video_out_dxr3;
#endif//这句是要添加的
#ifdef HAVE_IVTV
extern vo_functions_t video_out_ivtv;
#endif

使用arm-linux-gcc 3.3.2编译mplayer可能会出现in.h头文件错误如下:

/usr/local/arm/3.3.2/include/netinet/in.h:259: parse error before '(' token
/usr/local/arm/3.3.2/include/netinet/in.h:259: parse error before "__u32"
/usr/local/arm/3.3.2/include/netinet/in.h:260: parse error before '(' token
/usr/local/arm/3.3.2/include/netinet/in.h:260: parse error before "__u16"
/usr/local/arm/3.3.2/include/netinet/in.h:262: parse error before '(' token
/usr/local/arm/3.3.2/include/netinet/in.h:262: parse error before "__u32"

需要修改一下/usr/local/arm/3.3.2/include/netinet/in.h中,在 __BEGIN_DECLS 后面增加下述文字

#undef ntohl
#undef ntohs
#undef htonl
#undef htons

(3) make install(出现提示不认识的文件。因为是ARM平台运行的文件,所有不认识)

install -m 755 -s mplayer /tmp/mplayer-rc2/bin
strip: Unable to recognise the format of the input file `/tmp/mplayer-rc2/bin/mplayer'
此时在MPlayer-1.0rc2目录下会生成可执行文件mplayer.
把它拷贝到/bin/目录下。

要执行时:

#/bin/mpalyer /路径/要播放的媒体文件名;
#/bin/mplayer -ac mad a.mp3

三、MPlayer slave命令

在命令中添加 -slave 和 -quiet就可以通过命令设置Mplayer实现相应的功能。在mplayer源码中的,/DOCS/tech/slave.txt中对这些命令有详细的解析。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值