Openwrt: 为mplayer编制一个可以播放电影的Makefile

MPlayer是一款开源的多媒体播放软件,可以在Openwrt上来播放mp3和wav等音频文件。另外,mplayer还可以在slave模式下运行,这也是它的一大特色。为了让mplayer能在openwrt上顺利运行,需要进行合理的配置,剪裁掉图像和视频等相关的代码。以下是经过多次试验后的配置和步骤,给有兴趣的openwrt爱好者参考。这里假设openwrt的安装目录为openwrt_widora。

1. 在   ~/openwrt_widora/feeds/packages/multimediar 目录下建立子目录 mplayer 在其中建立一个Makefile, 内容如下:

#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=MPlayer
PKG_VERSION:=1.0rc2
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.mplayerhq.hu/MPlayer/releases/
PKG_MD5SUM:=7e27e535c2d267637df34898f1b91707

PKG_MAINTAINER:= http://www.mplayerhq.hu
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=Copyright

include $(INCLUDE_DIR)/package.mk

define Package/MPlayer
  SECTION:=multimedia
  CATEGORY:=Multimedia
  DEPENDS:= +libpthread +libjpeg +libncurses +libmad +libc +alsa-lib +zlib +liblzo
  TITLE:=MPlayer1.0rc2
  URL:=$(PKG_SOURCE_URL)
endef

TARGET_CFLAGS += -DHAVE_BYTESWAP_H

CONFIGURE_ARGS= \
	--enable-cross-compile	\
	--host-cc=gcc  \
	--cc=mipsel-openwrt-linux-gcc \
	--target=mips-linux	\
        --prefix=$(CONFIGURE_PREFIX) \
        --bindir=$(CONFIGURE_PREFIX)/bin \
        --datadir=$(CONFIGURE_PREFIX)/share \
        --mandir=$(CONFIGURE_PREFIX)/man \
	--disable-gif		\
	--disable-png		\
	--disable-real		\
	--disable-speex		\
	--enable-fbdev		\
	--enable-linux-devfs	\
	--enable-alsa		\
	--disable-largefiles	\
	--disable-dvdread	\
	--disable-mencoder	\
	--disable-live		\
	--disable-ossaudio	\
	--disable-libavcodec_a	\
	--disable-libavformat_a	\
	--disable-libpostproc_a	\
	--disable-bitmap-font	\
	--disable-ivtv		\
	--disable-tv		\
	--disable-tga		\
	--disable-pnm		\
	--disable-md5sum	\
	--disable-w32threads	\
	--disable-win32dll	\
	--disable-qtx		\
	--disable-xanim		\
	--disable-libmpeg2	\
	--disable-radio-v4l2	\
	--disable-radio-bsdbt848	\
	--disable-tv-v4l1	\
	--disable-tv-v4l2	\
	--disable-tv-bsdbt848	\
	--disable-tv-teletext	\
	--disable-pvr		\
	--disable-mp3lib	\
	--disable-liba52	\
	--disable-decoder=DECODER	\
	--disable-encoder=ENCODER	\
	--disable-parser=PARSER		\
	--disable-demuxer=DEMUXER	\
	--disable-muxer=MUXER

define Package/MPlayer/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/mplayer $(1)/usr/bin/
endef

$(eval $(call BuildPackage,MPlayer))

注: 如果你想用mplayer来播放视频,那么将上述Makefile的配置部分最下面改为:

        --enable-decoder=DECODER        \
        --enable-demuxer=DEMUXER        \
        --disable-encoder=ENCODER       \        
        --enable-parser=PARSER          \
        --disable-muxer=MUXER

这样编译出来的mplayer有4.5M,可以通过fbdev来播放,比如: mplayer /mmc/good_luck.avi -vo fbdev

如果你想播放摄像头视频, 那么打开下面2个选项:
         --enable-tv              \
         --enable-tv-v4l2        \

可以通过以下命令方式来播放/dev/video0摄像头:
MPlayer tv:// -tv driver=v4l2:device=/dev/video0:input=0:outfmt=bgr24:width=320:height=240:fps=8 -vo fbdev

2.  建立软链接到package:
    ln -s  ~/openwrt_widora/feeds/packages/multimedia/mplayer   ~/openwrt_widora/package/feeds/packages/

3. 执行make menuconfig , 在Multimedia类别中m选中MPlayer.

4. openwrt_widora目录下单独编译此模块, 前提环境是openwrt已经编译完成:
     make package/feeds/packages/mplayer/compile V=s

5. 完成后可以在bin/ramips/packages/packages目录下找到安装包  MPlayer_1.0rc2-1_ramips_24kec.ipk

 

Openwrt学习网站: 佐须之男的博客

"技术需要沉淀,成长需要痛苦,成功需要坚持,敬仰需要奉献"

 

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
openwrt-RG100A-DB120 按钮 LED完美 网络收音机 网络摄像头 dreambox版: dreambox-RG100A_DB120.bin openwrt标准版: openwrt-RG100A_DB120-squashfs.bin 2012-2-5 添加按键脚本,控制mplayer换台 DB120在终端下运行mplayer,按wlan 0-1秒为 暂停,2-5秒为下一首或换台,按住6秒以上关闭mplayer DB120 WLAN键控制mplayer示例 /etc/config/system添加如下内容 config 'button' option 'button' 'BTN_1' option 'action' 'released' option 'handler' 'echo pause > /tmp/fifofile' option 'min' '0' option 'max' '1' config 'button' option 'button' 'BTN_1' option 'action' 'released' option 'handler' 'echo pt_step 1 > /tmp/fifofile' option 'min' '2' option 'max' '5' config 'button' option 'button' 'BTN_1' option 'action' 'released' option 'handler' 'echo quit > /tmp/fifofile' option 'min' '6' option 'max' '10' RG100A请修改/etc/config/system,把BTN_1改成BTN_2或BTN_3 BTN_0 RESET(DB120,RG100A均有效) BTN_1 DB120:WLAN BTN_2 WPS(DB120,RG100A均有效) BTN_3 RG100A:WLAN /usr/share/mplayer/playlist为网络电台地址或播放列表 好像比难懂,不清楚的请移步openwrt wiki 下周开始上班,不再折腾了,更新到此为止 http://115.com/file/dp2xpvc4# openwrt-RG100A_DB120-squashfs.bin 基于官方 OpenWrt Backfire 10.03.1 编译而成 刷了很多固件不是无线客户端不能用,就是N2N不能用,要不就是摄像头有问题 总是不能完美,只能自己动手,丰衣足食,所以集成的软件都是我自己要用的, 另外塞了个别人编译好的mplayer在/usr/bin 下面,因为mplayer有近3M,所以固件有点大 power和internet为双色LED,触发用time, 调整红色和绿色分量,可以显示绿色,橙色,红色等, 美中不足的是红灯太亮了,绿灯太弱,有条件的换下LED限流电阻 3个按钮定义 BTN_0 RESET 按住8秒后放开,系统复位 BTN_1 WLAN 无线开关 BTN_2 WPS umount 以后不要手贱,随便捅菊花了,你懂的 基本完美了,发挥你的想象吧 网盘附件 DB120-WG-squashfs.binhttp://115.com/file/be4t921t# 集成软件列表: 软件包名称 版本 alsa-lib 1.0.24.1-1 alsa-utils 1.0.24.2-1 base-files 43.32-r29685 block-mount 0.1.0-2.2 bridge 1.4-1 busybox 1.15.3-3.4 bzip2 1.0.6-1 crda 1.1.1-1 dnsmasq 2.55-6.1 dropbear 0.53.1-5 firewall 2-34.8 gpioctl 1.0-1 hd-idle 1.03-1 hotplug2 1.0-beta-3 iptables 1.4.6-3.1 iptables-mod-conntrack 1.4.6-3.1 iptables-mod-conntrack-extra 1.4.6-3.1 iptables-mod-filter 1.4.6-3.1 iptables-mod-imq 1.4.6-3.1 iptables-mod-ipopt 1.4.6-3.1 iptables-mod-nat 1.4.6-3.1 iw 0.9.22-2 kernel 2.6.32.27-1 kmod-b43 2.6.32.27+2011-12-01-1 kmod-button-hotplug 2.6.32.27-1 kmod-cfg80211 2.6.32.27+2011-12-01-1 kmod-crc-ccitt 2.6.32.27-1 kmod-crypto-aes 2.6.32.27-1 kmod-crypto-arc4 2.6.32.27-1 kmod-crypto-core 2.6.32.27-1 kmod-fs-ext2 2.6.32.27-1 kmod-fs-ext3 2.6.32.27-1 kmod-fuse 2.6.32.27-1 kmod-i2c-core 2.6.32.27-1 kmod-input-core 2.6.32.27-1 kmod-input-gpio-buttons 2.6.32.27-1 kmod-input-polldev 2.6.32.27-1 kmod-ipt-conntrack 2.6.32.27-1 kmod-ipt-conntrack-extra 2.6.32.27-1 kmod-ipt-core 2.6.32.27-1 kmod-ipt-filter 2.6.32.27-1 kmod-ipt-imq 2.6.32.27-1 kmod-ipt-ipopt 2.6.32.27-1 kmod-ipt-nat 2.6.32.27-1 kmod-mac80211 2.6.32.27+2011-12-01-1 kmod-nls-cp437 2.6.32.27-1 kmod-nls-iso8859-1 2.6.32.27-1 kmod-nls-utf8 2.6.32.27-1 kmod-ppp 2.6.32.27-1 kmod-sched 2.6.32.27-1 kmod-scsi-core 2.6.32.27-1 kmod-sound-core 2.6.32.27-1 kmod-switch 2.6.32.27-4 kmod-textsearch 2.6.32.27-1 kmod-tun 2.6.32.27-1 kmod-usb-audio 2.6.32.27-1 kmod-usb-core 2.6.32.27-1 kmod-usb-ohci 2.6.32.27-1 kmod-usb-printer 2.6.32.27-1 kmod-usb-storage 2.6.32.27-1 kmod-usb-uhci 2.6.32.27-1 kmod-usb2 2.6.32.27-1 kmod-video-core 2.6.32.27-1 kmod-video-uvc 2.6.32.27-1 kmod-zd1211rw 2.6.32.27+2011-12-01-1 lame-lib 398-2-3 libao 1.1.0-1 libc 0.9.30.1-43.32 libevent 1.4.14b-1 libfaad2 2.7-1 libffmpeg 0.5.4-2 libfuse 2.8.3-1 libgcc 4.3.3+cs-43.32 libgsm 1.0.13-1 libiconv 5 libiconv-full 1.11.1-1 libid3tag 0.15.1b-3 libip4tc 1.4.6-3.1 libiwinfo 18 libiwinfo-lua 18 libjpeg 6b-1 libltdl 2.4-1 liblua 5.1.4-7 liblzo 2.04-1 libmad 0.15.1b-3 libncurses 5.7-2 libnl-tiny 0.1-1 libogg 1.1.4-2 libopenssl 0.9.8s-1 libpthread 0.9.30.1-43.32 librrd1 1.0.50-1 librt 0.9.30.1-43.32 libsamplerate 0.1.7-1 libsndfile 1.0.21-1 libuci 12012009.7-4 libuci-lua 12012009.7-4 libusb-1.0 1.0.8-1 libv4l 0.6.1-1 libvorbis 1.2.3-1 libvorbisidec 1.0.2+svn14261-1 libxtables 1.4.6-3.1 lua 5.1.4-7 luci 0.10.0-1 luci-app-firewall 0.10.0-1 luci-app-hd-idle 0.10.0-1 luci-app-ntpc 0.10.0-1 luci-app-qos 0.10.0-1 luci-app-samba 0.10.0-1 luci-app-voice-core 0.10.0-1 luci-i18n-chinese 0.10.0-1 luci-i18n-english 0.10.0-1 luci-lib-core 0.10.0-1 luci-lib-ipkg 0.10.0-1 luci-lib-lmo 0.10.0-1 luci-lib-lucid 0.10.0-1 luci-lib-lucid-http 0.10.0-1 luci-lib-nixio 0.10.0-1 luci-lib-px5g 0.10.0-1 luci-lib-sys 0.10.0-1 luci-lib-web 0.10.0-1 luci-mod-admin-core 0.10.0-1 luci-mod-admin-full 0.10.0-1 luci-proto-core 0.10.0-1 luci-proto-ppp 0.10.0-1 luci-sgi-cgi 0.10.0-1 luci-theme-base 0.10.0-1 luci-theme-openwrt 0.10.0-1 mjpg-streamer r136-1 motion 3.2.11.1-1 mtd 13 mutt 1.5.21-1 n2n 3875-1 ntfs-3g 2011.4.12-1-fuseext ntpclient 2007_365-4 openssl-util 0.9.8s-1 opkg 576-2 qos-scripts 1.2.1-3.2 resolveip 1 samba3 3.0.24-8 screen 4.0.3-2 sox 14.0.1-3 ssmtp 2.64-3 tc 2.6.29-1-2 uci 12012009.7-4 udevtrigger 106-1 uhttpd 28 usbutils 003-1 wireless-tools 29-4 wpad-mini 20111103-2 zlib 1.2.3-5
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Midas-Zhou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值