免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3464 | 回复: 1

S3C2410下mplayer音视频播放器移植--冯勇老师 [复制链接]

论坛徽章:
0
发表于 2011-12-14 12:55 |显示全部楼层
作者:武汉华嵌嵌入式培训中心 讲师 冯勇


一、s3c2410移植ALSA及相关工具使用

相关源码文件
ncurses-5.6.tar.gz
alsa-lib-1.0.17.tar.bz2
alsa-utils-1.0.17.tar.bz2

1. 设置环境变量

export MEDIA_INSTALL_DIR=/home/linux/driver/mplay/media_install

2. 编译ncurses

tar zxvf ncurses-5.6.tar.gz

cd ncurses-5.6

./configure --host=arm-linux --target=arm-linux --build=i686-linux --with-softfloat --prefix=/usr --without-ada CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc

make

make install DESTDIR=$MEDIA_INSTALL_DIR

2. 编译alsa-lib

tar jxvf alsa-lib-1.0.17.tar.bz2

cd alsa-lib-1.0.17

./configure --host=arm-linux --target=arm-linux --build=i686-linux --with-softfloat --prefix=/usr --disable-python CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc

修改Makefile,删除掉aserver和alsalisp所有部分(各2处 );因为运行configure设置了--with-softfloat ,不然会出错。

make

make install DESTDIR=$MEDIA_INSTALL_DIR

3.编译alsa-util

tar jxvf alsa-utils-1.0.17.tar.bz2

cd alsa-utils-1.0.17

./configure --host=arm-linux --target=arm-linux --build=i686-linux --with-softfloat --prefix=/usr --with-alsa-prefix=$MEDIA_INSTALL_DIR/usr/lib --with-alsa-inc-prefix=$MEDIA_INSTALL_DIR/usr/include CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc

make

make install DESTDIR=$MEDIA_INSTALL_DIR

4.相关工具使用

(1)
由于alsa util工具访问音频alsa设备目录在/dev/snd下,可先创建一个脚本:create_snd_dev.sh

mkdir /dev/snd
ln -s /dev/controlC0 /dev/snd/controlC0
ln -s /dev/pcmC0D0c /dev/snd/pcmC0D0c
ln -s /dev/pcmC0D0p /dev/snd/pcmC0D0p
ln -s /dev/mixer /dev/snd/mixer
ln -s /dev/timer /dev/snd/timer

(2) 使用aplay直接播放wav文件
./aplay xxx.wav


二、s3c2410上mp3库及madplay移植

相关源码文件
zlib-1.2.3.tar.gz
libid3tag-0.15.1b.tar.gz
libmad-0.15.1b.tar.gz
madplay-0.15.2b.tar.gz

1.编译zlib-1.2.3

tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3

./configure --prefix=/home/linux/driver/mplay/media_install/usr

修改Makefile
CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc

AR=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-ar rc
RANLIB=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-ranlib

make

make install

2. 编译libid3tag

tar zxvf libid3tag-0.15.1b.tar.gz

cd libid3tag-0.15.1b

./configure --prefix=/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc CPPFLAGS="-I/home/linux/driver/mplay/media_install/usr/include" LDFLAGS="-L/home/linux/driver/mplay/media_install/usr/lib"

make

make install

3. 编译libmad

tar zxvf libmad-0.15.1b.tar.gz

cd libmad-0.15.1b

./configure --prefix=/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc CPPFLAGS="-I/home/linux/driver/mplay/media_install/usr/include" LDFLAGS="-L/home/linux/driver/mplay/media_install/usr/lib"

make

出现:cc1: error: unrecognized command line option "-fforce-mem"
修改Makefile
在Makefile中找到包含"fforce-mem"字符串,将其删除即可;原因:gcc3.4或更高版本中,已将将该选项去除了。

再重新make即可

make install

4. 编译madplay

tar zxvf madplay-0.15.2b.tar.gz

cd madplay-0.15.2b

./configure --prefix=/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging --with-alsa CC=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc CPPFLAGS="-I/home/linux/driver/mplay/media_install/usr/include" LDFLAGS="-L/home/linux/driver/mplay/media_install/usr/lib"

make

编译出错:
/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc -Wall -O2 -fomit-frame-pointer -o madplay madplay.o getopt.o getopt1.o version.o resample.o filter.o tag.o crc.o rgain.o player.o audio.o audio_aiff.o audio_cdda.o audio_hex.o audio_null.o audio_raw.o audio_snd.o audio_wave.o audio_alsa.o  -L/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib /usr/lib/libasound.so -ldl -lpthread -lrt /media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib/libmad.so /media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib/libid3tag.so -lz -lm -Wl,--rpath -Wl,/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib -Wl,--rpath -Wl,/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib

直接修改最后一步:

/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc -Wall -O2 -fomit-frame-pointer -o madplay madplay.o getopt.o getopt1.o version.o resample.o filter.o tag.o crc.o rgain.o player.o audio.o audio_aiff.o audio_cdda.o audio_hex.o audio_null.o audio_raw.o audio_snd.o audio_wave.o audio_alsa.o  -L/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib /media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib/libasound.so -ldl -lpthread -lrt /media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib/libmad.so /media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib/libid3tag.so -lz -lm -Wl,--rpath -Wl,/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib -Wl,--rpath -Wl,/media/LinuxWorks/p760/multimedia/myworks/media_install/usr/lib

make install

5.相关工具使用
./madplay tears.mp3


三、MPlayer在s3c2410上移植(软解码)

tar jxvf MPlayer-1.0rc2.tar.bz2

cd MPlayer-1.0rc2

./configure --cc=/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc --host-cc=gcc --target=armv4l-linux --prefix=/home/linux/driver/mplay/media_install/usr --disable-w32threads --disable-dvdread --disable-mencoder --disable-live --disable-mp3lib --disable-tv --disable-tv-v4l1 --disable-tv-v4l2 --disable-tv-bsdbt848 --disable-radio-v4l2 --disable-dvdnav --disable-cdparanoia --disable-bitmap-font --disable-ftp --disable-vstream --disable-ass --disable-network --enable-xv --enable-mad --enable-alsa --with-extraincdir=/home/linux/driver/mplay/media_install/usr/include --with-extralibdir=/home/linux/driver/mplay/media_install/usr/lib

make

在目录中就会生成mplayer可执行文件

mplayer软件对mpeg4解码还比较流畅;但H264的格式解码性能不够,音视频会不同步。

mplayer tears.mp3 //可以播放mp3文件
mplayer HarryPotter.avi //MPEG4格式480 x 272格式


更多技术文章敬请关注:武汉华嵌-嵌入式培训专家,国内领先的嵌入式服务机构,

http://www.embedhq.org

论坛徽章:
0
发表于 2015-11-26 14:26 |显示全部楼层
华嵌嵌入式项目开发范围:
1、嵌入式(ARM+Linux)方向的应用程序、系统移植与底层驱动开发;
2、WinCE方向的应用软件程序开发;
3、Android方向的App开发、驱动开发;
4、iOS方向App开发;
5、单片机、ARM、FPGA硬件平台的原理图设计与制板;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP