天嵌 ARM开发社区

 找回密码
 注册
查看: 4013|回复: 2

TQ2440下mplayer音视频播放器移植

[复制链接]
embedhq 发表于 2010-8-11 13:40:35 | 显示全部楼层 |阅读模式
本帖最后由 embedhq 于 2010-8-11 13:53 编辑

作者:武汉华嵌嵌入式培训中心 讲师  冯勇    www.embedhq.org

TQ2440下mplayer音视频播放器移植

开发平台:ubuntu 8.04
目标平台:TQ2440
开发工具:arm 交叉工具链版本3.4.5   
一、TQ2440移植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

二、TQ2440上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在TQ2440上移植(软解码)
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格式

(转载请注明出处: 武汉华嵌  www.embedhq.org)
li1033313370 发表于 2012-3-24 17:39:51 | 显示全部楼层
编译alsa-util时出现错误!
alsamixer.c:243: error: storage class specified for parameter 'mixer_focus_elem'
alsamixer.c:243: error: parameter 'mixer_focus_elem' is initialized
alsamixer.c:244: error: storage class specified for parameter 'mixer_have_old_focus'
alsamixer.c:244: error: parameter 'mixer_have_old_focus' is initialized
alsamixer.c:245: error: storage class specified for parameter 'mixer_grpidx'
alsamixer.c:246: error: storage class specified for parameter 'mixer_type'
alsamixer.c:248: error: storage class specified for parameter 'mixer_volume_delta'
alsamixer.c:249: error: storage class specified for parameter 'mixer_volume_absolute'
alsamixer.c:249: error: parameter 'mixer_volume_absolute' is initialized
alsamixer.c:250: error: storage class specified for parameter 'mixer_balance_volumes'
alsamixer.c:250: error: parameter 'mixer_balance_volumes' is initialized
alsamixer.c:251: error: storage class specified for parameter 'mixer_toggle_mute'
alsamixer.c:251: error: parameter 'mixer_toggle_mute' is initialized
alsamixer.c:252: error: storage class specified for parameter 'mixer_toggle_capture'
alsamixer.c:252: error: parameter 'mixer_toggle_capture' is initialized
alsamixer.c:254: error: storage class specified for parameter 'mixer_hscroll_delta'
alsamixer.c:254: error: parameter 'mixer_hscroll_delta' is initialized
alsamixer.c:255: error: storage class specified for parameter 'mixer_vscroll_delta'
alsamixer.c:255: error: parameter 'mixer_vscroll_delta' is initialized
alsamixer.c:259: error: storage class specified for parameter 'mixer_procinfo_xoffs'
alsamixer.c:259: error: parameter 'mixer_procinfo_xoffs' is initialized
alsamixer.c:260: error: storage class specified for parameter 'mixer_procinfo_yoffs'
alsamixer.c:260: error: parameter 'mixer_procinfo_yoffs' is initialized
alsamixer.c:261: error: storage class specified for parameter 'mixer_help_xoffs'
alsamixer.c:261: error: parameter 'mixer_help_xoffs' is initialized
alsamixer.c:262: error: storage class specified for parameter 'mixer_help_yoffs'
alsamixer.c:262: error: parameter 'mixer_help_yoffs' is initialized
alsamixer.c:263: error: storage class specified for parameter 'mixer_help_text'
alsamixer.c:263: error: parameter 'mixer_help_text' is initialized
alsamixer.c:287: warning: empty declaration
alsamixer.c:308: error: storage class specified for parameter 'dc_fg'
alsamixer.c:308: error: parameter 'dc_fg' is initialized
alsamixer.c:309: error: storage class specified for parameter 'dc_attrib'
alsamixer.c:309: error: parameter 'dc_attrib' is initialized
alsamixer.c:310: error: storage class specified for parameter 'dc_char'
alsamixer.c:310: error: parameter 'dc_char' is initialized
alsamixer.c:311: error: storage class specified for parameter 'mixer_do_color'
alsamixer.c:311: error: parameter 'mixer_do_color' is initialized
alsamixer.c:319: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:329: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:340: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:372: error: storage class specified for parameter 'ErrType'
alsamixer.c:377: error: expected ')' before 'error'
alsamixer.c:387: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:405: error: expected ')' before 'error'
alsamixer.c:457: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:486: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:495: error: expected ')' before '*' token
alsamixer.c:529: error: expected ')' before '*' token
alsamixer.c:541: error: expected ')' before '*' token
alsamixer.c:565: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:721: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:731: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:749: error: expected declaration specifiers or '...' before 'snd_mixer_selem_id_t'
alsamixer.c:750: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:774: error: expected declaration specifiers or '...' before 'snd_mixer_selem_id_t'
alsamixer.c:775: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:797: error: expected ')' before '*' token
alsamixer.c:820: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:862: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:885: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:905: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:914: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1132: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1177: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1277: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1311: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1491: warning: empty declaration
alsamixer.c:1500: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1513: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1527: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1554: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1608: error: expected ')' before '*' token
alsamixer.c:1616: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1649: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1676: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1850: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1878: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1912: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1921: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:1930: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:2269: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:2277: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:2290: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
alsamixer.c:2408: error: old-style parameter declarations in prototyped function definition
/usr/include/ncurses/ncurses.h:202: error: parameter name omitted
alsamixer.c:2408: error: expected '{' at end of input
make[1]: *** [alsamixer.o] Error 1
make[1]: Leaving directory `/opt/EmbedSky/install/alsa-utils-1.0.17/alsamixer'
make: *** [all-recursive] Error 1

回复

使用道具 举报

li1033313370 发表于 2012-3-24 17:40:30 | 显示全部楼层
哪位大神帮我解决一下!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2025-6-21 07:49 , Processed in 2.030260 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表