Moved construct_streamer function
* Moved function to init_streams.sh * Prepared v4l2-ctl device control feature Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
parent
490f3f2842
commit
2a2bff5b31
38
libs/init_stream.sh
Executable file
38
libs/init_stream.sh
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#### Init Stream library
|
||||||
|
|
||||||
|
#### webcamd - A webcam Service for multiple Cams and Stream Services.
|
||||||
|
####
|
||||||
|
#### written by Stephan Wendel aka KwadFan
|
||||||
|
#### Copyright 2021
|
||||||
|
#### https://github.com/mainsail-crew/crowsnest
|
||||||
|
####
|
||||||
|
#### This File is distributed under GPLv3
|
||||||
|
####
|
||||||
|
|
||||||
|
# Exit upon Errors
|
||||||
|
set -e
|
||||||
|
|
||||||
|
## Start Stream Service
|
||||||
|
# sleep to prevent cpu cycle spikes
|
||||||
|
function construct_streamer {
|
||||||
|
local stream_server cams
|
||||||
|
cams=($(configured_cams))
|
||||||
|
log_msg "Try to start configured Cams / Services..."
|
||||||
|
for (( i=0; i<"${#cams[@]}"; i++ )); do
|
||||||
|
stream_server="$(get_param "cam ${cams[$i]}" streamer 2> /dev/null)"
|
||||||
|
if [ "${stream_server}" == "ustreamer" ]; then
|
||||||
|
run_ustreamer "${cams[$i]}" &
|
||||||
|
sleep 8 & sleep_pid="$!"
|
||||||
|
wait "${sleep_pid}"
|
||||||
|
elif [ "${stream_server}" == "rtsp" ]; then
|
||||||
|
run_rtsp "${cams[$i]}" &
|
||||||
|
sleep 8 & sleep_pid="$!"
|
||||||
|
wait "${sleep_pid}"
|
||||||
|
else
|
||||||
|
log_msg "ERROR: Missing 'streamer' parameter in [cam ${cams[$i]}]. Skipping."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
log_msg "... Done!"
|
||||||
|
}
|
16
libs/v4l2_control.sh
Normal file
16
libs/v4l2_control.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#### Init Stream library
|
||||||
|
|
||||||
|
#### webcamd - A webcam Service for multiple Cams and Stream Services.
|
||||||
|
####
|
||||||
|
#### written by Stephan Wendel aka KwadFan
|
||||||
|
#### Copyright 2021
|
||||||
|
#### https://github.com/mainsail-crew/crowsnest
|
||||||
|
####
|
||||||
|
#### This File is distributed under GPLv3
|
||||||
|
####
|
||||||
|
|
||||||
|
# Exit upon Errors
|
||||||
|
set -e
|
||||||
|
|
25
webcamd
25
webcamd
@ -28,29 +28,8 @@ source "${BASE_CN_PATH}/libs/hwhandler.sh"
|
|||||||
source "${BASE_CN_PATH}/libs/logging.sh"
|
source "${BASE_CN_PATH}/libs/logging.sh"
|
||||||
source "${BASE_CN_PATH}/libs/messages.sh"
|
source "${BASE_CN_PATH}/libs/messages.sh"
|
||||||
source "${BASE_CN_PATH}/libs/watchdog.sh"
|
source "${BASE_CN_PATH}/libs/watchdog.sh"
|
||||||
|
source "${BASE_CN_PATH}/libs/init_stream.sh"
|
||||||
## Start Stream Service
|
# source "${BASE_CN_PATH}/libs/v4l2_control.sh"
|
||||||
# sleep to prevent cpu cycle spikes
|
|
||||||
function construct_streamer {
|
|
||||||
local stream_server cams
|
|
||||||
cams=($(configured_cams))
|
|
||||||
log_msg "Try to start configured Cams / Services..."
|
|
||||||
for (( i=0; i<"${#cams[@]}"; i++ )); do
|
|
||||||
stream_server="$(get_param "cam ${cams[$i]}" streamer 2> /dev/null)"
|
|
||||||
if [ "${stream_server}" == "ustreamer" ]; then
|
|
||||||
run_ustreamer "${cams[$i]}" &
|
|
||||||
sleep 8 & sleep_pid="$!"
|
|
||||||
wait "${sleep_pid}"
|
|
||||||
elif [ "${stream_server}" == "rtsp" ]; then
|
|
||||||
run_rtsp "${cams[$i]}" &
|
|
||||||
sleep 8 & sleep_pid="$!"
|
|
||||||
wait "${sleep_pid}"
|
|
||||||
else
|
|
||||||
log_msg "ERROR: Missing 'streamer' parameter in [cam ${cams[$i]}]. Skipping."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
log_msg "... Done!"
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_ustreamer {
|
function run_ustreamer {
|
||||||
local cam_section ustreamer_bin device port resolution fps custom
|
local cam_section ustreamer_bin device port resolution fps custom
|
||||||
|
Loading…
x
Reference in New Issue
Block a user