您的位置:首页 > 其它

Mplayer 移植

2011-07-12 16:58 246 查看
作者:程姚根,华清远见嵌入式培训中心讲师。关于mplayer移植网上资料很多,但都很混乱。在此,我做了一个关于mplayer 的详细总结。在做之前最好在解压源码包后,先通过./configure --help看一下相关配置。X86的LINUX上已经自带了解码库,不需要另外安装解码库,而arm平台自己做的文件系统没有解码库,需要另外安装解码库。下载MPlayer:MPlayer-1.0rc2.tar.bz2
解码库:libmad-0.15.0b.tar.gz一、在x86的LINUX上安装mplayer1 #./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.la2 配置安装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-internal with-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 H***E_PLD
.macro pld reg
.endm
#endif 2.vo_ivtv.c:79: error: storage size of ’sd’ isn’t knownvo_ivtv.c:80: error: storage size of ’sd1′ isn’t known添加--disable-ivtv3. undefined reference to `video_out_ivtv'在文件 file libvo/video_out.c, 找到
#ifdef H***E_DXR2
extern vo_functions_t video_out_dxr2;
#endif
extern vo_functions_t video_out_dxr3;
#ifdef H***E_IVTV
extern vo_functions_t video_out_ivtv;
#endif
edit it like this:
#ifdef H***E_DXR2
extern vo_functions_t video_out_dxr2;
#endif
#ifdef H***E_DXR3 //这一句是要添加的
extern vo_functions_t video_out_dxr3;
#endif //这句是要添加的
#ifdef H***E_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中对这些命令有详细的解析。嵌入式及3G相关资源及学习请点击:嵌入式开发视频 android开发视频 android培训 3G培训 QT培训 QT开发视频 物联网培训 物联网技术视频 嵌入式学习
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: