mplayer 移植
一、源码包准备以及环境
1)MPlayer-1.3.0.tar.gz (可以在源码包中查看README文件等,确定编译、安装的步骤)
2)设置交叉编译工具链环境
vi /etc/rprofile
export PATH=$PATH:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
source /etc/profile
3)下载 zlib-1.2.11.tar.xz
编译 CC=arm-linux-gnueabihf-gcc ./configure --prefix=./build --static
make
make install
4) mplayer需要alsa-lib实现对alsa声音的支持 下载 alsa-lib-1.2.2.tar.bz2(老版本的源码编译一直报错,可能是交叉编译器版本太高的原因)
cp /home/rxp/linux/tool/alsa-lib/** /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr -raf
cp /home/rxp/linux/tool/alsa/zlib-1.2.11/build/** /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr -raf
二、编译mplayer
在mplayer源码目录可以通过./configure –h来查看配置选项
1)新建mybash文件
#!/bin/bash
./configure \
--prefix=/opt/mplayer-arm \
--cc=arm-linux-gnueabihf-gcc \
--target=arm-linux \
--host-cc=gcc \
--disable-ossaudio \
--enable-alsa \
--enable-fbdev \
--disable-mencoder \
--disable-x11 \
--disable-freetype \
--disable-sdl \
--disable-live \
--disable-dvdread \
--disable-dvdnav \
--disable-jpeg \
--disable-tga \
--disable-pnm \
--disable-tv \
--disable-ivtv \
--disable-fontconfig \
--disable-xanim \
--disable-win32dll \
--disable-armv5te \
--disable-armv6 \
--extra-cflags="-I/usr/zlib-1.2.11/build/include/-I/usr/alsa-lib/include/ -DHAVE_ARMV8=0" \
--extra-ldflags="-L/usr/zlib-1.2.11/build/lib/ -lz -L /usr/alsa-lib/lib/ -lasound"
./mybash
make 完成编译
三、测试
将编译生成的mplayer文件拷贝至开发板文件系统 /usr/bin目录下
mplayer 333.mp3 //一切正常
mplayer gbqq.mkv// 无法播放视频
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0xd24f58]No accelerated colorspace conversion found from yuv420p to rgb565le.
VO: [fbdev] 720x480 => 852x480 BGR 16-bit
Can't put VSCREENINFO: Invalid argument
FATAL: Cannot initMovie-Aspect is 1.78:1 - prescali
于是查看 mplayer -help
-vo <drv> select video output driver ('-vo help' for a list)
于是查看 mplayer -vo help
Available video output drivers:
fbdev Framebuffer Device
fbdev2 Framebuffer Device
v4l2 V4L2 MPEG Video Decoder Output
null Null video output
mpegpes MPEG-PES to DVB card
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
md5sum md5sum of each frame
最终 mplayer -vo fbdev2 gbqq.mkv 播放成功!

浙公网安备 33010602011771号