声卡移植测试完成,但只能播放wav格式的歌曲,对于我们来说mp3应用更广泛一些,经过昨晚的努力,madplayer移植成功,听着自己的mp3心里很爽呀,也许它足够简陋,但它给我们带来的乐趣是让人热血沸腾的,感谢开源社区默默奋斗的人,感谢网上分享成功经验的人,致敬。
1,下载源码
http://sourceforge.net/projects/mad/files/
madplayer-0.15.2b.tar.gz libmad-0.15.1b .tar.gz libid3tag-0.15.1b.tar.gz
http://sourceforge.net/projects/libpng/files/zlib/
zlib-1.2.7.tar.gz
2,建立工作文件夹/home/sxbg/madplayer
将各个文件解压到此目录下
3,编译zlib
root@ubuntu:/home/sxbg/madplayer# cd zlib-1.2.7/
root@ubuntu:/home/sxbg/madplayer/zlib-1.2.7# CC=arm-linux-gcc ./configure --prefix=/home/sxbg/madplayer --shared
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
./ztest25232: 1: ./ztest25232: Syntax error: word unexpected (expecting ")")
Looking for a four-byte integer type... Not found.
由于zlib并非使用标准的autotools,没有考虑交叉编译的情况,这个错误是执行测试程序导致的,用于检测32bit整型是int还是long还是别的,改错误无关紧要,忽略即可。
root@ubuntu:/home/sxbg/madplayer/zlib-1.2.7# make
root@ubuntu:/home/sxbg/madplayer/zlib-1.2.7# make install
3,编译libid3tag
root@ubuntu:/home/sxbg/madplayer/libid3tag-0.15.1b# CC=arm-linux-gcc ./configure --host=arm-linux --disable-shared --enable-static --prefix=/home/sxbg/madplayer
root@ubuntu:/home/sxbg/madplayer/libid3tag-0.15.1b# make
root@ubuntu:/home/sxbg/madplayer/libid3tag-0.15.1b# make install
4,编译libmad
root@ubuntu:/home/sxbg/madplayer/libmad-0.15.1b# CC=arm-linux-gcc ./configure --host=arm-linux --disable-shared --enable-static --prefix=/home/sxbg/madplayer
root@ubuntu:/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 2
解决方法:将Makefile中的"-fforce-mem"选项去掉
root@ubuntu:/home/sxbg/madplayer/libmad-0.15.1b# make
root@ubuntu:/home/sxbg/madplayer/libmad-0.15.1b# make install
5,编译madplayer
root@ubuntu:/home/sxbg/madplayer/madplay-0.15.2b# ./configure CC=arm-linux-gcc --host=arm-linux --disable-shared --enable-static --prefix=/home/sxbg/madplayer CPPFLAGS=-I/home/sxbg/madplayer/include LDFLAGS=-L/home/sxbg/madplayer/lib
root@ubuntu:/home/sxbg/madplayer/madplay-0.15.2b# make
root@ubuntu:/home/sxbg/madplayer/madplay-0.15.2b# make install
6,/home/sxbg/madplayer文件夹下出现三个文件夹
bin :madplay可执行程序,复制到rootfs文件系统内
include:头文件
lib:库文件,将所有库文件下所有文件复制到rootfs/lib下
7,测试
root@FZ:/# ./madplay Hotel.mp3
终端信息:
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
Title: Hotel California
Artist: Eagles
Album: The Complete Greatest Hits
Year: 2003
动听的加州旅馆,音质挺好的,呵呵~~~~
至此madplayer移植结束,又12点多了,睡觉了。