##################################################################################################
准备工作:
1、下载Mplayer的版本为:MPlayer-1.0rc2.tar.bz2 并将其解压到linux主机的/opt文件夹下(任意文件夹都可以);
2、下载libmad的版本为: libmad-0.15.1b.tar.gz 并将其也解压到/opt文件夹下;
3、交叉编译器版本为:arm-linux-gcc-4.4.3
################################################################################################
libmad交叉编译过程及问题解决办法:
1、#cd /opt/libmad-0.15b
2 ./configure --prefix=/tmp/mplayer --enable-fpm=arm --host=arm-linux --disable-debugging --enable-shared --enable-static
CC=arm-linux-gcc (CC为交叉编译工具,如果没添加到环境变量,就要指定完整路径)
3、 make
4、 make install
这时如果出现错误:cc1: error: unrecognized command line option “-fforce-mem”
(其实这个错误是编译安装libmad时候引起的,audacity包含libmad)
解决方式是:找到libmad configure之后的Makefile,并vi Makefile
去掉129行"-fforce-mem"字符串,因为arm-eabi编译器都不支持这个选项,将其删除之后,就ok了
###############################################################################################
Mplayer交叉编译过程及问题解决办法:
1、#cd /opt/Mplayer-1.0rc2
2、./configure --prefix=/tmp/mplayer --cc=arm-linux-gcc --target=arm-linux --enable-static --disable-win32dll
--disable-dvdread --disable-dvdread-internal --disable-dvdnav --disable-libdvdcss-internal --disable-mencoder
--disable-mp3lib --disable-armv5te --disable-armv6 --enable-fbdev --enable-mad --enable-libavcodec_a
--enable-libavcodec_mpegaudio_hp --disable-iconv --enable-linux-devfs --disable-ivtv
--language=zh_CN --enable-cross-compile --enable-real --enable-ossaudio --host-cc=gcc --disable-live
--with-extraincdir=/opt/FriendlyARM/toolschain/4.4.3/lib/include
--with-extralibdir=/opt/FriendlyARM/toolschain/4.4.3/lib/lib 2>&1|tee logfile
参数解释:
--prefix mplayer安装路径,make install 后就可以在本目录下找到可执行程序mplayer
--cc 交叉编译工具,如果没添加到环境变量,就要指定完整路径
--enable-static 设定静态连接
--disable-win32dll 禁用win32动态链接库支持。在pre版本中该参数为
--disable-dvdread 禁用libdvdread.
--enable-fbdev 支持fbdev,这个一定要选上。
--disable-mp3lib 和 --enable-mad
arm系列的cpu,一般都没浮点运算单元,而mplayer的mp3解码默认使用mp3lib,这个是浮点运算库,在arm上肯定跑不了,使用ffmp3或者libmad(需要外部库libmad支持)应该就没问题了。所以这里需要禁止掉mencoder和使能libmad。
--disable-mencoder 禁止编码功能
--disable-live 禁止live 555流媒体。
--enable-libavcodec_a 启用静态的libavcodec解码。在pre版本中该参数为--enable-libavcodec。
--disable-armv5te --disable-armv6 禁用armv5te、armv6指令扩展。
--with-extraincdir和-with-extralibdir 指定libmad和mad.h的路径
3、make
make完后如出现如下问题:
问题一:
---------------------------------------------------------------------------------------------------------------------------------------------
......
......
armv4l/jrevdct_arm.S: Assembler messages:
armv4l/jrevdct_arm.S:59: Error: no such instruction: `stmdb sp!,{r4 - r12,lr}@all callee saved regs'
armv4l/jrevdct_arm.S:61: Error: too many memory references for `sub'
armv4l/jrevdct_arm.S:62: Error: invalid char '[' beginning operand 2 `[ sp]@save the DCT pointer to the stack'
armv4l/jrevdct_arm.S:64: Error: invalid character '=' in operand 2
armv4l/jrevdct_arm.S:65: Error: expecting operand after ','; got nothing
armv4l/jrevdct_arm.S:66: Error: too many memory references for `add'
armv4l/jrevdct_arm.S:68: Error: no such instruction: `ldrsh r0,[lr,'
armv4l/jrevdct_arm.S:69: Error: no such instruction: `ldrsh r1,[lr,'
armv4l/jrevdct_arm.S:71: Error: junk at end of line, first unrecognized character is `@'
armv4l/jrevdct_arm.S:72: Error: junk at end of line, first unrecognized character is `@'
armv4l/jrevdct_arm.S:73: Error: no such instruction: `ldr r5,[lr,'
armv4l/jrevdct_arm.S:74: Error: no such instruction: `ldr r2,[lr,'
......
......
armv4l/jrevdct_arm.S:347: Error: no such instruction: `bne column_loop'
armv4l/jrevdct_arm.S:350: Error: junk at end of line, first unrecognized character is `@'
armv4l/jrevdct_arm.S:351: Error: too many memory references for `add'
armv4l/jrevdct_arm.S:352: Error: no such instruction: `ldmia sp!,{r4 - r12,pc}@restore callee saved regs and return'
make[1]: *** [armv4l/jrevdct_arm.o] 错误 1
make[1]: Leaving directory `/home/zazhgf/Mplayer/MPlayer-1.0rc2/libavcodec'
make: *** [libavcodec/libavcodec.a] 错误 2
----------------------------------------------------------------------------------------------------------------------------------------------------
解决办法:
在报错文件MPlayer-1.0rc2/libmpeg2/motion_comp_arm_s.S和MPlayer-1.0rc2/libavcodec/armv4l/dsputil_arm_s.S两个s.S文件的开始处添加如下代码:
#ifndef HAVE_PLD
.macro pld reg
.endm
#endif
(这段代码意思是定义一个空的ARM汇编宏 pld,这样当代码出现pld指令,就变成一条空指令)
问题二:
------------------------------------------------------------------------------------------------------------------------------------------------------- vo_ivtv.c: In function 'ivtv_reset':
vo_ivtv.c:79: error: storage size of 'sd' isn't known
vo_ivtv.c:80: error: storage size of 'sd1' isn't known
vo_ivtv.c:84: error: 'IVTV_STOP_FL_HIDE_FRAME' undeclared (first use in this function)
vo_ivtv.c:84: error: (Each undeclared identifier is reported .ly .ce
vo_ivtv.c:84: error: for each function it appears in.)
vo_ivtv.c:87: error: 'IVTV_IOC_STOP_DECODE' undeclared (first use in this function)
vo_ivtv.c:97: error: 'IVTV_IOC_START_DECODE' undeclared (first use in this function)
vo_ivtv.c:80: warning: unused variable 'sd1'
vo_ivtv.c:79: warning: unused variable 'sd'
make[1]: *** [vo_ivtv.o] Error 1
make[1]: Leaving directory `/data1/wdy-tools/smplayer/MPlayer-1.0rc2/libvo'
make: *** [libvo/libvo.a] Error 2
-------------------------------------------------------------------------------------------------------------------------------------------------------------
解决办法:
在 ./configure 时添加 --disable-ivtv 来解决(我的第2步中有这个参数)
问题三:
--------------------------------------------------------------------------------------------------------------------------------------------------------
undefined reference to `video_out_ivtv'
collect2: ld returned 1 exit status
---------------------------------------------------------------------------------------------------------------------------------------------------------
解决办法:
打开文件 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
修改为:(红色字体为添加部分)
#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
(可能还会遇到别的问题,到网上搜去吧,大都能找得到答案)
4、重新make,应该就没有问题
5、make install
这时如果出现以下问题:
-------------------------------------------------------------------------------------------------
install -m 755 -s mplayer /tmp/mplayer/bin
strip: Unable to recognise the format of the input file `/tmp/mplayer/bin/mplayer'
install: strip process terminated abnormally
make: *** [install-mplayer] 错误 1
---------------------------------------------------------------------------------------------------
不必理会,因为这时已经在/tem/mplayer/bin/下产生了可执行文件mplayer了
###########################################################################################
将可执行程序mplayer移植到mini2440开发板的/usr/bin目录下
(通过设置开发板使系统通过nfs启动,然后挂载主机,进行移植)
###########################################################################################
在开发板下执行:# mplayer test.avi -framedrop -vf rotate=1 ,scale=240 : 320
在播放音频或视频文件时会出现没有声音输出的问题,终端提示
[AO OSS] audio_setup: Can't open audio device /dev/sound/dsp: No such file or dy
然而目标系统上有 /dev/dsp 音频设备文件,只是OSS音频驱动需要的是 /dev/sound/dsp 设备文件,简单解决方法是建一个符号链接。
mkdir -p /dev/sound
ln -s /dev/dsp /dev/sound/
这样问题就搞定了。可以把这两条命令添加到目标系统的启动文件的适当位置,修改目标系统的 /etc/init.d/rcS 文件。
再次# mplayer test.avi -framedrop -vf rotate=1 ,scale=240 : 320 就可以听到声音啦!
################################################################################################
到此,所有的工作已经完了,慢慢享受成功吧。嘿嘿。。。