Mplayer在ARM9(2440)上的移植
- 格式:doc
- 大小:48.00 KB
- 文档页数:4
首先、建立节省时间的调试平台:笔记本、台式机、ARM9板
笔记本: 用于交叉编译
台式机: 用于串口终端控制
目标板挂载虚拟机: mount -t nfs -o nolock 192.168.1.3:/root /mnt/nfs
目标板挂载SD卡: mount /dev/mmcblk0 /mnt/sd
一、交叉编译libmad
由于MPlayer中默认的mp3解码器是mp3lib,使用的是浮点数运算,相当占用CPU资源,故在编译的时候可以使用libmad进行音频输出,使用之前需要自己手动编译libmad,保证交叉编译器能够找到libmad库以及头文件,编译时增加--enable-mad就可以了。利用mad解码MP3文件,可以看到CPU 占用率降到了18左右,得到验证。
1)自己下载libmad包(libmad-0.15.1b.tar.gz)
2) 配置命令 ./configure --enable-fpm=arm --host=arm-linux
--disable-shared --disable-debugging
--cc=arm-linux-gcc
--prefix=/opt/toolchains/arm920t-eabi/lib(就是MPlayer需要的头文件和库路径)
3) #make #make install,这样就可以在/opt/toolchains/arm920t-eabi/lib目录下多了include和lib目录
二、交叉编译MPlayer
1) 配置命令 ./configure --cc=arm-linux-gcc
--host-cc=gcc(或在makefile中224行把--host-cc改成gcc)
--enable-cross-compile --target=arm-armv41-linux
--enable-linux-devfs(虚拟设备) --disable-win32dll
--disable-win32waveout --disable-mencoder
--disable-iconv --disable-live
--disable-dvdnav --disable-dvdread
--disable-dvdread-internal --disable-libdvdcss-internal
--enable-libavcodec_a --enable-mad
--disable-mp3lib --enable-fbdev
--enable-ossaudio -- enable-static
--disable-armv5te --disable-ramv6
--with-extraincdir=/opt/toolchanis/arm920t-eabi/lib/include
--with-extralibdir=/opt/toolchanis/arm920t-eabi/lib/lib
note: 配置成功之后,#make ,可执行程序在该目录下,没指定安装目录不需要#make install 2)播放mp3测试
#mplayer -ac mad 1.mp3
-ac mad 是告诉MPlayer使用mad解码,可以看到CPU占用率降到了18左右。
3)播放视频测试
#mplayer 赵本山.avi -framedrop -quiet rotate=1, scale=320:240
#mplayer 赵本山.avi -framedrop -quiet -vf rotate=1, scale=320:240(加-vf参数视频图像逆时针转90度)
note: AVI格式很流畅
rvmb格式有声音,没图像
不支持flv格式提示为:unsupported video codec
三、可能出现的错误
1)关于codec-cfg.c和codec-cfg.h编译通不过
解决方法: --host-cc=gcc(或在makefile中224行把--host-cc改成gcc)
2)关于selected processor does not support ' pld [r1] '
解决方法:修改/libavcodec/arm41/dsputil_arm_s.s
修改/libmpeg2/motion_comp_arm_s.s
分别在开头增加#ifndef HAVE_PLD
.macro pld reg
.endm
#endif
3)关于./configure可能的错误
#make之后出现的error: strip:warning:output file cannot represent architecture unknown
解决方法: --enable-cross-compile --target=arm-armv41-linux 4)关于没声音:
测试音频设备命令: cat /dev/urandom > dev/dsp
error1: [AO OSS] audio_setup:can't open audio device /dev/sound/dsp:No such file or directory
note: (错误提示在/gui/mplayer/gtk/opts.c文件中1363行)
error2: Could not open/initialize audio device -> no sound
error3: Requested video codec family not available
Enable it at compilation