[packages] mjpg-streamer: upgrade package
Changes include: * version bump to r181 * convert init script so it can use procd * add menu so one can select only desired features Signed-off-by: Luka Perkov <luka@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/packages@38143 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3c404da30c
commit
9a2ec233fb
23
multimedia/mjpg-streamer/Config.in
Normal file
23
multimedia/mjpg-streamer/Config.in
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
if PACKAGE_mjpg-streamer
|
||||||
|
|
||||||
|
config MJPG_STREAMER_INPUT_FILE
|
||||||
|
bool "Install input file library"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config MJPG_STREAMER_INPUT_UVC
|
||||||
|
bool "Install input uvc library"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config MJPG_STREAMER_OUTPUT_FILE
|
||||||
|
bool "Install output file library"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config MJPG_STREAMER_OUTPUT_HTTP
|
||||||
|
bool "Install output http library"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config MJPG_STREAMER_WWW
|
||||||
|
bool "Install WWW files"
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2013 OpenWrt.org
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -8,9 +8,9 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=mjpg-streamer
|
PKG_NAME:=mjpg-streamer
|
||||||
PKG_REV:=148
|
PKG_REV:=181
|
||||||
PKG_VERSION:=r$(PKG_REV)
|
PKG_VERSION:=r$(PKG_REV)
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer
|
PKG_SOURCE_URL:=https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer
|
||||||
@ -26,14 +26,23 @@ define Package/mjpg-streamer
|
|||||||
TITLE:=MJPG-streamer
|
TITLE:=MJPG-streamer
|
||||||
DEPENDS:=+libpthread +libjpeg
|
DEPENDS:=+libpthread +libjpeg
|
||||||
URL:=http://mjpg-streamer.wiki.sourceforge.net/
|
URL:=http://mjpg-streamer.wiki.sourceforge.net/
|
||||||
|
MENU:=1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/mjpg-streamer/description
|
define Package/mjpg-streamer/description
|
||||||
Streaming application for Linux-UVC compatible webcams
|
Streaming application for Linux-UVC compatible webcams
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/mjpg-streamer/config
|
||||||
|
source "$(SOURCE)/Config.in"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
EXTRA_CFLAGS += $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)
|
EXTRA_CFLAGS += $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)
|
||||||
|
|
||||||
|
define Package/mjpg-streamer/conffiles
|
||||||
|
/etc/config/mjpg-streamer
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/mjpg-streamer/install
|
define Package/mjpg-streamer/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mjpg_streamer $(1)/usr/bin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mjpg_streamer $(1)/usr/bin/
|
||||||
@ -41,17 +50,25 @@ define Package/mjpg-streamer/install
|
|||||||
$(CP) ./files/mjpg-streamer.config $(1)/etc/config/mjpg-streamer
|
$(CP) ./files/mjpg-streamer.config $(1)/etc/config/mjpg-streamer
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/mjpg-streamer.init $(1)/etc/init.d/mjpg-streamer
|
$(INSTALL_BIN) ./files/mjpg-streamer.init $(1)/etc/init.d/mjpg-streamer
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(CP) $(foreach input_plugin,file uvc,$(PKG_BUILD_DIR)/input_$(input_plugin).so) $(1)/usr/lib
|
|
||||||
$(CP) $(foreach output_plugin,http file,$(PKG_BUILD_DIR)/output_$(output_plugin).so) $(1)/usr/lib
|
|
||||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
|
||||||
$(INSTALL_DATA) ./files/mjpg-streamer.hotplug $(1)/etc/hotplug.d/usb/20-mjpg-streamer
|
$(INSTALL_DATA) ./files/mjpg-streamer.hotplug $(1)/etc/hotplug.d/usb/20-mjpg-streamer
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
ifeq ($(CONFIG_MJPG_STREAMER_INPUT_FILE),y)
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/input_file.so $(1)/usr/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_MJPG_STREAMER_INPUT_UVC),y)
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_FILE),y)
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/output_file.so $(1)/usr/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_HTTP),y)
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/output_http.so $(1)/usr/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_MJPG_STREAMER_WWW),y)
|
||||||
$(INSTALL_DIR) $(1)/www/webcam
|
$(INSTALL_DIR) $(1)/www/webcam
|
||||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/www/* $(1)/www/webcam
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/www/* $(1)/www/webcam
|
||||||
endef
|
endif
|
||||||
|
|
||||||
define Package/mjpg-streamer/conffiles
|
|
||||||
/etc/config/mjpg-streamer
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,mjpg-streamer))
|
$(eval $(call BuildPackage,mjpg-streamer))
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
config mjpg-streamer core
|
config mjpg-streamer 'core'
|
||||||
option enabled "0"
|
option enabled '0'
|
||||||
option device "/dev/video0"
|
option input 'uvc'
|
||||||
option resolution "640x480"
|
option output 'http'
|
||||||
option fps "5"
|
option device '/dev/video0'
|
||||||
option www "/www/webcam"
|
option resolution '640x480'
|
||||||
option port "8080"
|
option fps '5'
|
||||||
|
option www '/www/webcam'
|
||||||
|
option port '8080'
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
add)
|
add)
|
||||||
# start process
|
# start process
|
||||||
/etc/init.d/mjpg-streamer start
|
/etc/init.d/mjpg-streamer start
|
||||||
;;
|
;;
|
||||||
remove)
|
remove)
|
||||||
# stop process
|
# stop process
|
||||||
/etc/init.d/mjpg-streamer stop
|
/etc/init.d/mjpg-streamer stop
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1,57 +1,83 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2009-2012 OpenWrt.org
|
# Copyright (C) 2009-2013 OpenWrt.org
|
||||||
|
|
||||||
START=50
|
START=90
|
||||||
|
STOP=10
|
||||||
SERVICE_DAEMONIZE=1
|
|
||||||
SERVICE_WRITE_PID=1
|
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
PROG=/usr/bin/mjpg_streamer
|
PROG=/usr/bin/mjpg_streamer
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
echo "${initscript}:" "$@" 1>&2
|
echo "${initscript}:" "$@" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
section_enabled() {
|
|
||||||
config_get_bool enabled "$1" 'enabled' 0
|
|
||||||
[ $enabled -gt 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
start_instance() {
|
start_instance() {
|
||||||
local s="$1"
|
local s="$1"
|
||||||
|
|
||||||
section_enabled "$s" || return 1
|
config_get_bool enabled "$1" 'enabled' 0
|
||||||
|
[ $enabled -eq 0 ] && return
|
||||||
|
|
||||||
config_get device "$s" 'device'
|
config_get input "$s" 'input'
|
||||||
config_get resolution "$s" 'resolution'
|
if [ -z "$input" ]; then
|
||||||
config_get fps "$s" 'fps'
|
error "in section '$s' option input is missing"
|
||||||
config_get www "$s" 'www'
|
|
||||||
config_get port "$s" 'port'
|
|
||||||
|
|
||||||
[ -c "$device" ] || {
|
|
||||||
error "device '$device' does not exist"
|
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
service_start /usr/bin/mjpg_streamer --input "input_uvc.so \
|
config_get output "$s" 'output'
|
||||||
--device $device --fps $fps --resolution $resolution" \
|
if [ -z "$output" ]; then
|
||||||
--output "output_http.so --www $www --port $port"
|
error "in section '$s' option output is missing"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local input_arg
|
||||||
|
if [ "x$input" = 'xuvc' ]; then
|
||||||
|
input_arg="input_uvc.so"
|
||||||
|
|
||||||
|
config_get device "$s" 'device'
|
||||||
|
if [ ! -c "$device" ]; then
|
||||||
|
error "device '$device' does not exist"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
input_arg="${input_arg} --device $device"
|
||||||
|
|
||||||
|
config_get fps "$s" 'fps'
|
||||||
|
[ -n "$fps" ] && input_arg="${input_arg} --fps $fps"
|
||||||
|
|
||||||
|
config_get resolution "$s" 'resolution'
|
||||||
|
[ -n "$resolution" ] && input_arg="${input_arg} --resolution $resolution"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$input_arg" ]; then
|
||||||
|
error "unsuported input option '$input' in section '$s'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local output_arg
|
||||||
|
if [ "x$output" = 'xhttp' ]; then
|
||||||
|
output_arg="output_http.so"
|
||||||
|
|
||||||
|
config_get port "$s" 'port'
|
||||||
|
[ -n "$port" ] && output_arg="${output_arg} --port $port"
|
||||||
|
|
||||||
|
config_get www "$s" 'www'
|
||||||
|
[ -n "$www" ] && output_arg="${output_arg} --www $www"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$output_arg" ]; then
|
||||||
|
error "unsuported output option '$output' in section '$s'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command "$PROG" --input "$input_arg" --output "$output_arg"
|
||||||
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_instance() {
|
start_service() {
|
||||||
local s="$1"
|
|
||||||
|
|
||||||
section_enabled "$s" || return 1
|
|
||||||
|
|
||||||
service_stop /usr/bin/mjpg_streamer
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
config_load 'mjpg-streamer'
|
config_load 'mjpg-streamer'
|
||||||
config_foreach start_instance 'mjpg-streamer'
|
config_foreach start_instance 'mjpg-streamer'
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
service_triggers() {
|
||||||
config_load 'mjpg-streamer'
|
procd_add_reload_trigger 'mjpg-streamer'
|
||||||
config_foreach stop_instance 'mjpg-streamer'
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user