From 4bb4828acf00192d65a62f7d4f425bc702a8cf63 Mon Sep 17 00:00:00 2001 From: Moe Date: Sat, 4 Dec 2021 21:59:26 -0800 Subject: [PATCH] Add Substream Default values and some validation for startup --- definitions/en_CA.js | 16 +++++++----- libs/webServerPaths.js | 21 ++++++++++----- web/assets/js/bs5.monitorSettings.js | 38 +++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/definitions/en_CA.js b/definitions/en_CA.js index 9d0f886a..0f6292fa 100644 --- a/definitions/en_CA.js +++ b/definitions/en_CA.js @@ -1304,7 +1304,8 @@ module.exports = function(s,config,lang){ possible:[ { "name": "H.264 / H.265 / H.265+", - "value": "h264" + "value": "h264", + selected: true, }, { "name": "JPEG", @@ -1372,6 +1373,7 @@ module.exports = function(s,config,lang){ { "name": lang.Yes, "value": "1", + selected: true, } ] }, @@ -1386,7 +1388,8 @@ module.exports = function(s,config,lang){ { "name": lang.Auto, "value": "", - "info": "Let FFMPEG decide. Normally it will try UDP first." + "info": "Let FFMPEG decide. Normally it will try UDP first.", + selected: true, }, { "name": "TCP", @@ -1411,6 +1414,7 @@ module.exports = function(s,config,lang){ { "name": lang.No, "value": "0", + selected: true, }, { "name": lang.Yes, @@ -1439,7 +1443,8 @@ module.exports = function(s,config,lang){ possible:[ { "name": lang.Auto + '('+lang.Recommended+')', - "value": "" + "value": "", + selected: true, }, { "name": lang.NVIDIA, @@ -1532,7 +1537,6 @@ module.exports = function(s,config,lang){ { "name": lang.Poseidon, "value": "mp4", - "info": "Poseidon is built on Kevin Godell's MP4 processing code. It simulates a streaming MP4 file but using the data of a live stream. Includes Audio. Some browsers can play it like a regular MP4 file. Streams over HTTP or WebSocket." }, { "name": lang["RTMP Stream"], @@ -1541,17 +1545,15 @@ module.exports = function(s,config,lang){ { "name": lang['MJPEG'], "value": "mjpeg", - "info": "Standard Motion JPEG image. No audio." }, { "name": lang['FLV'], "value": "flv", - "info": "Sending FLV encoded frames over WebSocket." }, { "name": lang['HLS (includes Audio)'], "value": "hls", - "info": "Similar method to facebook live streams. Includes audio if input provides it. There is a delay of about 4-6 seconds because this method records segments then pushes them to the client rather than push as while it creates them." + selected: true, } ] }, diff --git a/libs/webServerPaths.js b/libs/webServerPaths.js index 654a3488..f4408d13 100644 --- a/libs/webServerPaths.js +++ b/libs/webServerPaths.js @@ -839,13 +839,22 @@ module.exports = function(s,config,lang,app,io){ }else{ const monitorConfig = s.group[groupKey].rawMonitorConfigurations[monitorId] const activeMonitor = s.group[groupKey].activeMonitors[monitorId] - if(!activeMonitor.subStreamProcess){ - response.ok = true - activeMonitor.allowDestroySubstream = false; - spawnSubstreamProcess(monitorConfig) + const substreamConfig = monitorConfig.details.substream + if( + substreamConfig.input.fulladdress && + substreamConfig.input.type && + substreamConfig.output + ){ + if(!activeMonitor.subStreamProcess){ + response.ok = true + activeMonitor.allowDestroySubstream = false; + spawnSubstreamProcess(monitorConfig) + }else{ + activeMonitor.allowDestroySubstream = true + await destroySubstreamProcess(activeMonitor) + } }else{ - activeMonitor.allowDestroySubstream = true - await destroySubstreamProcess(activeMonitor) + response.msg = lang['Invalid Settings'] } } s.closeJsonResponse(res,response); diff --git a/web/assets/js/bs5.monitorSettings.js b/web/assets/js/bs5.monitorSettings.js index 3ba50b05..faf9a3ea 100644 --- a/web/assets/js/bs5.monitorSettings.js +++ b/web/assets/js/bs5.monitorSettings.js @@ -214,7 +214,43 @@ function generateDefaultMonitorSettings(){ "detector_cascades": "", "stream_channels": "", "input_maps": "", - "input_map_choices": "" + "input_map_choices": "", + "substream": { + "input": { + "type": "h264", + "fulladdress": "", + "sfps": "", + "aduration": "", + "probesize": "", + "stream_loop": null, + "rtsp_transport": "tcp", + "accelerator": "0", + "hwaccel": null, + "hwaccel_vcodec": "", + "hwaccel_device": "", + "cust_input": "" + }, + "output": { + "stream_type": "hls", + "rtmp_server_url": "", + "rtmp_stream_key": "", + "stream_mjpeg_clients": "", + "stream_vcodec": "copy", + "stream_acodec": "no", + "hls_time": "", + "hls_list_size": "", + "preset_stream": "", + "stream_quality": "", + "stream_v_br": "", + "stream_a_br": "", + "stream_fps": "", + "stream_scale_x": "", + "stream_scale_y": "", + "stream_rotate": null, + "svf": "", + "cust_stream": "" + } + } }, "shto": "[]", "shfr": "[]"