Add Substream Default values and some validation for startup

montage-api
Moe 2021-12-04 21:59:26 -08:00
parent baa1986d80
commit 4bb4828acf
3 changed files with 61 additions and 14 deletions

View File

@ -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. <b>Includes audio</b> 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,
}
]
},

View File

@ -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);

View File

@ -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": "[]"