Discovery VideoSources and Dynamically Update Editor

This commit is contained in:
Lord-Grey 2021-02-14 11:39:03 +01:00
parent f25b152d51
commit 054d3dac41
11 changed files with 2782 additions and 2515 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,214 +3,7 @@ $(document).ready(function () {
var conf_editor_v4l2 = null; var conf_editor_v4l2 = null;
var conf_editor_fg = null; var conf_editor_fg = null;
var conf_editor_instCapt = null; var conf_editor_instCapt = null;
var V4L2_AVAIL = window.serverInfo.grabbers.available.includes("v4l2"); var VIDEOGRABBER_AVAIL = window.serverInfo.grabbers.available.includes("v4l2");
if (V4L2_AVAIL) {
// Dynamic v4l2 enum schema
var v4l2_dynamic_enum_schema = {
"available_devices":
{
"type": "string",
"title": "edt_conf_v4l2_device_title",
"propertyOrder": 1,
"required": true,
"custom": true
},
"device_inputs":
{
"type": "string",
"title": "edt_conf_v4l2_input_title",
"propertyOrder": 3,
"required": true,
"custom": false
},
"encoding_format":
{
"type": "string",
"title": "edt_conf_v4l2_encoding_title",
"propertyOrder": 5,
"required": true,
"custom": false
},
"resolutions":
{
"type": "string",
"title": "edt_conf_v4l2_resolution_title",
"propertyOrder": 9,
"required": true,
"custom": true
},
"framerates":
{
"type": "string",
"title": "edt_conf_v4l2_framerate_title",
"propertyOrder": 12,
"required": true,
"custom": true
}
};
// Build dynamic v4l2 enum schema parts
var buildSchemaPart = function (key, schema, device) {
if (schema[key]) {
var enumVals = [];
var enumTitelVals = [];
var v4l2_properties = JSON.parse(JSON.stringify(window.serverInfo.grabbers.video_sources));
if (key == 'available_devices') {
for (var i = 0; i < v4l2_properties.length; i++) {
enumVals.push(v4l2_properties[i]['device']);
v4l2_properties[i].hasOwnProperty('name')
? enumTitelVals.push(v4l2_properties[i]['name'])
: enumTitelVals.push(v4l2_properties[i]['device']);
}
} else if (key == 'device_inputs') {
return; // TODO Fix V4L2 WebUI
for (var i = 0; i < v4l2_properties.length; i++) {
if (v4l2_properties[i]['device'] == device) {
for (var index = 0; index < v4l2_properties[i]['device_inputs'].length; index++) {
enumVals.push(v4l2_properties[i]['device_inputs'][index]['inputIndex'].toString());
enumTitelVals.push(v4l2_properties[i]['device_inputs'][index]['inputName']);
}
break;
}
}
} else if (key == 'encoding_format') {
for (var i = 0; i < v4l2_properties.length; i++) {
if (v4l2_properties[i]['device'] == device) {
enumVals = enumTitelVals = v4l2_properties[i][key];
break;
}
}
}
else if (key == 'resolutions') {
for (var i = 0; i < v4l2_properties.length; i++) {
if (v4l2_properties[i]['device'] == device) {
enumVals = enumTitelVals = v4l2_properties[i][key];
break;
}
}
} else if (key == 'framerates') {
for (var i = 0; i < v4l2_properties.length; i++) {
if (v4l2_properties[i]['device'] == device) {
enumVals = enumTitelVals = v4l2_properties[i][key];
break;
}
}
}
window.schema.grabberV4L2.properties[key] = {
"type": schema[key].type,
"title": schema[key].title,
...(schema[key].custom ? {"enum": [].concat(["auto"], enumVals, ["custom"]),} : {"enum": [].concat(["auto"], enumVals),}),
"options":
{
"enum_titles": [].concat(["edt_conf_enum_automatic"], enumTitelVals, ["edt_conf_enum_custom"]),
},
"propertyOrder": schema[key].propertyOrder,
"required": schema[key].required
};
}
};
// Switch between visible states
function toggleOption(option, state) {
$('[data-schemapath="root.grabberV4L2.' + option + '"]').toggle(state);
if (state) (
$('[data-schemapath="root.grabberV4L2.' + option + '"]').addClass('col-md-12'),
$('label[for="root_grabberV4L2_' + option + '"]').css('left', '10px'),
$('[id="root_grabberV4L2_' + option + '"]').css('left', '10px')
);
}
// Watch all v4l2 dynamic fields
var setWatchers = function (schema) {
var path = 'root.grabberV4L2.';
Object.keys(schema).forEach(function (key) {
conf_editor_v4l2.watch(path + key, function () {
var ed = conf_editor_v4l2.getEditor(path + key);
var val = ed.getValue();
if (key == 'available_devices') {
var V4L2properties = ['device_inputs', 'resolutions', 'framerates', 'encoding_format'];
if (val == 'custom') {
var grabberV4L2 = ed.parent;
V4L2properties.forEach(function (item) {
buildSchemaPart(item, v4l2_dynamic_enum_schema, 'none');
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
conf_editor_v4l2.validator.schema.properties.grabberV4L2.properties[item] = window.schema.grabberV4L2.properties[item];
grabberV4L2.removeObjectProperty(item);
delete grabberV4L2.cached_editors[item];
grabberV4L2.addObjectProperty(item);
conf_editor_v4l2.getEditor(path + item).enable();
});
conf_editor_v4l2.getEditor(path + 'standard').enable();
toggleOption('device', true);
} else if (val == 'auto') {
V4L2properties.forEach(function (item) {
conf_editor_v4l2.getEditor(path + item).setValue('auto');
conf_editor_v4l2.getEditor(path + item).disable();
});
conf_editor_v4l2.getEditor(path + 'standard').setValue('auto');
conf_editor_v4l2.getEditor(path + 'standard').disable();
(toggleOption('device', false), toggleOption('input', false),
toggleOption('width', false), toggleOption('height', false),
toggleOption('fps', false), toggleOption('encoding', false));
} else {
var grabberV4L2 = ed.parent;
V4L2properties.forEach(function (item) {
buildSchemaPart(item, v4l2_dynamic_enum_schema, val);
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
conf_editor_v4l2.validator.schema.properties.grabberV4L2.properties[item] = window.schema.grabberV4L2.properties[item];
grabberV4L2.removeObjectProperty(item);
delete grabberV4L2.cached_editors[item];
grabberV4L2.addObjectProperty(item);
conf_editor_v4l2.getEditor(path + item).enable();
});
conf_editor_v4l2.getEditor(path + 'standard').enable();
toggleOption('device', false);
}
}
if (key == 'resolutions')
val != 'custom'
? (toggleOption('width', false), toggleOption('height', false))
: (toggleOption('width', true), toggleOption('height', true));
if (key == 'framerates')
val != 'custom'
? toggleOption('fps', false)
: toggleOption('fps', true);
if (key == 'device_inputs')
val != 'custom'
? toggleOption('input', false)
: toggleOption('input', true);
if (key == 'encoding_format')
val != 'custom'
? toggleOption('encoding', false)
: toggleOption('encoding', true);
});
});
};
// Insert dynamic v4l2 enum schema parts
Object.keys(v4l2_dynamic_enum_schema).forEach(function (key) {
buildSchemaPart(key, v4l2_dynamic_enum_schema, window.serverConfig.grabberV4L2.device);
});
}
if (window.showOptHelp) { if (window.showOptHelp) {
// Instance Capture // Instance Capture
@ -224,7 +17,7 @@ $(document).ready(function () {
$('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"))); $('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
// V4L2 - hide if not available // V4L2 - hide if not available
if (V4L2_AVAIL) { if (VIDEOGRABBER_AVAIL) {
$('#conf_cont').append(createRow('conf_cont_v4l')); $('#conf_cont').append(createRow('conf_cont_v4l'));
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); $('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title"))); $('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
@ -233,7 +26,7 @@ $(document).ready(function () {
$('#conf_cont').addClass('row'); $('#conf_cont').addClass('row');
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
if (V4L2_AVAIL) { if (VIDEOGRABBER_AVAIL) {
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
} }
} }
@ -244,14 +37,12 @@ $(document).ready(function () {
}, true, true); }, true, true);
// Hide V4L2 elements, if not available // Hide V4L2 elements, if not available
if (!V4L2_AVAIL) { if (!VIDEOGRABBER_AVAIL) {
var instCapOptions = conf_editor_instCapt;
$('[data-schemapath*="root.instCapture.v4lEnable' + '"]').hide(); $('[data-schemapath*="root.instCapture.v4lEnable' + '"]').hide();
$('[data-schemapath*="root.instCapture.v4lPriority' + '"]').hide(); $('[data-schemapath*="root.instCapture.v4lPriority' + '"]').hide();
} }
conf_editor_instCapt.on('change', function () { conf_editor_instCapt.on('change', function () {
var systemEnable = conf_editor_instCapt.getEditor("root.instCapture.systemEnable").getValue(); var systemEnable = conf_editor_instCapt.getEditor("root.instCapture.systemEnable").getValue();
if (systemEnable) { if (systemEnable) {
$('[data-schemapath*="root.instCapture.systemPriority' + '"]').show(); $('[data-schemapath*="root.instCapture.systemPriority' + '"]').show();
@ -261,121 +52,40 @@ $(document).ready(function () {
$('[data-schemapath*="root.instCapture.systemPriority' + '"]').hide(); $('[data-schemapath*="root.instCapture.systemPriority' + '"]').hide();
} }
if (V4L2_AVAIL) { if (VIDEOGRABBER_AVAIL) {
var v4lEnable = conf_editor_instCapt.getEditor("root.instCapture.v4lEnable").getValue(); var v4lEnable = conf_editor_instCapt.getEditor("root.instCapture.v4lEnable").getValue();
if (v4lEnable) { if (v4lEnable) {
$('[data-schemapath*="root.instCapture.v4lPriority' + '"]').show(); $('[data-schemapath*="root.instCapture.v4lPriority' + '"]').show();
$('#conf_cont_v4l').show(); $('#conf_cont_v4l').show();
} else { }
else {
$('[data-schemapath*="root.instCapture.v4lPriority' + '"]').hide(); $('[data-schemapath*="root.instCapture.v4lPriority' + '"]').hide();
$('#conf_cont_v4l').hide(); $('#conf_cont_v4l').hide();
} }
} }
conf_editor_instCapt.validate().length || window.readOnlyMode ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false); conf_editor_instCapt.validate().length || window.readOnlyMode ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false);
}); });
conf_editor_instCapt.watch('root.instCapture.v4lEnable', () => {
if (VIDEOGRABBER_AVAIL) {
var v4lEnable = conf_editor_instCapt.getEditor("root.instCapture.v4lEnable").getValue();
if (v4lEnable) {
discoverInputSources("video");
}
}
});
$('#btn_submit_instCapt').off().on('click', function () { $('#btn_submit_instCapt').off().on('click', function () {
requestWriteConfig(conf_editor_instCapt.getValue()); requestWriteConfig(conf_editor_instCapt.getValue());
}); });
$('#btn_submit_fg').off().on('click', function () {
requestWriteConfig(conf_editor_fg.getValue());
});
if (V4L2_AVAIL) {
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
grabberV4L2: window.schema.grabberV4L2
}, true, true);
conf_editor_v4l2.on('change', function () {
conf_editor_v4l2.validate().length || window.readOnlyMode ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
});
conf_editor_v4l2.on('ready', function () {
setWatchers(v4l2_dynamic_enum_schema);
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
toggleOption('device', true);
if (window.serverConfig.grabberV4L2.device == 'auto')
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
['device_inputs', 'standard', 'resolutions', 'framerates', 'encoding_format'].forEach(function (item) {
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
});
}
if (window.serverConfig.grabberV4L2.device_inputs == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
toggleOption('input', true);
if (window.serverConfig.grabberV4L2.resolutions == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
(toggleOption('width', true), toggleOption('height', true));
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
toggleOption('fps', true);
if (window.serverConfig.grabberV4L2.encoding_format == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
toggleOption('encoding', true);
});
$('#btn_submit_v4l2').off().on('click', function () {
var v4l2Options = conf_editor_v4l2.getValue();
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
if (v4l2Options.grabberV4L2.available_devices == 'auto')
v4l2Options.grabberV4L2.device = 'auto';
if (v4l2Options.grabberV4L2.device_inputs != 'custom' && v4l2Options.grabberV4L2.device_inputs != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
v4l2Options.grabberV4L2.input = parseInt(v4l2Options.grabberV4L2.device_inputs);
if (v4l2Options.grabberV4L2.device_inputs == 'auto')
v4l2Options.grabberV4L2.input = -1;
if (v4l2Options.grabberV4L2.encoding_format != 'custom' && v4l2Options.grabberV4L2.encoding_format != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
v4l2Options.grabberV4L2.encoding = v4l2Options.grabberV4L2.encoding_format;
if (v4l2Options.grabberV4L2.encoding_format == 'auto' || v4l2Options.grabberV4L2.encoding_format == 'NO_CHANGE')
v4l2Options.grabberV4L2.encoding = 'NO_CHANGE';
if (v4l2Options.grabberV4L2.resolutions != 'custom' && v4l2Options.grabberV4L2.resolutions != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
(v4l2Options.grabberV4L2.width = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[0]),
v4l2Options.grabberV4L2.height = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[1]));
if (v4l2Options.grabberV4L2.resolutions == 'auto')
(v4l2Options.grabberV4L2.width = 0, v4l2Options.grabberV4L2.height = 0);
if (v4l2Options.grabberV4L2.framerates != 'custom' && v4l2Options.grabberV4L2.framerates != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
v4l2Options.grabberV4L2.fps = parseInt(v4l2Options.grabberV4L2.framerates);
if (v4l2Options.grabberV4L2.framerates == 'auto')
v4l2Options.grabberV4L2.fps = 15;
requestWriteConfig(v4l2Options);
});
}
//////////////////////////////////////////////////
//create introduction
if (window.showOptHelp) {
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
if (V4L2_AVAIL) {
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
}
}
// Framegrabber // Framegrabber
conf_editor_fg = createJsonEditor('editor_container_fg', { conf_editor_fg = createJsonEditor('editor_container_fg', {
framegrabber: window.schema.framegrabber framegrabber: window.schema.framegrabber
}, true, true); }, true, true);
conf_editor_fg.on('ready', function () { conf_editor_fg.on('ready', function () {
var availableGrabbers = window.serverInfo.grabbers.available; var availableGrabbers = window.serverInfo.grabbers.available;
var fgOptions = conf_editor_fg.getEditor('root.framegrabber'); var fgOptions = conf_editor_fg.getEditor('root.framegrabber');
var orginalGrabberTypes = fgOptions.schema.properties.type.enum; var orginalGrabberTypes = fgOptions.schema.properties.type.enum;
@ -419,7 +129,6 @@ $(document).ready(function () {
} }
function filerFgGrabberOptions(type) { function filerFgGrabberOptions(type) {
//hide specific options for grabbers found //hide specific options for grabbers found
var grabbers = window.serverInfo.grabbers.available; var grabbers = window.serverInfo.grabbers.available;
if (grabbers.indexOf(type) > -1) { if (grabbers.indexOf(type) > -1) {
@ -450,6 +159,344 @@ $(document).ready(function () {
} }
}; };
removeOverlay(); $('#btn_submit_fg').off().on('click', function () {
}); requestWriteConfig(conf_editor_fg.getValue());
});
// External Input Sources (Video-Grabbers)
var configuredDevice = "";
var discoveredInputSources = {};
var deviceProperties = {};
if (VIDEOGRABBER_AVAIL) {
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
grabberV4L2: window.schema.grabberV4L2
}, true, true);
conf_editor_v4l2.on('ready', function () {
var v4lEnable = conf_editor_instCapt.getEditor("root.instCapture.v4lEnable").getValue();
if (v4lEnable) {
discoverInputSources("video");
}
});
conf_editor_v4l2.on('change', function () {
var deviceSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.available_devices").getValue();
if (!conf_editor_v4l2.validate().length) {
if (deviceSelected !== "NONE") {
window.readOnlyMode ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
}
}
});
conf_editor_v4l2.watch('root.grabberV4L2.available_devices', () => {
var deviceSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.available_devices").getValue();
if (deviceSelected === "NONE" || deviceSelected === "") {
$('#btn_submit_v4l2').attr('disabled', true);
}
else {
var addSchemaElements = {};
var enumVals = [];
var enumTitelVals = [];
var enumDefaultVal = "";
var deviceProperties = getPropertiesOfDevice(deviceSelected);
//Update hidden input element
conf_editor_v4l2.getEditor("root.grabberV4L2.device").setValue(deviceProperties.device);
var video_inputs = deviceProperties.video_inputs;
if (video_inputs.length <= 1) {
addSchemaElements.access = "expert";
}
for (const video_input of video_inputs) {
enumVals.push(video_input.inputIdx);
enumTitelVals.push(video_input.name);
}
if (enumVals.length > 0) {
if (deviceSelected === configuredDevice) {
var configuredVideoInput = window.serverConfig.grabberV4L2.input;
if ($.inArray(configuredVideoInput, enumVals) != -1) {
enumDefaultVal = configuredVideoInput;
}
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'device_inputs', addSchemaElements, enumVals, enumTitelVals, enumDefaultVal, false);
}
if (!window.readOnlyMode) {
$('#btn_submit_v4l2').attr('disabled', false);
}
}
});
conf_editor_v4l2.watch('root.grabberV4L2.device_inputs', () => {
var deviceSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.available_devices").getValue();
var videoInputSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.device_inputs").getValue();
var addSchemaElements = {};
var enumVals = [];
var enumTitelVals = [];
var enumDefaultVal = "";
var deviceProperties = getPropertiesOfDevice(deviceSelected);
var formats = deviceProperties.video_inputs[videoInputSelected].formats;
//Hide, if only one record available for selection
if (formats.length <= 1) {
addSchemaElements.access = "expert";
}
for (var i = 0; i < formats.length; i++) {
if (formats[i].format) {
enumVals.push(formats[i].format);
enumTitelVals.push(formats[i].format.toUpperCase());
}
else {
enumVals.push("NONE");
}
}
if (enumVals.length > 0) {
if (deviceSelected === configuredDevice) {
var configuredEncoding = window.serverConfig.grabberV4L2.encoding;
if ($.inArray(configuredEncoding, enumVals) != -1) {
enumDefaultVal = configuredEncoding;
}
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'encoding', addSchemaElements, enumVals, enumTitelVals, enumDefaultVal, false);
}
var enumVals = [];
var enumDefaultVal = "";
var standards = deviceProperties.video_inputs[videoInputSelected].standards;
if (!standards) {
enumVals.push("NONE");
addSchemaElements.options = { "hidden": true };
} else {
enumVals = standards;
}
if (enumVals.length > 0) {
if (deviceSelected === configuredDevice) {
var configuredStandard = window.serverConfig.grabberV4L2.standard;
if ($.inArray(configuredStandard, enumVals) != -1) {
enumDefaultVal = configuredStandard;
}
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'standard', addSchemaElements, enumVals, [], enumDefaultVal, false);
}
if (!window.readOnlyMode) {
$('#btn_submit_v4l2').attr('disabled', false);
}
});
conf_editor_v4l2.watch('root.grabberV4L2.encoding', () => {
var deviceSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.available_devices").getValue();
var videoInputSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.device_inputs").getValue();
var formatSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.encoding").getValue();
//Update hidden input element
conf_editor_v4l2.getEditor("root.grabberV4L2.input").setValue(parseInt(videoInputSelected));
var addSchemaElements = {};
var enumVals = [];
var enumTitelVals = [];
var enumDefaultVal = "";
var deviceProperties = getPropertiesOfDevice(deviceSelected);
var formats = deviceProperties.video_inputs[videoInputSelected].formats;
var formatIdx = 0;
if (formatSelected !== "NONE") {
formatIdx = formats.findIndex(x => x.format === formatSelected);
}
var resolutions = formats[formatIdx].resolutions;
if (resolutions.length <= 1) {
addSchemaElements.access = "expert";
} else {
resolutions.sort(compareTwoValues('width', 'height', 'asc'));
}
for (var i = 0; i < resolutions.length; i++) {
enumVals.push(i);
var resolutionText = resolutions[i].width + "x" + resolutions[i].height;
enumTitelVals.push(resolutionText);
}
if (enumVals.length > 0) {
if (deviceSelected === configuredDevice) {
var configuredResolutionText = window.serverConfig.grabberV4L2.width + "x" + window.serverConfig.grabberV4L2.height;
var idx = $.inArray(configuredResolutionText, enumTitelVals)
if (idx != -1) {
enumDefaultVal = idx;
}
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'resolutions', addSchemaElements, enumVals, enumTitelVals, enumDefaultVal, false);
}
if (!window.readOnlyMode) {
$('#btn_submit_v4l2').attr('disabled', false);
}
});
conf_editor_v4l2.watch('root.grabberV4L2.resolutions', () => {
var deviceSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.available_devices").getValue();
var videoInputSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.device_inputs").getValue();
var formatSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.encoding").getValue();
var resolutionSelected = conf_editor_v4l2.getEditor("root.grabberV4L2.resolutions").getValue();
var addSchemaElements = {};
var enumVals = [];
var enumDefaultVal = "";
var deviceProperties = getPropertiesOfDevice(deviceSelected);
var formats = deviceProperties.video_inputs[videoInputSelected].formats;
var formatIdx = 0;
if (formatSelected !== "NONE") {
formatIdx = formats.findIndex(x => x.format === formatSelected);
}
//Update hidden resolution related elements
var width = parseInt(formats[formatIdx].resolutions[resolutionSelected].width);
conf_editor_v4l2.getEditor("root.grabberV4L2.width").setValue(width);
var height = parseInt(formats[formatIdx].resolutions[resolutionSelected].height);
conf_editor_v4l2.getEditor("root.grabberV4L2.height").setValue(height);
var fps = formats[formatIdx].resolutions[resolutionSelected].fps;
if (!fps) {
enumVals.push("NONE");
addSchemaElements.options = { "hidden": true };
} else {
fps.sort((a, b) => a - b);
for (var i = 0; i < fps.length; i++) {
enumVals.push(fps[i]);
}
}
if (enumVals.length <= 1) {
addSchemaElements.access = "expert";
}
if (enumVals.length > 0) {
if (deviceSelected === configuredDevice) {
var configuredFps = window.serverConfig.grabberV4L2.fps;
if ($.inArray(configuredFps, enumVals) != -1) {
enumDefaultVal = configuredFps;
}
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'framerates', addSchemaElements, enumVals, [], enumDefaultVal, false);
}
if (!window.readOnlyMode) {
$('#btn_submit_v4l2').attr('disabled', false);
}
});
conf_editor_v4l2.watch('root.grabberV4L2.framerates', () => {
//Update hidden fps element
var fps = 0;
var framerates = conf_editor_v4l2.getEditor("root.grabberV4L2.framerates").getValue();
if (framerates !== "NONE") {
fps = parseInt(framerates);
}
//Show Frameskipping only when more than 2 fps
if (fps > 2) {
$('[data-schemapath*="root.grabberV4L2.fpsSoftwareDecimation').toggle(true);
}
else {
$('[data-schemapath*="root.grabberV4L2.fpsSoftwareDecimation').toggle(false);
}
conf_editor_v4l2.getEditor("root.grabberV4L2.fps").setValue(fps);
});
$('#btn_submit_v4l2').off().on('click', function () {
var v4l2Options = conf_editor_v4l2.getValue();
requestWriteConfig(v4l2Options);
});
}
//////////////////////////////////////////////////
//create introduction
if (window.showOptHelp) {
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
if (VIDEOGRABBER_AVAIL) {
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
}
}
removeOverlay();
// build dynamic enum
var updateVideoSourcesList = function (type, discoveryInfo) {
var enumVals = [];
var enumTitelVals = [];
var enumDefaultVal = "";
if (jQuery.isEmptyObject(discoveryInfo)) {
enumVals.push("NONE");
enumTitelVals.push($.i18n('edt_conf_grabber_discovered_none'));
conf_editor_v4l2.getEditor('root.grabberV4L2').disable();
}
else {
for (const device of discoveryInfo) {
enumVals.push(device.device_name);
}
conf_editor_v4l2.getEditor('root.grabberV4L2').enable();
}
if (enumVals.length > 0) {
configuredDevice = window.serverConfig.grabberV4L2.available_devices;
if ($.inArray(configuredDevice, enumVals) != -1) {
enumDefaultVal = configuredDevice;
}
updateJsonEditorSelection(conf_editor_v4l2.getEditor('root.grabberV4L2'),
'available_devices', {}, enumVals, enumTitelVals, enumDefaultVal, false);
}
}
async function discoverInputSources(type, params) {
const result = await requestInputSourcesDiscovery(type, params);
var discoveryResult;
if (result && !result.error) {
discoveryResult = result.info;
}
else {
discoveryResult = {
"video_sources": []
}
}
discoveredInputSources = discoveryResult.video_sources;
updateVideoSourcesList(type, discoveredInputSources);
}
function getPropertiesOfDevice(deviceName) {
deviceProperties = {};
for (const deviceRecord of discoveredInputSources) {
if (deviceRecord.device_name === deviceName) {
deviceProperties = deviceRecord;
break;
}
}
return deviceProperties;
}
});

View File

@ -35,35 +35,35 @@ tokenList = {};
function initRestart() function initRestart()
{ {
$(window.hyperion).off(); $(window.hyperion).off();
requestServerConfigReload(); requestServerConfigReload();
window.watchdog = 10; window.watchdog = 10;
connectionLostDetection('restart'); connectionLostDetection('restart');
} }
function connectionLostDetection(type) function connectionLostDetection(type)
{ {
if ( window.watchdog > 2 ) if ( window.watchdog > 2 )
{ {
var interval_id = window.setInterval(function(){clearInterval(interval_id);}, 9999); // Get a reference to the last var interval_id = window.setInterval(function(){clearInterval(interval_id);}, 9999); // Get a reference to the last
for (var i = 1; i < interval_id; i++) for (var i = 1; i < interval_id; i++)
window.clearInterval(i); window.clearInterval(i);
if(type == 'restart') if(type == 'restart')
{ {
$("body").html($("#container_restart").html()); $("body").html($("#container_restart").html());
// setTimeout delay for probably slower systems, some browser don't execute THIS action // setTimeout delay for probably slower systems, some browser don't execute THIS action
setTimeout(restartAction,250); setTimeout(restartAction,250);
} }
else else
{ {
$("body").html($("#container_connection_lost").html()); $("body").html($("#container_connection_lost").html());
connectionLostAction(); connectionLostAction();
} }
} }
else else
{ {
$.get( "/cgi/cfg_jsonserver", function() {window.watchdog=0}).fail(function() {window.watchdog++;}); $.get( "/cgi/cfg_jsonserver", function() {window.watchdog=0}).fail(function() {window.watchdog++;});
} }
} }
setInterval(connectionLostDetection, 3000); setInterval(connectionLostDetection, 3000);
@ -72,107 +72,107 @@ setInterval(connectionLostDetection, 3000);
function initWebSocket() function initWebSocket()
{ {
if ("WebSocket" in window) if ("WebSocket" in window)
{ {
if (window.websocket == null) if (window.websocket == null)
{ {
window.jsonPort = ''; window.jsonPort = '';
if(document.location.port == '' && document.location.protocol == "http:") if(document.location.port == '' && document.location.protocol == "http:")
window.jsonPort = '80'; window.jsonPort = '80';
else if (document.location.port == '' && document.location.protocol == "https:") else if (document.location.port == '' && document.location.protocol == "https:")
window.jsonPort = '443'; window.jsonPort = '443';
else else
window.jsonPort = document.location.port; window.jsonPort = document.location.port;
window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://'+document.location.hostname+":"+window.jsonPort) : new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort); window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://'+document.location.hostname+":"+window.jsonPort) : new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort);
window.websocket.onopen = function (event) { window.websocket.onopen = function (event) {
$(window.hyperion).trigger({type:"open"}); $(window.hyperion).trigger({type:"open"});
$(window.hyperion).on("cmd-serverinfo", function(event) { $(window.hyperion).on("cmd-serverinfo", function(event) {
window.watchdog = 0; window.watchdog = 0;
}); });
}; };
window.websocket.onclose = function (event) { window.websocket.onclose = function (event) {
// See http://tools.ietf.org/html/rfc6455#section-7.4.1 // See http://tools.ietf.org/html/rfc6455#section-7.4.1
var reason; var reason;
switch(event.code) switch(event.code)
{ {
case 1000: reason = "Normal closure, meaning that the purpose for which the connection was established has been fulfilled."; break; case 1000: reason = "Normal closure, meaning that the purpose for which the connection was established has been fulfilled."; break;
case 1001: reason = "An endpoint is \"going away\", such as a server going down or a browser having navigated away from a page."; break; case 1001: reason = "An endpoint is \"going away\", such as a server going down or a browser having navigated away from a page."; break;
case 1002: reason = "An endpoint is terminating the connection due to a protocol error"; break; case 1002: reason = "An endpoint is terminating the connection due to a protocol error"; break;
case 1003: reason = "An endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message)."; break; case 1003: reason = "An endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message)."; break;
case 1004: reason = "Reserved. The specific meaning might be defined in the future."; break; case 1004: reason = "Reserved. The specific meaning might be defined in the future."; break;
case 1005: reason = "No status code was actually present."; break; case 1005: reason = "No status code was actually present."; break;
case 1006: reason = "The connection was closed abnormally, e.g., without sending or receiving a Close control frame"; break; case 1006: reason = "The connection was closed abnormally, e.g., without sending or receiving a Close control frame"; break;
case 1007: reason = "An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629] data within a text message)."; break; case 1007: reason = "An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629] data within a text message)."; break;
case 1008: reason = "An endpoint is terminating the connection because it has received a message that \"violates its policy\". This reason is given either if there is no other sutible reason, or if there is a need to hide specific details about the policy."; break; case 1008: reason = "An endpoint is terminating the connection because it has received a message that \"violates its policy\". This reason is given either if there is no other sutible reason, or if there is a need to hide specific details about the policy."; break;
case 1009: reason = "An endpoint is terminating the connection because it has received a message that is too big for it to process."; break; case 1009: reason = "An endpoint is terminating the connection because it has received a message that is too big for it to process."; break;
case 1010: reason = "An endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. <br /> Specifically, the extensions that are needed are: " + event.reason; break; case 1010: reason = "An endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. <br /> Specifically, the extensions that are needed are: " + event.reason; break;
case 1011: reason = "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."; break; case 1011: reason = "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."; break;
case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break; case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break;
default: reason = "Unknown reason"; default: reason = "Unknown reason";
} }
$(window.hyperion).trigger({type:"close", reason:reason}); $(window.hyperion).trigger({type:"close", reason:reason});
window.watchdog = 10; window.watchdog = 10;
connectionLostDetection(); connectionLostDetection();
}; };
window.websocket.onmessage = function (event) { window.websocket.onmessage = function (event) {
try try
{ {
var response = JSON.parse(event.data); var response = JSON.parse(event.data);
var success = response.success; var success = response.success;
var cmd = response.command; var cmd = response.command;
var tan = response.tan var tan = response.tan
if (success || typeof(success) == "undefined") if (success || typeof(success) == "undefined")
{ {
$(window.hyperion).trigger({type:"cmd-"+cmd, response:response}); $(window.hyperion).trigger({type:"cmd-"+cmd, response:response});
} }
else else
{ {
// skip tan -1 error handling // skip tan -1 error handling
if(tan != -1){ if(tan != -1){
var error = response.hasOwnProperty("error")? response.error : "unknown"; var error = response.hasOwnProperty("error")? response.error : "unknown";
$(window.hyperion).trigger({type:"error",reason:error}); $(window.hyperion).trigger({type:"error",reason:error});
console.log("[window.websocket::onmessage] ",error) console.log("[window.websocket::onmessage] ",error)
} }
} }
} }
catch(exception_error) catch(exception_error)
{ {
$(window.hyperion).trigger({type:"error",reason:exception_error}); $(window.hyperion).trigger({type:"error",reason:exception_error});
console.log("[window.websocket::onmessage] ",exception_error) console.log("[window.websocket::onmessage] ",exception_error)
} }
}; };
window.websocket.onerror = function (error) { window.websocket.onerror = function (error) {
$(window.hyperion).trigger({type:"error",reason:error}); $(window.hyperion).trigger({type:"error",reason:error});
console.log("[window.websocket::onerror] ",error) console.log("[window.websocket::onerror] ",error)
}; };
} }
} }
else else
{ {
$(window.hyperion).trigger("error"); $(window.hyperion).trigger("error");
alert("Websocket is not supported by your browser"); alert("Websocket is not supported by your browser");
return; return;
} }
} }
function sendToHyperion(command, subcommand, msg) function sendToHyperion(command, subcommand, msg)
{ {
if (typeof subcommand != 'undefined' && subcommand.length > 0) if (typeof subcommand != 'undefined' && subcommand.length > 0)
subcommand = ',"subcommand":"'+subcommand+'"'; subcommand = ',"subcommand":"'+subcommand+'"';
else else
subcommand = ""; subcommand = "";
if (typeof msg != 'undefined' && msg.length > 0) if (typeof msg != 'undefined' && msg.length > 0)
msg = ","+msg; msg = ","+msg;
else else
msg = ""; msg = "";
window.websocket.send('{"command":"'+command+'", "tan":'+window.wsTan+subcommand+msg+'}'); window.websocket.send('{"command":"'+command+'", "tan":'+window.wsTan+subcommand+msg+'}');
} }
// Send a json message to Hyperion and wait for a matching response // Send a json message to Hyperion and wait for a matching response
@ -228,250 +228,256 @@ async function __sendAsync (data) {
// Test if admin requires authentication // Test if admin requires authentication
function requestRequiresAdminAuth() function requestRequiresAdminAuth()
{ {
sendToHyperion("authorize","adminRequired"); sendToHyperion("authorize","adminRequired");
} }
// Test if the default password needs to be changed // Test if the default password needs to be changed
function requestRequiresDefaultPasswortChange() function requestRequiresDefaultPasswortChange()
{ {
sendToHyperion("authorize","newPasswordRequired"); sendToHyperion("authorize","newPasswordRequired");
} }
// Change password // Change password
function requestChangePassword(oldPw, newPw) function requestChangePassword(oldPw, newPw)
{ {
sendToHyperion("authorize","newPassword",'"password": "'+oldPw+'", "newPassword":"'+newPw+'"'); sendToHyperion("authorize","newPassword",'"password": "'+oldPw+'", "newPassword":"'+newPw+'"');
} }
function requestAuthorization(password) function requestAuthorization(password)
{ {
sendToHyperion("authorize","login",'"password": "' + password + '"'); sendToHyperion("authorize","login",'"password": "' + password + '"');
} }
function requestTokenAuthorization(token) function requestTokenAuthorization(token)
{ {
sendToHyperion("authorize","login",'"token": "' + token + '"'); sendToHyperion("authorize","login",'"token": "' + token + '"');
} }
function requestToken(comment) function requestToken(comment)
{ {
sendToHyperion("authorize","createToken",'"comment": "'+comment+'"'); sendToHyperion("authorize","createToken",'"comment": "'+comment+'"');
} }
function requestTokenInfo() function requestTokenInfo()
{ {
sendToHyperion("authorize","getTokenList",""); sendToHyperion("authorize","getTokenList","");
} }
function requestGetPendingTokenRequests (id, state) { function requestGetPendingTokenRequests (id, state) {
sendToHyperion("authorize", "getPendingTokenRequests", ""); sendToHyperion("authorize", "getPendingTokenRequests", "");
} }
function requestHandleTokenRequest(id, state) function requestHandleTokenRequest(id, state)
{ {
sendToHyperion("authorize","answerRequest",'"id":"'+id+'", "accept":'+state); sendToHyperion("authorize","answerRequest",'"id":"'+id+'", "accept":'+state);
} }
function requestTokenDelete(id) function requestTokenDelete(id)
{ {
sendToHyperion("authorize","deleteToken",'"id":"'+id+'"'); sendToHyperion("authorize","deleteToken",'"id":"'+id+'"');
} }
function requestInstanceRename(inst, name) function requestInstanceRename(inst, name)
{ {
sendToHyperion("instance", "saveName",'"instance": '+inst+', "name": "'+name+'"'); sendToHyperion("instance", "saveName",'"instance": '+inst+', "name": "'+name+'"');
} }
function requestInstanceStartStop(inst, start) function requestInstanceStartStop(inst, start)
{ {
if(start) if(start)
sendToHyperion("instance","startInstance",'"instance": '+inst); sendToHyperion("instance","startInstance",'"instance": '+inst);
else else
sendToHyperion("instance","stopInstance",'"instance": '+inst); sendToHyperion("instance","stopInstance",'"instance": '+inst);
} }
function requestInstanceDelete(inst) function requestInstanceDelete(inst)
{ {
sendToHyperion("instance","deleteInstance",'"instance": '+inst); sendToHyperion("instance","deleteInstance",'"instance": '+inst);
} }
function requestInstanceCreate(name) function requestInstanceCreate(name)
{ {
sendToHyperion("instance","createInstance",'"name": "'+name+'"'); sendToHyperion("instance","createInstance",'"name": "'+name+'"');
} }
function requestInstanceSwitch(inst) function requestInstanceSwitch(inst)
{ {
sendToHyperion("instance","switchTo",'"instance": '+inst); sendToHyperion("instance","switchTo",'"instance": '+inst);
} }
function requestServerInfo() function requestServerInfo()
{ {
sendToHyperion("serverinfo","",'"subscribe":["components-update","sessions-update","priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]'); sendToHyperion("serverinfo","",'"subscribe":["components-update","sessions-update","priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]');
} }
function requestSysInfo() function requestSysInfo()
{ {
sendToHyperion("sysinfo"); sendToHyperion("sysinfo");
} }
function requestServerConfigSchema() function requestServerConfigSchema()
{ {
sendToHyperion("config","getschema"); sendToHyperion("config","getschema");
} }
function requestServerConfig() function requestServerConfig()
{ {
sendToHyperion("config", "getconfig"); sendToHyperion("config", "getconfig");
} }
function requestServerConfigReload() function requestServerConfigReload()
{ {
sendToHyperion("config", "reload"); sendToHyperion("config", "reload");
} }
function requestLedColorsStart() function requestLedColorsStart()
{ {
window.ledStreamActive=true; window.ledStreamActive=true;
sendToHyperion("ledcolors", "ledstream-start"); sendToHyperion("ledcolors", "ledstream-start");
} }
function requestLedColorsStop() function requestLedColorsStop()
{ {
window.ledStreamActive=false; window.ledStreamActive=false;
sendToHyperion("ledcolors", "ledstream-stop"); sendToHyperion("ledcolors", "ledstream-stop");
} }
function requestLedImageStart() function requestLedImageStart()
{ {
window.imageStreamActive=true; window.imageStreamActive=true;
sendToHyperion("ledcolors", "imagestream-start"); sendToHyperion("ledcolors", "imagestream-start");
} }
function requestLedImageStop() function requestLedImageStop()
{ {
window.imageStreamActive=false; window.imageStreamActive=false;
sendToHyperion("ledcolors", "imagestream-stop"); sendToHyperion("ledcolors", "imagestream-stop");
} }
function requestPriorityClear(prio) function requestPriorityClear(prio)
{ {
if(typeof prio !== 'number') if(typeof prio !== 'number')
prio = window.webPrio; prio = window.webPrio;
sendToHyperion("clear", "", '"priority":'+prio+''); sendToHyperion("clear", "", '"priority":'+prio+'');
} }
function requestClearAll() function requestClearAll()
{ {
requestPriorityClear(-1) requestPriorityClear(-1)
} }
function requestPlayEffect(effectName, duration) function requestPlayEffect(effectName, duration)
{ {
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"'); sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
} }
function requestSetColor(r,g,b,duration) function requestSetColor(r,g,b,duration)
{ {
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"'); sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
} }
function requestSetImage(data,duration,name) function requestSetImage(data,duration,name)
{ {
sendToHyperion("image", "", '"imagedata":"'+data+'", "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+', "format":"auto", "origin":"'+window.webOrigin+'", "name":"'+name+'"'); sendToHyperion("image", "", '"imagedata":"'+data+'", "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+', "format":"auto", "origin":"'+window.webOrigin+'", "name":"'+name+'"');
} }
function requestSetComponentState(comp, state) function requestSetComponentState(comp, state)
{ {
var state_str = state ? "true" : "false"; var state_str = state ? "true" : "false";
sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}'); sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}');
} }
function requestSetSource(prio) function requestSetSource(prio)
{ {
if ( prio == "auto" ) if ( prio == "auto" )
sendToHyperion("sourceselect", "", '"auto":true'); sendToHyperion("sourceselect", "", '"auto":true');
else else
sendToHyperion("sourceselect", "", '"priority":'+prio); sendToHyperion("sourceselect", "", '"priority":'+prio);
} }
function requestWriteConfig(config, full) function requestWriteConfig(config, full)
{ {
if(full === true) if(full === true)
window.serverConfig = config; window.serverConfig = config;
else else
{ {
jQuery.each(config, function(i, val) { jQuery.each(config, function(i, val) {
window.serverConfig[i] = val; window.serverConfig[i] = val;
}); });
} }
sendToHyperion("config","setconfig", '"config":'+JSON.stringify(window.serverConfig)); sendToHyperion("config","setconfig", '"config":'+JSON.stringify(window.serverConfig));
} }
function requestWriteEffect(effectName,effectPy,effectArgs,data) function requestWriteEffect(effectName,effectPy,effectArgs,data)
{ {
var cutArgs = effectArgs.slice(1, -1); var cutArgs = effectArgs.slice(1, -1);
sendToHyperion("create-effect", "", '"name":"'+effectName+'", "script":"'+effectPy+'", '+cutArgs+',"imageData":"'+data+'"'); sendToHyperion("create-effect", "", '"name":"'+effectName+'", "script":"'+effectPy+'", '+cutArgs+',"imageData":"'+data+'"');
} }
function requestTestEffect(effectName,effectPy,effectArgs,data) function requestTestEffect(effectName,effectPy,effectArgs,data)
{ {
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+window.webPrio+', "origin":"'+window.webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"'); sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+window.webPrio+', "origin":"'+window.webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"');
} }
function requestDeleteEffect(effectName) function requestDeleteEffect(effectName)
{ {
sendToHyperion("delete-effect", "", '"name":"'+effectName+'"'); sendToHyperion("delete-effect", "", '"name":"'+effectName+'"');
} }
function requestLoggingStart() function requestLoggingStart()
{ {
window.loggingStreamActive=true; window.loggingStreamActive=true;
sendToHyperion("logging", "start"); sendToHyperion("logging", "start");
} }
function requestLoggingStop() function requestLoggingStop()
{ {
window.loggingStreamActive=false; window.loggingStreamActive=false;
sendToHyperion("logging", "stop"); sendToHyperion("logging", "stop");
} }
function requestMappingType(type) function requestMappingType(type)
{ {
sendToHyperion("processing", "", '"mappingType": "'+type+'"'); sendToHyperion("processing", "", '"mappingType": "'+type+'"');
} }
function requestVideoMode(newMode) function requestVideoMode(newMode)
{ {
sendToHyperion("videomode", "", '"videoMode": "'+newMode+'"'); sendToHyperion("videomode", "", '"videoMode": "'+newMode+'"');
} }
function requestAdjustment(type, value, complete) function requestAdjustment(type, value, complete)
{ {
if(complete === true) if(complete === true)
sendToHyperion("adjustment", "", '"adjustment": '+type+''); sendToHyperion("adjustment", "", '"adjustment": '+type+'');
else else
sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}'); sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}');
} }
async function requestLedDeviceDiscovery(type, params) async function requestLedDeviceDiscovery(type, params)
{ {
let data = { ledDeviceType: type, params: params }; let data = { ledDeviceType: type, params: params };
return sendAsyncToHyperion("leddevice", "discover", data, Math.floor(Math.random() * 1000) ); return sendAsyncToHyperion("leddevice", "discover", data, Math.floor(Math.random() * 1000) );
} }
async function requestLedDeviceProperties(type, params) async function requestLedDeviceProperties(type, params)
{ {
let data = { ledDeviceType: type, params: params }; let data = { ledDeviceType: type, params: params };
return sendAsyncToHyperion("leddevice", "getProperties", data, Math.floor(Math.random() * 1000)); return sendAsyncToHyperion("leddevice", "getProperties", data, Math.floor(Math.random() * 1000));
} }
function requestLedDeviceIdentification(type, params) function requestLedDeviceIdentification(type, params)
{ {
//sendToHyperion("leddevice", "identify", '"ledDeviceType": "'+type+'","params": '+JSON.stringify(params)+'');
let data = { ledDeviceType: type, params: params }; let data = { ledDeviceType: type, params: params };
return sendAsyncToHyperion("leddevice", "identify", data, Math.floor(Math.random() * 1000));
return sendAsyncToHyperion("leddevice", "identify", data, Math.floor(Math.random() * 1000));
}
async function requestInputSourcesDiscovery(type, params) {
let data = { sourceType: type, params: params };
return sendAsyncToHyperion("inputsource", "discover", data, Math.floor(Math.random() * 1000));
} }

File diff suppressed because it is too large Load Diff

View File

@ -278,6 +278,12 @@ private:
/// ///
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan); void handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON message regarding Input Sources (Grabbers)
///
/// @param message the incoming message
///
void handleInputSourceCommand(const QJsonObject& message, const QString& command, int tan);
/// ///
/// Handle an incoming JSON message of unknown type /// Handle an incoming JSON message of unknown type
/// ///

View File

@ -0,0 +1,28 @@
{
"type":"object",
"required":true,
"properties": {
"command": {
"type": "string",
"required": true,
"enum": [ "inputsource" ]
},
"tan": {
"type": "integer"
},
"subcommand": {
"type": "string",
"required": true,
"enum": [ "discover", "getProperties" ]
},
"sourceType": {
"type": "string",
"required": true
},
"params": {
"type": "object",
"required": false
}
},
"additionalProperties": false
}

View File

@ -5,7 +5,7 @@
"command": { "command": {
"type" : "string", "type" : "string",
"required" : true, "required" : true,
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "authorize", "instance", "leddevice", "transform", "correction" , "temperature"] "enum": [ "color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "authorize", "instance", "leddevice", "inputsource", "transform", "correction", "temperature" ]
} }
} }
} }

View File

@ -20,7 +20,8 @@
<file alias="schema-videomode">JSONRPC_schema/schema-videomode.json</file> <file alias="schema-videomode">JSONRPC_schema/schema-videomode.json</file>
<file alias="schema-authorize">JSONRPC_schema/schema-authorize.json</file> <file alias="schema-authorize">JSONRPC_schema/schema-authorize.json</file>
<file alias="schema-instance">JSONRPC_schema/schema-instance.json</file> <file alias="schema-instance">JSONRPC_schema/schema-instance.json</file>
<file alias="schema-leddevice">JSONRPC_schema/schema-leddevice.json</file> <file alias="schema-leddevice">JSONRPC_schema/schema-leddevice.json</file>
<file alias="schema-inputsource">JSONRPC_schema/schema-inputsource.json</file>
<!-- The following schemas are derecated but used to ensure backward compatibility with hyperion Classic remote control--> <!-- The following schemas are derecated but used to ensure backward compatibility with hyperion Classic remote control-->
<file alias="schema-transform">JSONRPC_schema/schema-hyperion-classic.json</file> <file alias="schema-transform">JSONRPC_schema/schema-hyperion-classic.json</file>
<file alias="schema-correction">JSONRPC_schema/schema-hyperion-classic.json</file> <file alias="schema-correction">JSONRPC_schema/schema-hyperion-classic.json</file>

View File

@ -174,6 +174,8 @@ proceed:
handleInstanceCommand(message, command, tan); handleInstanceCommand(message, command, tan);
else if (command == "leddevice") else if (command == "leddevice")
handleLedDeviceCommand(message, command, tan); handleLedDeviceCommand(message, command, tan);
else if (command == "inputsource")
handleInputSourceCommand(message, command, tan);
// BEGIN | The following commands are deprecated but used to ensure backward compatibility with hyperion Classic remote control // BEGIN | The following commands are deprecated but used to ensure backward compatibility with hyperion Classic remote control
else if (command == "clearall") else if (command == "clearall")
@ -487,75 +489,6 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
availableGrabbers.append(grabber); availableGrabbers.append(grabber);
} }
#endif
#if defined(ENABLE_V4L2) || defined(ENABLE_MF)
QJsonArray availableDevices;
for (const auto& devicePath : GrabberWrapper::getInstance()->getDevices())
{
QJsonObject device;
device["device"] = devicePath;
device["device_name"] = GrabberWrapper::getInstance()->getDeviceName(devicePath);
device["type"] = "v4l2";
QJsonArray video_inputs;
QMultiMap<QString, int> inputs = GrabberWrapper::getInstance()->getDeviceInputs(devicePath);
for (auto input = inputs.begin(); input != inputs.end(); input++)
{
QJsonObject in;
in["name"] = input.key();
in["inputIdx"] = input.value();
QJsonArray standards;
QList<VideoStandard> videoStandards = GrabberWrapper::getInstance()->getAvailableDeviceStandards(devicePath, input.value());
for (auto standard : videoStandards)
{
standards.append(VideoStandard2String(standard));
}
QJsonArray formats;
QStringList encodingFormats = GrabberWrapper::getInstance()->getAvailableEncodingFormats(devicePath, input.value());
for (auto encodingFormat : encodingFormats)
{
QJsonObject format;
format["format"] = encodingFormat;
QJsonArray resolutionArray;
QMultiMap<int, int> deviceResolutions = GrabberWrapper::getInstance()->getAvailableDeviceResolutions(devicePath, input.value(), parsePixelFormat(encodingFormat));
for (auto width_height = deviceResolutions.begin(); width_height != deviceResolutions.end(); width_height++)
{
QJsonObject resolution;
resolution["width"] = width_height.key();
resolution["height"] = width_height.value();
QJsonArray fps;
QIntList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value());
for (auto framerate : framerates)
{
fps.append(framerate);
}
resolution["fps"] = fps;
resolutionArray.append(resolution);
}
format["resolutions"] = resolutionArray;
formats.append(format);
}
in["standards"] = standards;
in["formats"] = formats;
video_inputs.append(in);
}
device["video_inputs"] = video_inputs;
availableDevices.append(device);
}
grabbers["video_sources"] = availableDevices;
#endif #endif
grabbers["available"] = availableGrabbers; grabbers["available"] = availableGrabbers;
@ -1485,6 +1418,117 @@ void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &
} }
} }
void JsonAPI::handleInputSourceCommand(const QJsonObject& message, const QString& command, int tan)
{
Debug(_log, "message: [%s]", QString(QJsonDocument(message).toJson(QJsonDocument::Compact)).toUtf8().constData());
const QString& subc = message["subcommand"].toString().trimmed();
const QString& sourceType = message["sourceType"].toString().trimmed();
QString full_command = command + "-" + subc;
// TODO: Validate that source type is a valid one
/* if ( ! valid type )
{
sendErrorReply("Unknown device", full_command, tan);
}
else
*/ {
if (subc == "discover")
{
QJsonObject inputSourcesDiscovered;
inputSourcesDiscovered.insert("sourceType", sourceType);
QJsonArray videoInputs;
#if defined(ENABLE_V4L2) || defined(ENABLE_MF)
if (sourceType == "video" )
{
//for (const auto& instance : GrabberWrapper::getInstance()->getDevices())
//{
for (const auto& devicePath : GrabberWrapper::getInstance()->getDevices())
{
QJsonObject device;
device["device"] = devicePath;
device["device_name"] = GrabberWrapper::getInstance()->getDeviceName(devicePath);
device["type"] = "v4l2";
QJsonArray video_inputs;
QMultiMap<QString, int> inputs = GrabberWrapper::getInstance()->getDeviceInputs(devicePath);
for (auto input = inputs.begin(); input != inputs.end(); input++)
{
QJsonObject in;
in["name"] = input.key();
in["inputIdx"] = input.value();
QJsonArray standards;
QList<VideoStandard> videoStandards = GrabberWrapper::getInstance()->getAvailableDeviceStandards(devicePath, input.value());
for (auto standard : videoStandards)
{
standards.append(VideoStandard2String(standard));
}
if (!standards.isEmpty())
{
in["standards"] = standards;
}
QJsonArray formats;
QStringList encodingFormats = GrabberWrapper::getInstance()->getAvailableEncodingFormats(devicePath, input.value());
for (auto encodingFormat : encodingFormats)
{
QJsonObject format;
format["format"] = encodingFormat;
QJsonArray resolutionArray;
QMultiMap<int, int> deviceResolutions = GrabberWrapper::getInstance()->getAvailableDeviceResolutions(devicePath, input.value(), parsePixelFormat(encodingFormat));
for (auto width_height = deviceResolutions.begin(); width_height != deviceResolutions.end(); width_height++)
{
QJsonObject resolution;
resolution["width"] = width_height.key();
resolution["height"] = width_height.value();
QJsonArray fps;
QIntList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value());
for (auto framerate : framerates)
{
fps.append(framerate);
}
resolution["fps"] = fps;
resolutionArray.append(resolution);
}
format["resolutions"] = resolutionArray;
formats.append(format);
}
in["formats"] = formats;
video_inputs.append(in);
}
device["video_inputs"] = video_inputs;
videoInputs.append(device);
}
}
#endif
inputSourcesDiscovered["video_sources"] = videoInputs;
Debug(_log, "response: [%s]", QString(QJsonDocument(inputSourcesDiscovered).toJson(QJsonDocument::Compact)).toUtf8().constData());
sendSuccessDataReply(QJsonDocument(inputSourcesDiscovered), full_command, tan);
}
else
{
sendErrorReply("Unknown or missing subcommand", full_command, tan);
}
}
}
void JsonAPI::handleNotImplemented(const QString &command, int tan) void JsonAPI::handleNotImplemented(const QString &command, int tan)
{ {
sendErrorReply("Command not implemented", command, tan); sendErrorReply("Command not implemented", command, tan);

View File

@ -234,5 +234,18 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
Debug(_log,"LED Layout migrated"); Debug(_log,"LED Layout migrated");
} }
} }
if (config.contains("grabberV4L2"))
{
QJsonObject newGrabberV4L2Config = config["grabberV4L2"].toObject();
if (newGrabberV4L2Config.contains("encoding_format"))
{
newGrabberV4L2Config.remove("encoding_format");
config["grabberV4L2"] = newGrabberV4L2Config;
migrated = true;
Debug(_log, "GrabberV4L2 Layout migrated");
}
}
return migrated; return migrated;
} }

