onvifDeviceManager : populate Video Configuration
parent
65bf6e0dc7
commit
115ef947e6
|
@ -4956,6 +4956,18 @@ module.exports = function(s,config,lang){
|
|||
"possible": ""
|
||||
},
|
||||
{
|
||||
"field": lang.Resolution,
|
||||
"name": "detail=Resolution",
|
||||
"description": "",
|
||||
"default": "",
|
||||
"example": "",
|
||||
"fieldType": "select",
|
||||
"possible": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
hidden: true,
|
||||
"field": lang['Width'],
|
||||
"name": "Resolution:Width",
|
||||
"placeholder": "",
|
||||
|
@ -4965,6 +4977,7 @@ module.exports = function(s,config,lang){
|
|||
"possible": ""
|
||||
},
|
||||
{
|
||||
hidden: true,
|
||||
"field": lang['Height'],
|
||||
"name": "Resolution:Height",
|
||||
"placeholder": "",
|
||||
|
@ -5003,6 +5016,7 @@ module.exports = function(s,config,lang){
|
|||
{
|
||||
"field": lang['BitrateLimit'],
|
||||
"name": "RateControl:BitrateLimit",
|
||||
"fieldType": "number",
|
||||
"placeholder": "",
|
||||
"description": "",
|
||||
"default": "",
|
||||
|
@ -5012,6 +5026,7 @@ module.exports = function(s,config,lang){
|
|||
{
|
||||
"field": lang['GovLength'],
|
||||
"name": "H264:GovLength",
|
||||
"fieldType": "number",
|
||||
"placeholder": "",
|
||||
"description": "",
|
||||
"default": "",
|
||||
|
@ -5025,18 +5040,24 @@ module.exports = function(s,config,lang){
|
|||
"description": "",
|
||||
"default": "H264",
|
||||
"example": "",
|
||||
"possible": ""
|
||||
"fieldType": "select",
|
||||
"possible": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"field": lang['H264Profile'],
|
||||
"name": "H264:H264Profile",
|
||||
"placeholder": "",
|
||||
"field": lang['H264Profile'],
|
||||
"name": "H264:H264Profile",
|
||||
"description": "",
|
||||
"default": "",
|
||||
"example": "",
|
||||
"possible": ""
|
||||
"fieldType": "select",
|
||||
"possible": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
hidden: true,
|
||||
"field": lang['UseCount'],
|
||||
"name": "UseCount",
|
||||
"placeholder": "",
|
||||
|
|
|
@ -1098,6 +1098,7 @@
|
|||
"ColorSaturation": "Color Saturation",
|
||||
"Encoding": "Encoding",
|
||||
"Brightness": "Brightness",
|
||||
"Resolution": "Resolution",
|
||||
"Imaging": "Imaging",
|
||||
"Hostname": "Hostname",
|
||||
"Network": "Network",
|
||||
|
|
|
@ -3,6 +3,57 @@ $(document).ready(function(){
|
|||
var blockWindow = $('#onvifDeviceManager')
|
||||
var blockWindowInfo = $('#onvifDeviceManagerInfo')
|
||||
var blockForm = blockWindow.find('form')
|
||||
var setIntegerGuider = function(fieldName,theRange){
|
||||
blockForm.find(`[${fieldName}]`)
|
||||
.attr('min',theRange.Min)
|
||||
.attr('max',theRange.Max)
|
||||
.attr('placeholder',`Mininum : ${theRange.Min}, Maximum: ${theRange.Max}`);
|
||||
}
|
||||
var setGuidersInFormFields = function(onvifData){
|
||||
if(onvifData.videoEncoderOptions){
|
||||
var encoderOptions = onvifData.videoEncoderOptions
|
||||
//Encoding
|
||||
var hasH264 = !!encoderOptions.H264;
|
||||
var hasH265 = !!encoderOptions.H265;
|
||||
// var hasJPEG = !!encoderOptions.JPEG;
|
||||
var availableEncoders = []
|
||||
if(hasH264)availableEncoders.push('H264')
|
||||
if(hasH265)availableEncoders.push('H265')
|
||||
// if(hasJPEG)availableEncoders.push('JPEG')
|
||||
var html = ``
|
||||
$.each(availableEncoders,function(n,encoder){
|
||||
html += `<option value="${encoder}">${encoder}</option>`
|
||||
})
|
||||
blockForm.find('[name="Encoding"]').html(html)
|
||||
//Resolutions
|
||||
var html = ``
|
||||
$.each(encoderOptions.H264.ResolutionsAvailable,function(n,resolution){
|
||||
html += `<option value="${resolution.Width}x${resolution.Height}">${resolution.Width}x${resolution.Height}</option>`
|
||||
})
|
||||
blockForm.find('[detail="Resolution"]').html(html)
|
||||
//Profiles Supported
|
||||
var html = ``
|
||||
var profilesSupported = encoderOptions.H264.H264ProfilesSupported
|
||||
profilesSupported = typeof profilesSupported === 'string' ? [profilesSupported] : profilesSupported
|
||||
$.each(profilesSupported,function(n,profile){
|
||||
html += `<option value="${profile}">${profile}</option>`
|
||||
})
|
||||
blockForm.find('[name="H264:H264Profile"]').html(html)
|
||||
//GOV Length, Frame Rate, Encoding Interval Range
|
||||
setIntegerGuider('name="H264:GovLength"',encoderOptions.H264.GovLengthRange)
|
||||
setIntegerGuider('name="RateControl:FrameRateLimit"',encoderOptions.H264.FrameRateRange)
|
||||
setIntegerGuider('name="RateControl:EncodingInterval"',encoderOptions.H264.EncodingIntervalRange)
|
||||
}
|
||||
if(onvifData.videoEncoders){
|
||||
loadedVideoEncoders = {}
|
||||
var html = ``
|
||||
onvifData.videoEncoders.forEach((encoder) => {
|
||||
html += `<option value="${encoder.$.token}">${encoder.Name}</option>`
|
||||
loadedVideoEncoders[encoder.$.token] = encoder
|
||||
})
|
||||
blockForm.find('[name=videoToken]').html(html)
|
||||
}
|
||||
}
|
||||
var converObjectKeysToFormFieldName = (object,parentKey) => {
|
||||
parentKey = parentKey ? parentKey : ''
|
||||
var theList = {}
|
||||
|
@ -48,13 +99,6 @@ $(document).ready(function(){
|
|||
})
|
||||
}
|
||||
if(onvifData.videoEncoders){
|
||||
loadedVideoEncoders = {}
|
||||
var html = ``
|
||||
onvifData.videoEncoders.forEach((encoder) => {
|
||||
html += `<option value="${encoder.$.token}">${encoder.Name}</option>`
|
||||
loadedVideoEncoders[encoder.$.token] = encoder
|
||||
})
|
||||
blockForm.find('[name=videoToken]').html(html)
|
||||
setFieldsFromOnvifKeys(onvifData.videoEncoders[0])
|
||||
}
|
||||
if(onvifData.imagingSettings && onvifData.imagingSettings.ok !== false){
|
||||
|
@ -77,6 +121,7 @@ $(document).ready(function(){
|
|||
var onvifData = response.onvifData
|
||||
console.log(response)
|
||||
blockWindowInfo.html(JSON.stringify(onvifData,null,3))
|
||||
setGuidersInFormFields(onvifData)
|
||||
writeOnvifDataToFormFields(onvifData)
|
||||
blockWindow.modal('show')
|
||||
})
|
||||
|
@ -88,6 +133,13 @@ $(document).ready(function(){
|
|||
blockForm.on('change','[name="videoToken"]',function(){
|
||||
selectVideoEncoder(loadedVideoEncoders[$(this).val()])
|
||||
})
|
||||
blockForm.on('change','[detail="Resolution"]',function(){
|
||||
var resolution = $(this).val().split('x')
|
||||
var width = resolution[0]
|
||||
var height = resolution[1]
|
||||
blockForm.find('[name="Resolution:Width"]').val(width)
|
||||
blockForm.find('[name="Resolution:Height"]').val(height)
|
||||
})
|
||||
blockForm.submit(function(e){
|
||||
e.preventDefault()
|
||||
var formOptions = blockForm.serializeObject()
|
||||
|
|
Loading…
Reference in New Issue