[Packages] multimedia/uvc-streamer: Add UCI configuration file and a init script
git-svn-id: svn://svn.openwrt.org/openwrt/packages@10126 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
868bce8b06
commit
1b34950dba
@ -40,7 +40,11 @@ MAKE_FLAGS += \
|
|||||||
|
|
||||||
define Package/uvc-streamer/install
|
define Package/uvc-streamer/install
|
||||||
$(INSTALL_DIR) $(1)/sbin
|
$(INSTALL_DIR) $(1)/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uvc_stream $(1)/sbin
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uvc_stream $(1)/sbin/$(PKG_NAME)
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,uvc-streamer))
|
$(eval $(call BuildPackage,uvc-streamer))
|
||||||
|
6
multimedia/uvc-streamer/files/uvc-streamer.config
Normal file
6
multimedia/uvc-streamer/files/uvc-streamer.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
config uvc-streamer
|
||||||
|
option device '/dev/video0'
|
||||||
|
option resolution '640x480'
|
||||||
|
option framespersecond '5'
|
||||||
|
option port '8080'
|
||||||
|
option enabled '1'
|
53
multimedia/uvc-streamer/files/uvc-streamer.init
Normal file
53
multimedia/uvc-streamer/files/uvc-streamer.init
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2007 OpenWrt.org
|
||||||
|
START=50
|
||||||
|
|
||||||
|
SSD=start-stop-daemon
|
||||||
|
NAME=uvc_streamer
|
||||||
|
PIDF=/var/run/$NAME.pid
|
||||||
|
PROG=/sbin/$NAME
|
||||||
|
|
||||||
|
append_bool() {
|
||||||
|
local section="$1"
|
||||||
|
local option="$2"
|
||||||
|
local value="$3"
|
||||||
|
local _val
|
||||||
|
config_get_bool _val "$section" "$option" '0'
|
||||||
|
[ "$_val" -gt 0 ] && append args "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_string() {
|
||||||
|
local section="$1"
|
||||||
|
local option="$2"
|
||||||
|
local value="$3"
|
||||||
|
local _val
|
||||||
|
config_get _val "$section" "$option"
|
||||||
|
[ -n "$_val" ] && append args "$3 $_val"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
local section="$1"
|
||||||
|
args=""
|
||||||
|
append_string "$section" device "-d"
|
||||||
|
append_string "$section" resolution "-r"
|
||||||
|
append_bool "$section" framespersecond "-f"
|
||||||
|
append_string "$section" port "-p"
|
||||||
|
config_get_bool "enabled" "$section" "enabled" '1'
|
||||||
|
[ "$enabled" -gt 0 ] && $SSD -S -p $PIDF -q -x $PROG -- -b $args
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
killall $NAME 2>&1 > /dev/null
|
||||||
|
# FIXME: Fix Busybox start-stop-daemon to work with multiple PIDs
|
||||||
|
# $SSD -K -p $PIDF -q
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
config_load "uvc-streamer"
|
||||||
|
config_foreach start_service "uvc-streamer"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
config_load "uvc-streamer"
|
||||||
|
config_foreach stop_service "uvc-streamer"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user