V4l2 input (#825)

This commit is contained in:
Paulchen Panther
2020-06-17 20:55:57 +02:00
committed by GitHub
parent 423a59fa34
commit 756247aa1e
18 changed files with 252 additions and 77 deletions

View File

@@ -583,6 +583,8 @@
"edt_conf_v4l2_heading_title": "USB Aufnahme",
"edt_conf_v4l2_device_title": "Gerät",
"edt_conf_v4l2_device_expl": "Eine Liste von USB (v4l) Aufnahmegeräten. Wähle 'Automatisch' für automatische Erkennung. Benutzerdefiniert z.b.: '/dev/video0'",
"edt_conf_v4l2_input_title": "Eingang",
"edt_conf_v4l2_input_expl": "Wähle den Videoeingang deines Gerätes. Auf 'Automatisch' wird der Videoeingang vom v4l interface beibehalten.",
"edt_conf_v4l2_standard_title": "Videoformat",
"edt_conf_v4l2_standard_expl": "Wähle das passende Videoformat deiner Region. Auf 'Automatisch' wird der gewählte Modus vom v4l interface beibehalten.",
"edt_conf_v4l2_resolution_title": "Auflösung",

View File

@@ -41,7 +41,7 @@
"general_btn_rename" : "Rename",
"general_btn_continue" : "Continue",
"general_btn_save" : "Save",
"general_btn_saverestart" : "Save and restart",
"general_btn_saverestart" : "Save and restart",
"general_btn_saveandreload" : "Save and reload",
"general_btn_restarthyperion" : "Restart Hyperion",
"general_btn_off" : "Off",
@@ -584,8 +584,10 @@
"edt_conf_v4l2_heading_title" : "USB Capture",
"edt_conf_v4l2_device_title" : "Device",
"edt_conf_v4l2_device_expl" : "The path to the USB capture interface. Set to 'Automatic' for automatic detection. Example: '/dev/video0'",
"edt_conf_v4l2_input_title": "Input",
"edt_conf_v4l2_input_expl": "Select the video input of your device. 'Automatic' keeps the value chosen by the v4l2 interface.",
"edt_conf_v4l2_standard_title" : "Video standard",
"edt_conf_v4l2_standard_expl" : "Select the video standard for your region. 'Automatic' keeps the value chosen by the v4l2 interface",
"edt_conf_v4l2_standard_expl" : "Select the video standard for your region. 'Automatic' keeps the value chosen by the v4l2 interface.",
"edt_conf_v4l2_resolution_title" : "Device Resolution",
"edt_conf_v4l2_resolution_expl" : "A list of supported resolutions of the active device",
"edt_conf_v4l2_framerate_title": "Frames per second",

View File

@@ -15,18 +15,25 @@ $(document).ready( function() {
"propertyOrder" : 1,
"required" : true
},
"device_inputs":
{
"type": "string",
"title": "edt_conf_v4l2_input_title",
"propertyOrder" : 3,
"required" : true
},
"resolutions":
{
"type": "string",
"title": "edt_conf_v4l2_resolution_title",
"propertyOrder" : 4,
"propertyOrder" : 6,
"required" : true
},
"framerates":
{
"type": "string",
"title": "edt_conf_v4l2_framerate_title",
"propertyOrder" : 7,
"propertyOrder" : 9,
"required" : true
}
};
@@ -53,6 +60,16 @@ $(document).ready( function() {
break;
}
}
} else if (key == 'device_inputs') {
for (var i = 0; i < v4l2_properties.length; i++) {
if (v4l2_properties[i]['device'] == device) {
for (var index = 0; index < v4l2_properties[i]['inputs'].length; index++) {
enumVals.push(v4l2_properties[i]['inputs'][index]['inputIndex'].toString());
enumTitelVals.push(v4l2_properties[i]['inputs'][index]['inputName']);
}
break;
}
}
}
window.schema.grabberV4L2.properties[key] = {
@@ -71,9 +88,9 @@ $(document).ready( function() {
// Switch between visible states
function toggleOption(option, state) {
$('[data-schemapath*="root.grabberV4L2.'+option+'"]').toggle(state);
$('[data-schemapath="root.grabberV4L2.'+option+'"]').toggle(state);
if (state) (
$('[data-schemapath*="root.grabberV4L2.'+option+'"]').addClass('col-md-12'),
$('[data-schemapath="root.grabberV4L2.'+option+'"]').addClass('col-md-12'),
$('label[for="root_grabberV4L2_'+option+'"]').css('left','10px'),
$('[id="root_grabberV4L2_'+option+'"]').css('left','10px')
);
@@ -88,13 +105,14 @@ $(document).ready( function() {
var val = ed.getValue();
if (key == 'available_devices') {
var V4L2properties = ['resolutions', 'framerates'];
var V4L2properties = ['device_inputs', 'resolutions', 'framerates'];
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];
@@ -103,15 +121,22 @@ $(document).ready( function() {
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();
});
(toggleOption('device', false), toggleOption('width', false),
toggleOption('height', false), toggleOption('fps', false));
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));
} else {
var grabberV4L2 = ed.parent;
V4L2properties.forEach(function(item) {
@@ -127,6 +152,7 @@ $(document).ready( function() {
conf_editor_v4l2.getEditor(path + item).enable();
});
conf_editor_v4l2.getEditor(path + 'standard').enable();
toggleOption('device', false);
}
}
@@ -140,6 +166,11 @@ $(document).ready( function() {
val != 'custom'
? toggleOption('fps', false)
: toggleOption('fps', true);
if (key == 'device_inputs')
val != 'custom'
? toggleOption('input', false)
: toggleOption('input', true);
});
});
};
@@ -221,12 +252,15 @@ $(document).ready( function() {
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
['resolutions', 'framerates'].forEach(function(item) {
['device_inputs', 'standard', 'resolutions', 'framerates'].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));
@@ -244,6 +278,12 @@ $(document).ready( function() {
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.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]));