View File

@ -2,345 +2,350 @@
"type" : "object", "type" : "object",
"required" : true, "required" : true,
"title" : "edt_conf_v4l2_heading_title", "title" : "edt_conf_v4l2_heading_title",
"properties" : "properties": {
{ "available_devices": {
"device" : "type": "string",
{ "title": "edt_conf_v4l2_device_title",
"type" : "string", "propertyOrder": 1,
"title" : "edt_conf_enum_custom", "required": true
"default" : "auto", },
"options" : { "device": {
"hidden":true "type": "string",
"title": "edt_conf_enum_custom",
"options": {
"hidden": true
}, },
"required" : true, "required": true,
"propertyOrder" : 2, "comment": "The 'available_devices' settings are dynamically inserted into the WebUI under PropertyOrder '1'.",
"comment" : "The 'available_devices' settings are dynamically inserted into the WebUI under PropertyOrder '1'." "propertyOrder": 2
}, },
"input" : "device_inputs": {
{ "type": "string",
"type" : "integer", "title": "edt_conf_v4l2_input_title",
"title" : "edt_conf_enum_custom", "propertyOrder": 3,
"default" : 0, "required": true
"options" : { },
"hidden":true "input": {
"type": "integer",
"title": "edt_conf_enum_custom",
"default": 0,
"options": {
"hidden": true
}, },
"required" : true, "required": true,
"propertyOrder" : 4, "propertyOrder": 4,
"comment" : "The 'device_inputs' settings are dynamically inserted into the WebUI under PropertyOrder '3'." "comment": "The 'device_inputs' settings are dynamically inserted into the WebUI under PropertyOrder '3'."
}, },
"encoding" :
{ "standard": {
"type" : "string", "type": "string",
"title" : "edt_conf_enum_custom", "title": "edt_conf_v4l2_standard_title",
"default" : "auto", "default": "auto",
"options" : { "required": true,
"hidden":true "propertyOrder": 5
},
"encoding": {
"type": "string",
"title": "edt_conf_v4l2_encoding_title",
"default": "auto",
"required": true,
"propertyOrder": 6
},
"resolutions": {
"type": "string",
"title": "edt_conf_v4l2_resolution_title",
"propertyOrder": 7,
"required": true
},
"width": {
"type": "integer",
"title": "edt_conf_fg_width_title",
"default": 0,
"minimum": 0,
"append": "edt_append_pixel",
"options": {
"hidden": true
}, },
"required" : true, "required": true,
"propertyOrder" : 6, "propertyOrder": 8,
"comment" : "The 'device_encodings' settings are dynamically inserted into the WebUI under PropertyOrder '5'." "comment": "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '7'."
}, },
"standard" : "height": {
{ "type": "integer",
"type" : "string", "title": "edt_conf_fg_height_title",
"title" : "edt_conf_v4l2_standard_title", "default": 0,
"enum" : ["NO_CHANGE", "PAL","NTSC","SECAM"], "minimum": 0,
"default" : "NO_CHANGE", "append": "edt_append_pixel",
"options" : { "options": {
"enum_titles" : ["edt_conf_enum_NO_CHANGE", "edt_conf_enum_PAL", "edt_conf_enum_NTSC", "edt_conf_enum_SECAM"] "hidden": true
}, },
"required" : true, "required": true,
"propertyOrder" : 7 "propertyOrder": 9,
"comment": "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '7'."
}, },
"flip" : "framerates": {
{ "type": "string",
"type" : "string", "title": "edt_conf_v4l2_framerate_title",
"title" : "edt_conf_v4l2_flip_title", "propertyOrder": 10,
"enum" : ["NO_CHANGE", "HORIZONTAL","VERTICAL","BOTH"], "required": true
"default" : "NO_CHANGE", },
"options" : { "fps": {
"enum_titles" : ["edt_conf_enum_NO_CHANGE", "edt_conf_enum_HORIZONTAL", "edt_conf_enum_VERTICAL", "edt_conf_enum_BOTH"] "type": "integer",
"title": "edt_conf_enum_custom",
"default": 15,
"minimum": 0,
"append": "fps",
"options": {
"hidden": true
}, },
"required" : true, "required": true,
"propertyOrder" : 8 "propertyOrder": 11,
"comment": "The 'framerates' setting is dynamically inserted into the WebUI under PropertyOrder '10'."
}, },
"width" : "fpsSoftwareDecimation": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_fpsSoftwareDecimation_title",
"title" : "edt_conf_fg_width_title", "minimum": 0,
"default" : 0, "maximum": 60,
"minimum" : 0, "default": 0,
"append" : "edt_append_pixel", "required": true,
"options" : { "access": "advanced",
"hidden":true "propertyOrder": 12
},
"flip": {
"type": "string",
"title": "edt_conf_v4l2_flip_title",
"enum": [ "NO_CHANGE", "HORIZONTAL", "VERTICAL", "BOTH" ],
"default": "NO_CHANGE",
"options": {
"enum_titles": [ "edt_conf_enum_NO_CHANGE", "edt_conf_enum_HORIZONTAL", "edt_conf_enum_VERTICAL", "edt_conf_enum_BOTH" ]
}, },
"required" : true, "required": true,
"propertyOrder" : 10, "access": "advanced",
"comment" : "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '9'." "propertyOrder": 13
}, },
"height" : "sizeDecimation": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_sizeDecimation_title",
"title" : "edt_conf_fg_height_title", "minimum": 1,
"default" : 0, "maximum": 30,
"minimum" : 0, "default": 6,
"append" : "edt_append_pixel", "required": true,
"options" : { "propertyOrder": 14
"hidden":true
},
"required" : true,
"propertyOrder" : 11,
"comment" : "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '9'."
}, },
"fps" : "cropLeft": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_cropLeft_title",
"title" : "edt_conf_enum_custom", "minimum": 0,
"default" : 15, "default": 0,
"minimum" : 1, "append": "edt_append_pixel",
"append" : "fps", "required": true,
"options" : { "access": "advanced",
"hidden":true "propertyOrder": 15
},
"required" : true,
"propertyOrder" : 13,
"comment" : "The 'framerates' setting is dynamically inserted into the WebUI under PropertyOrder '12'."
}, },
"fpsSoftwareDecimation" : "cropRight": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_cropRight_title",
"title" : "edt_conf_v4l2_fpsSoftwareDecimation_title", "minimum": 0,
"minimum" : 0, "default": 0,
"maximum" : 60, "append": "edt_append_pixel",
"default" : 0, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 14 "propertyOrder": 16
}, },
"sizeDecimation" : "cropTop": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_cropTop_title",
"title" : "edt_conf_v4l2_sizeDecimation_title", "minimum": 0,
"minimum" : 1, "default": 0,
"maximum" : 30, "append": "edt_append_pixel",
"default" : 6, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 15 "propertyOrder": 17
}, },
"cropLeft" : "cropBottom": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_cropBottom_title",
"title" : "edt_conf_v4l2_cropLeft_title", "minimum": 0,
"minimum" : 0, "default": 0,
"default" : 0, "append": "edt_append_pixel",
"append" : "edt_append_pixel", "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 16 "propertyOrder": 18
}, },
"cropRight" : "cecDetection": {
{ "type": "boolean",
"type" : "integer", "title": "edt_conf_v4l2_cecDetection_title",
"title" : "edt_conf_v4l2_cropRight_title", "default": false,
"minimum" : 0, "required": true,
"default" : 0, "propertyOrder": 19
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 17
}, },
"cropTop" : "signalDetection": {
{ "type": "boolean",
"type" : "integer", "title": "edt_conf_v4l2_signalDetection_title",
"title" : "edt_conf_v4l2_cropTop_title", "default": false,
"minimum" : 0, "required": true,
"default" : 0, "access": "advanced",
"append" : "edt_append_pixel", "propertyOrder": 20
"required" : true,
"propertyOrder" : 18
}, },
"cropBottom" : "redSignalThreshold": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_redSignalThreshold_title",
"title" : "edt_conf_v4l2_cropBottom_title", "minimum": 0,
"minimum" : 0, "maximum": 100,
"default" : 0, "default": 5,
"append" : "edt_append_pixel", "append": "edt_append_percent",
"required" : true,
"propertyOrder" : 19
},
"cecDetection" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_cecDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 20
},
"signalDetection" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 21
},
"redSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_redSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "access": "advanced",
"propertyOrder" : 22 "required": true,
"propertyOrder": 21
}, },
"greenSignalThreshold" : "greenSignalThreshold": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_greenSignalThreshold_title",
"title" : "edt_conf_v4l2_greenSignalThreshold_title", "minimum": 0,
"minimum" : 0, "maximum": 100,
"maximum" : 100, "default": 5,
"default" : 5, "append": "edt_append_percent",
"append" : "edt_append_percent",
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 23 "access": "advanced",
"propertyOrder": 22
}, },
"blueSignalThreshold" : "blueSignalThreshold": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_blueSignalThreshold_title",
"title" : "edt_conf_v4l2_blueSignalThreshold_title", "minimum": 0,
"minimum" : 0, "maximum": 100,
"maximum" : 100, "default": 5,
"default" : 5, "append": "edt_append_percent",
"append" : "edt_append_percent",
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 24 "access": "advanced",
"propertyOrder": 23
}, },
"noSignalCounterThreshold" : "noSignalCounterThreshold": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_noSignalCounterThreshold_title",
"title" : "edt_conf_v4l2_noSignalCounterThreshold_title", "minimum": 1,
"minimum" : 1, "maximum": 1000,
"maximum" : 1000, "default": 200,
"default" : 200,
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 25 "access": "advanced",
"propertyOrder": 24
}, },
"sDVOffsetMin" : "sDVOffsetMin": {
{ "type": "number",
"type" : "number", "title": "edt_conf_v4l2_sDVOffsetMin_title",
"title" : "edt_conf_v4l2_sDVOffsetMin_title", "minimum": 0.0,
"minimum" : 0.0, "maximum": 1.0,
"maximum" : 1.0, "default": 0.25,
"default" : 0.25, "step": 0.01,
"step" : 0.01,
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 26 "access": "advanced",
"propertyOrder": 25
}, },
"sDVOffsetMax" : "sDVOffsetMax": {
{ "type": "number",
"type" : "number", "title": "edt_conf_v4l2_sDVOffsetMax_title",
"title" : "edt_conf_v4l2_sDVOffsetMax_title", "minimum": 0.0,
"minimum" : 0.0, "maximum": 1.0,
"maximum" : 1.0, "default": 0.75,
"default" : 0.75, "step": 0.01,
"step" : 0.01,
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 27 "access": "advanced",
"propertyOrder": 26
}, },
"sDHOffsetMin" : "sDHOffsetMin": {
{ "type": "number",
"type" : "number", "title": "edt_conf_v4l2_sDHOffsetMin_title",
"title" : "edt_conf_v4l2_sDHOffsetMin_title", "minimum": 0.0,
"minimum" : 0.0, "maximum": 1.0,
"maximum" : 1.0, "default": 0.25,
"default" : 0.25, "step": 0.01,
"step" : 0.01,
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 28 "access": "advanced",
"propertyOrder": 27
}, },
"sDHOffsetMax" : "sDHOffsetMax": {
{ "type": "number",
"type" : "number", "title": "edt_conf_v4l2_sDHOffsetMax_title",
"title" : "edt_conf_v4l2_sDHOffsetMax_title", "minimum": 0.0,
"minimum" : 0.0, "maximum": 1.0,
"maximum" : 1.0, "default": 0.75,
"default" : 0.75, "step": 0.01,
"step" : 0.01,
"options": { "options": {
"dependencies": { "dependencies": {
"signalDetection": true "signalDetection": true
} }
}, },
"required" : true, "required": true,
"propertyOrder" : 29 "propertyOrder": 28
}, },
"hardware_brightness" : "hardware_brightness": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_hardware_brightness_title",
"title" : "edt_conf_v4l2_hardware_brightness_title", "default": 0,
"default" : 0, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 30 "propertyOrder": 29
}, },
"hardware_contrast" : "hardware_contrast": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_hardware_contrast_title",
"title" : "edt_conf_v4l2_hardware_contrast_title", "default": 0,
"default" : 0, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 31 "propertyOrder": 30
}, },
"hardware_saturation" : "hardware_saturation": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_hardware_saturation_title",
"title" : "edt_conf_v4l2_hardware_saturation_title", "default": 0,
"default" : 0, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 32 "propertyOrder": 31
}, },
"hardware_hue" : "hardware_hue": {
{ "type": "integer",
"type" : "integer", "title": "edt_conf_v4l2_hardware_hue_title",
"title" : "edt_conf_v4l2_hardware_hue_title", "default": 0,
"default" : 0, "required": true,
"required" : true, "access": "advanced",
"propertyOrder" : 33 "propertyOrder": 32
} }
}, },
"additionalProperties" : true "additionalProperties": true
} }