blob: aef12489da66e52e6ad9f7be275f72bd19711226 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2012 OpenWrt.org
START=50
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
PROG=/usr/bin/mjpg_streamer
error() {
echo "${initscript}:" "$@" 1>&2
}
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
start_instance() {
local s="$1"
section_enabled "$s" || return 1
config_get device "$s" 'device'
config_get resolution "$s" 'resolution'
config_get fps "$s" 'fps'
config_get www "$s" 'www'
config_get port "$s" 'port'
[ -c "$device" ] || {
error "device '$device' does not exist"
return 1
}
# run in yuv (legacy) mode, impacts performance but at least something is happening
service_start /usr/bin/mjpg_streamer --input "input_uvc.so \
--device $device --fps $fps --resolution $resolution -yuv" \
--output "output_http.so --www $www --port $port"
}
stop_instance() {
local s="$1"
section_enabled "$s" || return 1
service_stop /usr/bin/mjpg_streamer
}
start() {
config_load 'mjpg-streamer'
config_foreach start_instance 'mjpg-streamer'
}
stop() {
config_load 'mjpg-streamer'
config_foreach stop_instance 'mjpg-streamer'
}
|