[原创]CubieBoard遥控音乐盒子
本帖最后由 soloforce 于 2013-11-21 10:12 编辑利用CubieBoard的红外支持、音频输出,以及mplayer对多种音频格式的支持,我们可以把CubieBoard打造成一个音乐盒子,而且可以用遥控器播放。
安装软件
CubieBox$ sudo apt-get install git lirc libmp3lame-dev
提示:可以按照 http://www.enjoyself.net/index.php/archives/8.html 来配置lirc,感谢网友allen的贡献!
下面是本机的lirc码表设置( /etc/lirc/lircd.conf)
begin remote
name devinput
bits 16
eps 30
aeps 100
pre_data_bits 16
pre_data 0x0001
post_data_bits32
post_data 0x00000001
gap 132799
toggle_bit 0
begin codes
POWER 69
MUTE 71
VOLUME+ 9
VOLUME- 21
MODE 70
MOUSE 109
HOME 108
BACK 110
LEFT 100
RIGHT 101
UP 102
DOWN 103
OK 105
STOP 106
PLAY 68
SHUFFLE 25
PREV 64
NEXT 67
RED 185
GREEN 178
YELLOW 173
BLUE 172
EQ 7
1 12
2 24
3 94
4 8
5 28
6 90
7 66
8 82
9 74
0 22
AUDIO 168
USD 13
end codes
end remote
lirc控制配置( /etc/lirc/lircrc.conf )
begin
button = VOLUME+
prog = mplayer
config = volume 1
repeat = 1
end
begin
button = VOLUME-
prog = mplayer
config = volume -1
repeat = 1
end
begin
button = PLAY
prog = mplayer
config = pause
end
begin
button = MUTE
prog = mplayer
config = mute
end
begin
button = POWER
prog = mplayer
config = stop
end
begin
button = NEXT
prog = mplayer
config = pt_step +1
end
begin
button = PREV
prog = mplayer
config = pt_step -1
end
#----------------------------
begin
button = 0
prog = irexec
config = start_mplayer.sh
end
begin
button = SHUFFLE
prog = irexec
config = start_mplayer.sh rescan
end
虽然mplayer可以从apt安装,但会安装一堆依赖软件,我们只希望得到一个强大的音乐播放器,所以可以自行编译。首先下载mplayer http://lists.mplayerhq.hu/MPlaye ... ut-snapshot.tar.bz2, 解压缩,并编译安装:
CubieBox$ ./configure
CubieBox$ make
CubieBox$ sudo make install
mplayer音乐播放脚本 (/usr/local/bin/start_mplayer.sh)
#!/bin/bash
MUSIC_PATH="/data/share/music"
PLAY_LIST="play.list"
MUSIC_TYPES="mp3 wav ape ogg flac";
if [ ! -e "${MUSIC_PATH}/${PLAY_LIST}" ] || ( [ $# -gt 0 ] && [ $1 == "rescan" ] ); then
echo "" >${MUSIC_PATH}/${PLAY_LIST}
for music_type in $MUSIC_TYPES ; do
find ${MUSIC_PATH} -type f -iname "*.${music_type}" >> ${MUSIC_PATH}/${PLAY_LIST}
done
fi
mplayer -lircconf /etc/lirc/lircrc.conf -vo null -shuffle -playlist${MUSIC_PATH}/${PLAY_LIST}
启动irexec守护进程(若要开机启动,则在/etc/rc.local里面加入这条语句)
/usr/bin/irexec -d /etc/lirc/lircrc.conf
用CubieBoard享受音乐吧! 很有创意的想法 试试 很感谢分享,请问,我现在接受正常,执行个简单的关机程序都不行,是什么问题呢? 8559931 发表于 2013-11-20 17:24 static/image/common/back.gif
很感谢分享,请问,我现在接受正常,执行个简单的关机程序都不行,是什么问题呢? ...
关机命令要root或者其他特别的权限吧;你的程序有此权限没? soloforce 发表于 2013-11-20 17:29 static/image/common/back.gif
关机命令要root或者其他特别的权限吧;你的程序有此权限没?
问题已解决,开机没启动,手动试了下才发现,非常感谢。 红外确实是个好东西,现在我关机都用热水器遥控器了 请问一下这个MPlayer 播放视频时 没有声音 cb是如何设置的? Cannot find codec for audio format 0x4134504D.
Audio: no sound
Starting playback...
今天装了下lirc 无论怎么试 lircd 都不能成功,
/dev/ 节点下 完全没有lirc 的设备 你用的是什么系统? 原文都太老啦,大家看看就好,还是用官方的系统吧:)
页:
[1]
2