mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Support Grabber Bri, Hue, Sat and Con in UI, plus their defaults
This commit is contained in:
parent
40549f61dd
commit
332655abfb
@ -59,14 +59,14 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
function updateCropForWidth(editor, path) {
|
function updateCropForWidth(editor, path) {
|
||||||
var width = editor.getEditor(path + ".width").getValue();
|
var width = editor.getEditor(path + ".width").getValue();
|
||||||
updateJsonEditorRange(editor.getEditor(path), 'cropLeft', 0, width);
|
updateJsonEditorRange(editor, path, 'cropLeft', 0, width);
|
||||||
updateJsonEditorRange(editor.getEditor(path), 'cropRight', 0, width);
|
updateJsonEditorRange(editor, path, 'cropRight', 0, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCropForHeight(editor, path) {
|
function updateCropForHeight(editor, path) {
|
||||||
var height = editor.getEditor(path + ".height").getValue();
|
var height = editor.getEditor(path + ".height").getValue();
|
||||||
updateJsonEditorRange(editor.getEditor(path), 'cropTop', 0, height);
|
updateJsonEditorRange(editor, path, 'cropTop', 0, height);
|
||||||
updateJsonEditorRange(editor.getEditor(path), 'cropBottom', 0, height);
|
updateJsonEditorRange(editor, path, 'cropBottom', 0, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Screen-Grabber
|
// Screen-Grabber
|
||||||
@ -279,23 +279,15 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
//Show Frameskipping only when more than 2 fps
|
//Show Frameskipping only when more than 2 fps
|
||||||
if (fps > 2 && storedAccess === "expert") {
|
if (fps > 2 && storedAccess === "expert") {
|
||||||
showInputOptions(["fpsSoftwareDecimation"], true);
|
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showInputOptions(["fpsSoftwareDecimation"], false);
|
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], false);
|
||||||
}
|
}
|
||||||
conf_editor_screen.getEditor("root.framegrabber.fps").setValue(fps);
|
conf_editor_screen.getEditor("root.framegrabber.fps").setValue(fps);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
conf_editor_screen.watch('root.framegrabber.width', () => {
|
|
||||||
updateCropForWidth(conf_editor_screen, "root.framegrabber");
|
|
||||||
});
|
|
||||||
|
|
||||||
conf_editor_screen.watch('root.framegrabber.height', () => {
|
|
||||||
updateCropForHeight(conf_editor_screen, "root.framegrabber");
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_submit_screengrabber').off().on('click', function () {
|
$('#btn_submit_screengrabber').off().on('click', function () {
|
||||||
var saveOptions = conf_editor_screen.getValue();
|
var saveOptions = conf_editor_screen.getValue();
|
||||||
|
|
||||||
@ -312,6 +304,25 @@ $(document).ready(function () {
|
|||||||
var discoveredInputSources = {};
|
var discoveredInputSources = {};
|
||||||
var deviceProperties = {};
|
var deviceProperties = {};
|
||||||
|
|
||||||
|
function updateDeviceProperties(deviceProperties, defaultDeviceProperties, property, key) {
|
||||||
|
var properties = {};
|
||||||
|
if (deviceProperties.hasOwnProperty(property)) {
|
||||||
|
properties = deviceProperties[property];
|
||||||
|
}
|
||||||
|
updateJsonEditorRange(conf_editor_video, "root.grabberV4L2", key,
|
||||||
|
properties.minValue,
|
||||||
|
properties.maxValue,
|
||||||
|
defaultDeviceProperties[property],
|
||||||
|
properties.step,
|
||||||
|
true);
|
||||||
|
|
||||||
|
if (jQuery.isEmptyObject(properties)) {
|
||||||
|
showInputOptions("grabberV4L2", [key], false);
|
||||||
|
} else {
|
||||||
|
showInputOptions("grabberV4L2", [key], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
conf_editor_video = createJsonEditor('editor_container_videograbber', {
|
conf_editor_video = createJsonEditor('editor_container_videograbber', {
|
||||||
grabberV4L2: window.schema.grabberV4L2
|
grabberV4L2: window.schema.grabberV4L2
|
||||||
}, true, true);
|
}, true, true);
|
||||||
@ -364,7 +375,7 @@ $(document).ready(function () {
|
|||||||
var deviceSelected = conf_editor_video.getEditor("root.grabberV4L2.available_devices").getValue();
|
var deviceSelected = conf_editor_video.getEditor("root.grabberV4L2.available_devices").getValue();
|
||||||
if (deviceSelected === "SELECT" || deviceSelected === "NONE" || deviceSelected === "") {
|
if (deviceSelected === "SELECT" || deviceSelected === "NONE" || deviceSelected === "") {
|
||||||
$('#btn_submit_videograbber').attr('disabled', true);
|
$('#btn_submit_videograbber').attr('disabled', true);
|
||||||
showInputOptionsForKey(conf_editor_video, "grabberV4L2", ["enable","available_devices"], false);
|
showInputOptionsForKey(conf_editor_video, "grabberV4L2", ["enable", "available_devices"], false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showInputOptionsForKey(conf_editor_video, "grabberV4L2", ["enable", "available_devices"], true);
|
showInputOptionsForKey(conf_editor_video, "grabberV4L2", ["enable", "available_devices"], true);
|
||||||
@ -378,6 +389,27 @@ $(document).ready(function () {
|
|||||||
//Update hidden input element
|
//Update hidden input element
|
||||||
conf_editor_video.getEditor("root.grabberV4L2.device").setValue(deviceProperties.device);
|
conf_editor_video.getEditor("root.grabberV4L2.device").setValue(deviceProperties.device);
|
||||||
|
|
||||||
|
var defaultDeviceProperties = {};
|
||||||
|
if (deviceProperties.hasOwnProperty('default')) {
|
||||||
|
if (deviceProperties.default.hasOwnProperty('properties')) {
|
||||||
|
defaultDeviceProperties = deviceProperties.default.properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//If configured device is selected, use the saved values as default, when updating the validation ranges
|
||||||
|
if (deviceSelected === configuredDevice) {
|
||||||
|
|
||||||
|
defaultDeviceProperties.brightness = window.serverConfig.grabberV4L2.hardware_brightness;
|
||||||
|
defaultDeviceProperties.contrast = window.serverConfig.grabberV4L2.hardware_contrast;
|
||||||
|
defaultDeviceProperties.saturation = window.serverConfig.grabberV4L2.hardware_saturation;
|
||||||
|
defaultDeviceProperties.hue = window.serverConfig.grabberV4L2.hardware_hue;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateDeviceProperties(deviceProperties.properties, defaultDeviceProperties, "brightness", "hardware_brightness");
|
||||||
|
updateDeviceProperties(deviceProperties.properties, defaultDeviceProperties, "contrast", "hardware_contrast");
|
||||||
|
updateDeviceProperties(deviceProperties.properties, defaultDeviceProperties, "saturation", "hardware_saturation");
|
||||||
|
updateDeviceProperties(deviceProperties.properties, defaultDeviceProperties, "hue", "hardware_hue");
|
||||||
|
|
||||||
var video_inputs = deviceProperties.video_inputs;
|
var video_inputs = deviceProperties.video_inputs;
|
||||||
if (video_inputs.length <= 1) {
|
if (video_inputs.length <= 1) {
|
||||||
addSchemaElements.access = "expert";
|
addSchemaElements.access = "expert";
|
||||||
@ -591,10 +623,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
//Show Frameskipping only when more than 2 fps
|
//Show Frameskipping only when more than 2 fps
|
||||||
if (fps > 2 && storedAccess === "expert") {
|
if (fps > 2 && storedAccess === "expert") {
|
||||||
showInputOptions(["fpsSoftwareDecimation"], true);
|
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showInputOptions(["fpsSoftwareDecimation"], false);
|
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], false);
|
||||||
}
|
}
|
||||||
conf_editor_video.getEditor("root.grabberV4L2.fps").setValue(fps);
|
conf_editor_video.getEditor("root.grabberV4L2.fps").setValue(fps);
|
||||||
});
|
});
|
||||||
@ -719,4 +751,3 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -598,26 +598,36 @@ function updateJsonEditorMultiSelection(editor, key, addElements, newEnumVals, n
|
|||||||
editor.addObjectProperty(key);
|
editor.addObjectProperty(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateJsonEditorRange(editor, key, minimum, maximum, defaultValue, step) {
|
function updateJsonEditorRange(rootEditor, path, key, minimum, maximum, defaultValue, step, clear) {
|
||||||
|
var editor = rootEditor.getEditor(path);
|
||||||
|
|
||||||
var orginalProperties = editor.schema.properties[key];
|
var orginalProperties = editor.schema.properties[key];
|
||||||
var newSchema = [];
|
var newSchema = [];
|
||||||
newSchema[key] = orginalProperties;
|
newSchema[key] = orginalProperties;
|
||||||
|
|
||||||
if (minimum) {
|
if (clear) {
|
||||||
|
delete newSchema[key]["minimum"];
|
||||||
|
delete newSchema[key]["maximum"];
|
||||||
|
delete newSchema[key]["default"];
|
||||||
|
delete newSchema[key]["step"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof minimum !== "undefined") {
|
||||||
newSchema[key]["minimum"] = minimum;
|
newSchema[key]["minimum"] = minimum;
|
||||||
}
|
}
|
||||||
if (maximum) {
|
if (typeof maximum !== "undefined") {
|
||||||
newSchema[key]["maximum"] = maximum;
|
newSchema[key]["maximum"] = maximum;
|
||||||
}
|
}
|
||||||
if (defaultValue) {
|
if (typeof defaultValue !== "undefined") {
|
||||||
newSchema[key]["default"] = defaultValue;
|
newSchema[key]["default"] = defaultValue;
|
||||||
}
|
}
|
||||||
if (step) {
|
if (typeof step !== "undefined") {
|
||||||
newSchema[key]["step"] = step;
|
newSchema[key]["step"] = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.original_schema.properties[key] = orginalProperties;
|
editor.original_schema.properties[key] = orginalProperties;
|
||||||
editor.schema.properties[key] = newSchema[key];
|
editor.schema.properties[key] = newSchema[key];
|
||||||
|
rootEditor.validator.schema.properties[editor.key].properties[key] = orginalProperties;
|
||||||
|
|
||||||
editor.removeObjectProperty(key);
|
editor.removeObjectProperty(key);
|
||||||
delete editor.cached_editors[key];
|
delete editor.cached_editors[key];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user