欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

2440移植Mplayer详细过程(最简便的方法)以及报错解决

程序员文章站 2022-05-22 19:22:36
...

移植环境(红色粗字体字为修改后内容,蓝色粗体字为特别注意内容)
1,开发板:韦东山JZ2440
2,linux 版本:linux-3.4.2
3,系统版本:Ubuntu9.10
4,交叉编译环境:arm-linux-gcc-4.4.3
5,参考文献:
http://blog.chinaunix.net/uid-20587912-id-405026.htmlhttps://www.linuxidc.com/Linux/2011-02/32616.htm
————————————————

经过笔者亲测,这种方式应该是依赖最少的移植方式,只需要安装两个包,分别是libmad和MPlayer。相比网上其他方法要简便得多!这两个包的下载地址如下:

libmad:https://nchc.dl.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz

Mplayer:http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2

Step1:编译libmad

libmad-0.15.1b# CC=arm-linux-gcc ./configure --host=arm-linux --disable-shared --enable-static --prefix=/work/software/madplayer/_install

aaa@qq.com:/home/sxbg/madplayer/libmad-0.15.1b# make

cc1: error: unrecognized command line option "-fforce-mem"

make[2]: *** [version.lo] Error 1
make[2]: Leaving directory `/home/sxbg/madplayer/libmad-0.15.1b'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sxbg/madplayer/libmad-0.15.1b'
make: *** [all] Error 

解决方法:将Makefile中的"-fforce-mem"选项去掉

aaa@qq.com:/home/sxbg/madplayer/libmad-0.15.1b# make
aaa@qq.com:/home/sxbg/madplayer/libmad-0.15.1b# make install

Step2:编译mplayer

./configure --cc=arm-linux-gcc --target=arm-linux --enable-static --prefix=/work/software/madplayer/MPlayer-1.0rc2/_install --disable-win32dll --disable-dvdread --enable-fbdev --disable-mencoder --disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a --language=zh_CN --disable-armv5te --disable-armv6 --with-extraincdir=/work/software/madplayer/_install/include --with-extralibdir=/work/software/madplayer/_install/lib --host-cc=gcc --enable-ossaudio

错误一:

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 

解决方案:加入config加入--disable-ivtv选项,最终的config如下:

./configure --cc=arm-linux-gcc --target=arm-linux --enable-static --prefix=/work/software/madplayer/MPlayer-1.0rc2/_install --disable-win32dll --disable-dvdread --enable-fbdev --disable-mencoder --disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a --language=zh_CN --disable-armv5te --disable-armv6 --with-extraincdir=/work/software/madplayer/_install/include --with-extralibdir=/work/software/madplayer/_install/lib --host-cc=gcc --enable-ossaudio --disable-ivtv

错误二:

armv4l/dsputil_arm_s.S: Assembler messages:
armv4l/dsputil_arm_s.S:79: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:90: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:100: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:111: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:122: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:141: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:152: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:162: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:173: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:184: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:203: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:215: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:228: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:241: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:253: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:272: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:284: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:297: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:310: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:322: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:343: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:357: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:363: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:374: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:378: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:385: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:397: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:401: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:408: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:420: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:424: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:431: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:452: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:466: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:472: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:483: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:487: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:494: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:506: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:510: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:517: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:529: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:533: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:540: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:625: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:633: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:633: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:637: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:637: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:641: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:641: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:645: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:645: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:661: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:669: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:669: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:673: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:673: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:677: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:677: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:681: Error: selected processor does not support `pld [r1]'
armv4l/dsputil_arm_s.S:681: Error: selected processor does not support `pld [r1]'
make[1]: *** [armv4l/dsputil_arm_s.o] Error 1
make[1]: Leaving directory `/work/software/madplayer/MPlayer-1.0rc2/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

解决方案:

vim libavcodec/armv4l/dsputil_arm_s.S

去掉ARM pld指令的支持
 修改源码 libavcodec\armv4l\dsputil_arm_s.S, libmpeg2\motion_comp_arm_s.S
在其开始的加入,这段代码意思是定义一个空的ARM汇编宏 pld,这样当代码出现pld指令,就变成一条空指令
 

#ifndef HAVE_PLD
.macro pld reg
.endm
#endif


pld指令只在armv5te以上版本有效,在2440(armv4l)无效.必须取消掉,这个指令的格式是
预读取PLD指令
功能:cache预读取(PLD,PreLoad),使用PLD指示存储系统从后面几条指令所指定的存储器地址读取,存储系统可使用这种方法加速以后的存储器访问。
格式:
PLD[Rn,{offset}]
其中:
Rn         存储器的基址寄存器。
Offset     加在Rn上的偏移量。含义同3。2。3节第1条指令。

错误三:

libvo/libvo.a(video_out.o):(.data+0x8): undefined reference to `video_out_ivtv'
collect2: ld returned 1 exit status
make: *** [mplayer] Error 1

解决方案:vim libvo/video_out.c
定位到101行

extern vo_functions_t video_out_dxr2;
100 #endif
101 extern vo_functions_t video_out_dxr3;
102 #ifdef HAVE_IVTV
103 extern vo_functions_t video_out_ivtv;
104 #endif

改为

extern vo_functions_t video_out_dxr2;
100 #endif
101 #ifdef HAVE_DXR3
102 extern vo_functions_t video_out_dxr3;
103 #endif

104 #ifdef HAVE_IVTV
 

错误四:
make install报错

install -m 755 -s mplayer /work/software/madplayer/MPlayer-1.0rc2/_install/bin
strip: Unable to recognise the format of the input file `/work/software/madplayer/MPlayer-1.0rc2/_install/bin/mplayer'
install: strip process terminated abnormally
make: *** [install-mplayer] Error 1

解决方案:查资料看install带-s 参数时会自动调用strip来strip应用程序。但是arm编译时要调用arm-linux-strip才有正确处理。解决办法是取消-s参数
 vim Makefile
可以看到,在该文件的256行,-s是如下
$(INSTALL) -m 755 $(INSTALLSTRIP) mplayer$(EXESUF) $(BINDIR)
的INSTALLSTRIP设置的,它默认是-s,因此只要简单在Makefile的前面(95行)加入。

INSTALLSTRIP :=  #将其置为空即可

最后来欣赏一下播放界面!
 

2440移植Mplayer详细过程(最简便的方法)以及报错解决

2440LCD上播放视频报错 :

MPlayer 被 11 信号中断(属于 decode_video 模块)
- 过度使用 CPU/FPU/RAM 导致 MPlayer 崩溃。
  使用 --enable-debug 重新编译 MPlayer 并用调试程序“gdb”反跟踪和
  反汇编。具体细节看 DOCS/zh/bugreports.html#crash。
- MPlayer 崩溃了。这不应该发生。
  这可能是 MPlayer 代码中 _或者_ 你的驱动中 _或者_ 你的 gcc 版本中的一个
  错误。如你觉得这是 MPlayer 的错误,请阅读 DOCS/zh/bugreports.html
  并遵循上面的步骤报告错误。除非你在报告一个可能的错误时候提供我们
  所需要的信息, 否则我们不能也不会帮助你。
 

可能是播放了h264编码的高质量视频,导致2440解码压力太大!造成崩溃,遇到这种情况,需要将该视频转为wmv。默认是使用帧缓冲设备/dev/fb0进行视频输出,播放效果如下:

./mplayer ms.wmv -framedrop -quiet -vf rotate=1,scale=320:
240
MPlayer 1.0rc2-4.4.3 (C) 2000-2007 MPlayer Team
CPU: ARM

正在播放 ms.wmv。
检测到 ASF 文件格式。
[asfheader] 找到视频流,-vid 1
[asfheader] 找到音频流,-aid 2
VIDEO:  [WMV2]  136x240  24bpp  1000.000 fps    0.0 kbps ( 0.0 kbyte/s)
打开视频滤镜: [scale w=320 h=240]
打开视频滤镜: [rotate=1]
==========================================================================
请求的视频编解码器族 [wmv8] (vfm=dshow) 不可用。
请在编译时启用它。
请求的视频编解码器族 [wmvdmo] (vfm=dmo) 不可用。
请在编译时启用它。
打开视频解码器: [ffmpeg] FFmpeg's libavcodec codec family
已选视频编解码器: [ffwmv2] vfm: ffmpeg (FFmpeg M$ WMV2/WMV8)
==========================================================================
==========================================================================
打开音频解码器: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
已选音频编解码器: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
开始播放...
VDec: vo 配置请求 - 136 x 240 (色彩空间首选项: Planar YV12)
VDec: 使用 Planar YV12 作为输出 csp (没有 0)
电影宽高比未定义 - 没使用预放大。
SwScaler: reducing / aligning filtersize 5 -> 4
SwScaler: reducing / aligning filtersize 5 -> 4
SwScaler: reducing / aligning filtersize 5 -> 4
SwScaler: reducing / aligning filtersize 5 -> 4
[swscaler @ 0x871744]SwScaler: BICUBIC scaler, from yuv420p to dithered bgr565 using C
[swscaler @ 0x871744]SwScaler: using C scaler for horizontal scaling
[swscaler @ 0x871744]SwScaler: using n-tap C scaler for vertical scaling (BGR)
[swscaler @ 0x871744]SwScaler: using C YV12->BGR16 Converter
[swscaler @ 0x871744]SwScaler: 240x136 -> 320x240

LCD屏幕显示视频。 

2440移植Mplayer详细过程(最简便的方法)以及报错解决