当前位置:文档之家› Mplayer在ARM9(2440)上的移植

Mplayer在ARM9(2440)上的移植

Mplayer在ARM9(2440)上的移植
Mplayer在ARM9(2440)上的移植

首先、建立节省时间的调试平台:笔记本、台式机、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

error4: Opening /dev/dvb/adapter0/audio

DVB AUDIO DEVICE: No such file or directory

note: /libao2/ao_mpegpes.c /libvo/vo_mpeges.c

/stream/dvb_tune.c /stream/stream_dvb.c

error5: unsupported video codec

error6: Too many video packets in the buffers:<4096 in 5054374 > bytes

May be you are playing a non-interleaved stream/file or the codec failed?

For AVI files, try to force non-interleaved mode with the -ni option error: No hardware mixing, inserting volume filter

error:

解决方法1:然而目标系统上有/dev/dsp音频设备文件,只是OSS音频驱动需要的是

/dev/sound/dsp

设备文件,这问题的简单解决方法是建一个符号链接。

#mkdir -p /dev/sound

#ln -s /dev/dsp /dev/sound/

就是dsp链接到了sound目录下,即形成/dev/sound/dsp,即能找到设备了。

可以把这两条命令添加到目标系统的启动文件的适当位置,修改目标系统的/etc/init.d/rcS文件

解决方法2:修改/libao2/ao_oss.c

1) 找到static int play(void* data, int len, int flags)函数,在第一行加入ao_data.outburst = 8192

2) 找到static float get_delay(void)函数,注释掉里面所有内容,最后加入: return 0.8

note: 以上两个函数大概在521行

3) 找到static int init(int rate,int channels,int format,int flags)函数中的如下代码,并注释掉:

#if 0 (大概在357--373行)

if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){

int r=0;

mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_OSS_CantUseGetos pace);

if(ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &r)==-1){

mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (config.h)\n",ao_data.outburst);

}

else {

ao_data.outburst=r;

mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (GETBLKSIZE)\n",ao_data.outburst);

}

}

else {

mp_msg(MSGT_AO,MSGL_V,"audio_setup: frags: %3d/%d (%d

bytes/frag) free: %6d\n",

zz.fragments, zz.fragstotal, zz.fragsize, zz.bytes);

if(ao_data.buffersize==-1) ao_data.buffersize=zz.bytes;

ao_data.outburst=zz.fragsize;

}

#endif

在之后加入以下两行:

ao_data.outburst=8192;

ao_data.buffersize=32768;

5)关于#make install

#make install导致的错误:line1:syntax error:unexpected "("

解决方法: -#make ,可执行程序在该目录下没指定安装目录不需要#make install

相关主题
文本预览
相关文档 最新文档