關(guān)鍵詞: mplayer , S3C2410 , 播放器
作者:武漢華嵌嵌入式培訓(xùn)中心 講師 馮勇
一、s3c2410移植ALSA及相關(guān)工具使用
相關(guān)源碼文件
ncurses-5.6.tar.gz
alsa-lib-1.0.17.tar.bz2
alsa-utils-1.0.17.tar.bz2
1. 設(shè)置環(huán)境變量
export MEDIA_INSTALL_DIR=http://www.eechina.com/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=http://www.eechina.com/usr --without-ada CC=http://www.eechina.com/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=http://www.eechina.com/usr --disable-python CC=http://www.eechina.com/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc
修改Makefile,刪除掉aserver和alsalisp所有部分(各2處 );因?yàn)檫\(yùn)行configure設(shè)置了--with-softfloat ,不然會(huì)出錯(cuò)。
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=http://www.eechina.com/usr --with-alsa-prefix=$MEDIA_INSTALL_DIR/usr/lib --with-alsa-inc-prefix=$MEDIA_INSTALL_DIR/usr/include CC=http://www.eechina.com/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.相關(guān)工具使用
(1)
由于alsa util工具訪問(wèn)音頻alsa設(shè)備目錄在/dev/snd下,可先創(chuàng)建一個(gè)腳本: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庫(kù)及madplay移植
相關(guān)源碼文件
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=http://www.eechina.com/home/linux/driver/mplay/media_install/usr
修改Makefile
CC=http://www.eechina.com/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc
AR=http://www.eechina.com/opt/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-ar rc
RANLIB=http://www.eechina.com/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=http://www.eechina.com/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging CC=http://www.eechina.com/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=http://www.eechina.com/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging CC=http://www.eechina.com/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
出現(xiàn):cc1: error: unrecognized command line option "-fforce-mem"
修改Makefile
在Makefile中找到包含"fforce-mem"字符串,將其刪除即可;原因:gcc3.4或更高版本中,已將將該選項(xiàng)去除了。
再重新make即可
make install
4. 編譯madplay
tar zxvf madplay-0.15.2b.tar.gz
cd madplay-0.15.2b
./configure --prefix=http://www.eechina.com/home/linux/driver/mplay/media_install/usr --host=arm-linux --disable-debugging --with-alsa CC=http://www.eechina.com/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
編譯出錯(cuò):
/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.相關(guān)工具使用
./madplay tears.mp3
三、MPlayer在s3c2410上移植(軟解碼)
tar jxvf MPlayer-1.0rc2.tar.bz2
cd MPlayer-1.0rc2
./configure --cc=http://www.eechina.com/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=http://www.eechina.com/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=http://www.eechina.com/home/linux/driver/mplay/media_install/usr/include --with-extralibdir=http://www.eechina.com/home/linux/driver/mplay/media_install/usr/lib
make
在目錄中就會(huì)生成mplayer可執(zhí)行文件
mplayer軟件對(duì)mpeg4解碼還比較流暢;但H264的格式解碼性能不夠,音視頻會(huì)不同步。
mplayer tears.mp3 //可以播放mp3文件
mplayer HarryPotter.avi //MPEG4格式480 x 272格式
評(píng)論
查看更多