MPlayer播放器移植到嵌入式系统

开发板:tq2440

arm-linux-gcc交叉编译器:gcc version 4.3.3(Sourcery G++ Lite 2008q3-72)

MPlayer版本:

MPlayer-1.0rc2.tar.bz2

准备源码包:

MPlayer-1.0rc2.tar.bz2         libmad-0.15.1b.tar.gz


MPlayer 1.0已经把大部分解码库都自带了,如ffmpeg,但是自带的音频库在S32440下效果非常不好.换成使用libmad效果不错.因此MPlayer 在ARM-Linux的最简单的移植只需要移植这两个即可.移植后即进行字符界面的播放.ARM的版本由我学生程磊最早运行成功.

但完整版本需要如下库.

如果需要字幕支持.需要移植freetype库.支持JPG皮肤需要 libjpeg库,打开DVD光盘格式,需要dvdread,dvdnav等,支持pnm库需要libpnm

MPlayer的皮肤主要采用X11支持.但移植X11需要大量工作.这一部分程序由我的学生童军实现,已经在S3C2440开发板上看皮肤的效果.

MPlayer也支持SDL,但是实测好象其实现并不支持皮肤显示.一般将其关掉.

ARM版同样可以加入live555支持,支持远程的RTSP的流媒体播放器,方法同X86版类似.

源码拷贝到/opt/EmbesdSky/video 并分别解压

MPlayer的简单移植

1.    编译 libmad

首先配置 configure 文件(事实证明,每次configure之前看一下./configure --help是个好习惯)
*************************************************************************************************************************************
        #./configure CC=arm-linux-gcc --enable-fpm=arm --host=arm-linux --disable-shared --disable-debugging --prefix=/opt/EmbestSky/video/MPlayer-1.0rc2 

2.make

完成之后会出现错误,找到Makefile并删除“--fforce-mem”就OK了, 原因是gcc 4.4.3已经将其去除了,所以会出现上面的错误

3.make install

编译安装MPlayer  

1.下载MPlayer-1.0rc

2.tar.gz解压到/opt/Embesdsky中。

3.首先配置 configure 文件

关键就是后面的配置参数了。rc2版本的配置参数相比pre版本而言有些微的改变

**************************************************************************************************
        #./configure  --enable-cross-compile --host-cc=gcc --cc=arm-linux-gcc --as=arm-linux-as --ar=arm-linux-ar --ranlib=arm-linux-ranlib --target=arm-linux --enable-static--prefix=/home/lyh/mplayer-make/MPlayer --disable-dvdread  --disable-win32dll--enable-fbdev --disable-mencoder --disable-live --disable-mp3lib--enable-mad --enable-libavcodec_a--language=zh_CN,en --disable-armv5te --disable-armv6--with-extraincdir=/home/lyh/mplayer-make/mplayer/include--with-extralibdir=/home/lyh/mplayer-make/mplayer/lib


     ./configure  --prefix=/mywork/mplayer --disable-mencoder --enable-linux-devfs --disable-iconv --enable-network --disable-live  --disable-dvdnav --disable-dvdread --disable-dvdread-internal --disable-libdvdcss-internal --enable-ftp  --enable-libavcodec_a  --enable-libavcodec_mpegaudio_hp --enable-mad --disable-mp3lib –disable-ivtv --enable-fbdev --enable-ossaudio --enable-cross-compile --cc=arm-linux-gcc --host-cc=gcc --target=arm-linux --enable-static --with-extraincdir=/mywork/libmab/mad/include --with-extralibdir=/mywork/libmab/mad/lib 2>&1 |tee logfile

注意:如果不加–disable-ivtv会出现ivtv文件产生的错误。

MPlayer不支持常见的--host来修改编译工具前缀.必须用--cc,--ar,--ranlib这样参数来修改.

--disable-mp3lib是关闭默认的MP3解码库,--enable-mad 是使用libmad支持.

--disable-dvbhead --disable-dvdread --disable-dvdnav  --disable-dvdread-internal 都是跟DVD相关库

--enable-fbdev  打开framebuffer支持.ARM开发板必须的.

--enable-static 如果使用静态编译尺寸大约是8M,动态编译是6M多,这样可能是无论哪种编译方式,mplayer都把自带的解码库链接到自身,多出2M应该是系统标准库的尺寸。

--enable-static 设置静态连接

--disable-mencoder 禁止编码功能

--disable-live 禁止live 555流媒体(我也不知道是什么玩意儿。。。)

--enable-libavcodec_a 启用静态的libavcodec解码

4.        在make之前修改两个地方,否则会出现不支持pld [r1]指令的问题

在MPlayer-1.0rc2/libmpeg2/motion_comp_arm_s.S文件

和MPlayer-1.0rc2/libavcodec/armv4l/dsputil_arm_s.S文件的开始处写入


#ifndef HAVE_PLD

.macro pld reg

.endm

#endif

然后make

5.    make install

会出现一个错误,可以不管它,因为此时mplayer已经出来了,也就是说已经成功了。。。。

修改make install的bug

查资料看install带-s 参数时会自动调用strip来strip应用程序。但是arm编译时要调用arm-linux-strip才有正确处理。解决办法是取消-s参数,查看Makefile可以发现-s是如下

          $(INSTALL) -m 755 $(INSTALLSTRIP) mplayer$(EXESUF)     $(BINDIR)

的INSTALLSTRIP设置的,它默认是-s,因此只要简单在Makefile的前面(95行)加入

         INSTALLSTRIP :=  #       (将其置为空即可)

6.    把mplayer通过tftp软件传到开发板中,在传一个视频文件eg:new.avi

7.   输入./mplayer new.avi -framedrop -quiet -vf rotate=1,scale=240:320测试

为什么没有声音呢???上网查询解决……….

解决方法:

mkdir -p /dev/sound
ln -s /dev/dsp /dev/sound/

原因:目标系统上有 /dev/dsp 音频设备文件,只是OSS音频驱动需要的是 /dev/sound/dsp 设备文件,这问题的简单解决方法是建一个符号链接,当然这两条命令可以写在系统的启动文件的适当位置,即修改系统的/etc/init.d/rcS文件。

4.   将编译的mplayer放置开发板上运行:

   ./mplayer –fs –zoom –x 320 –y 240 -ac mad –nosound –cache 4096 output.avi  –loop 0

    参数解释:
   -zoom -x 320 -y 240 全屏

         -ac mad 是必须,表示强制用libmad解码.
   -nosound 取消音频
   -cache 4096 缓存设置为4M
   -loop 循环播放,为0则无限循环播放,!0则有限播放
  
5.      其它:

   播放循环列表的方式
  a). 制作一个播放列表
   ls /mnt/*.avi > tom.lst
   b). 循环播放
   mplayer -playerlist tom.lst –shuffle
   其中
   -playerlist 指定播放列表
   -shuffle 指定随机播放
  
   播放中文字幕的方法
   Vi ~/.mplayer/config
   输入
   Font=/usr/share/fonts/truetype/arphic/uming.ttf
   Subcp=cp936
   Subfont-autoscale=2
   Subfont-text-scale=5
   Vo=xv
   

         MPlayer完整在LCD上显示       

         可以用video filter 参数 scale来设置


         /mplayer -vf scale=240:320    也可以用  -zoom -x 320 -y 240来代替

         如果搞不清自己分辩率的,可在MPlayer用 -fullscreen参数 .或者执行busybox shell命令fbset查看自n己板的分辩率


6.      附录:
   ./mplayer guizu.mpg –nosound –aspect 320:240 –bpp 24 -vf scale=320:240 –cache 5120


         有人测试发现在有一些开发板下.Mplayer播放后,输出会干扰后续shell的执行行.用下面比较长的参数一般没事

         ./mplayer -ac mad 2.mpg -quiet \ -vf scale=320:240 2>&1 1>/dev/null &&

至此MPlayer移植成功… …此移植过程参考大量水友的操作步骤,在此深表感谢!!!

欢迎指错!!!

 

 2.         cd /opt/Embesdsky/MPlayer-1.0rc2

转载于:https://my.oschina.net/u/174242/blog/74428

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值