fnc rtsp: limit max resolution

This commit is contained in:
Joo Aun Saw 2019-10-28 00:39:17 +11:00
parent dfe313bd9f
commit b0166b054c
8 changed files with 220 additions and 4 deletions

View File

@ -124,6 +124,27 @@ RESOLUTION_CHOICES = [
('3280x2464', '3280x2464') ('3280x2464', '3280x2464')
] ]
RTSP_RESOLUTION_CHOICES = [
('320x200', '320x200'),
('320x240', '320x240'),
('640x480', '640x480'),
('800x480', '800x480'),
('800x600', '800x600'),
('1024x576', '1024x576'),
('1024x768', '1024x768'),
('1280x720', '1280x720'),
('1280x800', '1280x800'),
('1280x960', '1280x960'),
('1280x1024', '1280x1024'),
('1296x972', '1296x972'),
('1440x960', '1440x960'),
('1440x1024', '1440x1024'),
('1600x1200', '1600x1200'),
('1640x922', '1640x922'),
('1640x1232', '1640x1232'),
('1920x1080', '1920x1080')
]
ROTATION_CHOICES = [ ROTATION_CHOICES = [
('0', '0°'), ('0', '0°'),
('90', '90°'), ('90', '90°'),
@ -311,6 +332,8 @@ def _get_raspimjpeg_settings(camera_id):
'imxfx': 'none', 'imxfx': 'none',
'width': 640, 'width': 640,
'height': 480, 'height': 480,
'rtsp_width': 640,
'rtsp_height': 480,
'rotation': 0, 'rotation': 0,
'vflip': False, 'vflip': False,
'hflip': False, 'hflip': False,
@ -372,6 +395,7 @@ def _get_raspimjpeg_settings(camera_id):
s['sharpness'] = (s['sharpness'] + 100) / 2 s['sharpness'] = (s['sharpness'] + 100) / 2
s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height')) s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height'))
s['rtspResolution'] = '%sx%s' % (s.pop('rtsp_width'), s.pop('rtsp_height'))
s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items()) s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items())
@ -383,6 +407,8 @@ def _set_raspimjpeg_settings(camera_id, s):
s['width'] = int(s['resolution'].split('x')[0]) s['width'] = int(s['resolution'].split('x')[0])
s['height'] = int(s.pop('resolution').split('x')[1]) s['height'] = int(s.pop('resolution').split('x')[1])
s['rtsp_width'] = int(s['rtspResolution'].split('x')[0])
s['rtsp_height'] = int(s.pop('rtspResolution').split('x')[1])
s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % ( s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % (
s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0, s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0,
@ -705,13 +731,33 @@ def seResolution():
return None return None
return { return {
'label': 'Video Resolution', 'label': 'MJPEG Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)', 'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices', 'type': 'choices',
'choices': RESOLUTION_CHOICES, 'choices': RESOLUTION_CHOICES,
'section': 'device', 'section': 'device',
'camera': True, 'camera': True,
'required': True, 'required': True,
'depends': ['seProto==mjpeg'],
'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings,
'get_set_dict': True
}
@additional_config
def seRtspResolution():
if not _get_streameye_enabled():
return None
return {
'label': 'RTSP Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices',
'choices': RTSP_RESOLUTION_CHOICES,
'section': 'device',
'camera': True,
'required': True,
'depends': ['seProto==rtsp'],
'get': _get_raspimjpeg_settings, 'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings, 'set': _set_raspimjpeg_settings,
'get_set_dict': True 'get_set_dict': True

View File

@ -130,6 +130,14 @@ function start() {
raspimjpeg_opts="${raspimjpeg_opts} --${line}" raspimjpeg_opts="${raspimjpeg_opts} --${line}"
done < ${RASPIMJPEG_CONF} done < ${RASPIMJPEG_CONF}
video_height=$(grep -e ^rtsp_height ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_height}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --height ${video_height}"
fi
video_width=$(grep -e ^rtsp_width ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_width}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --width ${video_width}"
fi
video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2) video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_iso}" ]; then if [ -n "${video_iso}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}" raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}"

View File

@ -124,6 +124,27 @@ RESOLUTION_CHOICES = [
('3280x2464', '3280x2464') ('3280x2464', '3280x2464')
] ]
RTSP_RESOLUTION_CHOICES = [
('320x200', '320x200'),
('320x240', '320x240'),
('640x480', '640x480'),
('800x480', '800x480'),
('800x600', '800x600'),
('1024x576', '1024x576'),
('1024x768', '1024x768'),
('1280x720', '1280x720'),
('1280x800', '1280x800'),
('1280x960', '1280x960'),
('1280x1024', '1280x1024'),
('1296x972', '1296x972'),
('1440x960', '1440x960'),
('1440x1024', '1440x1024'),
('1600x1200', '1600x1200'),
('1640x922', '1640x922'),
('1640x1232', '1640x1232'),
('1920x1080', '1920x1080')
]
ROTATION_CHOICES = [ ROTATION_CHOICES = [
('0', '0&deg;'), ('0', '0&deg;'),
('90', '90&deg;'), ('90', '90&deg;'),
@ -311,6 +332,8 @@ def _get_raspimjpeg_settings(camera_id):
'imxfx': 'none', 'imxfx': 'none',
'width': 640, 'width': 640,
'height': 480, 'height': 480,
'rtsp_width': 640,
'rtsp_height': 480,
'rotation': 0, 'rotation': 0,
'vflip': False, 'vflip': False,
'hflip': False, 'hflip': False,
@ -372,6 +395,7 @@ def _get_raspimjpeg_settings(camera_id):
s['sharpness'] = (s['sharpness'] + 100) / 2 s['sharpness'] = (s['sharpness'] + 100) / 2
s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height')) s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height'))
s['rtspResolution'] = '%sx%s' % (s.pop('rtsp_width'), s.pop('rtsp_height'))
s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items()) s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items())
@ -383,6 +407,8 @@ def _set_raspimjpeg_settings(camera_id, s):
s['width'] = int(s['resolution'].split('x')[0]) s['width'] = int(s['resolution'].split('x')[0])
s['height'] = int(s.pop('resolution').split('x')[1]) s['height'] = int(s.pop('resolution').split('x')[1])
s['rtsp_width'] = int(s['rtspResolution'].split('x')[0])
s['rtsp_height'] = int(s.pop('rtspResolution').split('x')[1])
s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % ( s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % (
s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0, s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0,
@ -705,13 +731,33 @@ def seResolution():
return None return None
return { return {
'label': 'Video Resolution', 'label': 'MJPEG Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)', 'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices', 'type': 'choices',
'choices': RESOLUTION_CHOICES, 'choices': RESOLUTION_CHOICES,
'section': 'device', 'section': 'device',
'camera': True, 'camera': True,
'required': True, 'required': True,
'depends': ['seProto==mjpeg'],
'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings,
'get_set_dict': True
}
@additional_config
def seRtspResolution():
if not _get_streameye_enabled():
return None
return {
'label': 'RTSP Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices',
'choices': RTSP_RESOLUTION_CHOICES,
'section': 'device',
'camera': True,
'required': True,
'depends': ['seProto==rtsp'],
'get': _get_raspimjpeg_settings, 'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings, 'set': _set_raspimjpeg_settings,
'get_set_dict': True 'get_set_dict': True

View File

@ -130,6 +130,14 @@ function start() {
raspimjpeg_opts="${raspimjpeg_opts} --${line}" raspimjpeg_opts="${raspimjpeg_opts} --${line}"
done < ${RASPIMJPEG_CONF} done < ${RASPIMJPEG_CONF}
video_height=$(grep -e ^rtsp_height ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_height}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --height ${video_height}"
fi
video_width=$(grep -e ^rtsp_width ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_width}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --width ${video_width}"
fi
video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2) video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_iso}" ]; then if [ -n "${video_iso}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}" raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}"

View File

@ -124,6 +124,27 @@ RESOLUTION_CHOICES = [
('3280x2464', '3280x2464') ('3280x2464', '3280x2464')
] ]
RTSP_RESOLUTION_CHOICES = [
('320x200', '320x200'),
('320x240', '320x240'),
('640x480', '640x480'),
('800x480', '800x480'),
('800x600', '800x600'),
('1024x576', '1024x576'),
('1024x768', '1024x768'),
('1280x720', '1280x720'),
('1280x800', '1280x800'),
('1280x960', '1280x960'),
('1280x1024', '1280x1024'),
('1296x972', '1296x972'),
('1440x960', '1440x960'),
('1440x1024', '1440x1024'),
('1600x1200', '1600x1200'),
('1640x922', '1640x922'),
('1640x1232', '1640x1232'),
('1920x1080', '1920x1080')
]
ROTATION_CHOICES = [ ROTATION_CHOICES = [
('0', '0&deg;'), ('0', '0&deg;'),
('90', '90&deg;'), ('90', '90&deg;'),
@ -311,6 +332,8 @@ def _get_raspimjpeg_settings(camera_id):
'imxfx': 'none', 'imxfx': 'none',
'width': 640, 'width': 640,
'height': 480, 'height': 480,
'rtsp_width': 640,
'rtsp_height': 480,
'rotation': 0, 'rotation': 0,
'vflip': False, 'vflip': False,
'hflip': False, 'hflip': False,
@ -372,6 +395,7 @@ def _get_raspimjpeg_settings(camera_id):
s['sharpness'] = (s['sharpness'] + 100) / 2 s['sharpness'] = (s['sharpness'] + 100) / 2
s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height')) s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height'))
s['rtspResolution'] = '%sx%s' % (s.pop('rtsp_width'), s.pop('rtsp_height'))
s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items()) s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items())
@ -383,6 +407,8 @@ def _set_raspimjpeg_settings(camera_id, s):
s['width'] = int(s['resolution'].split('x')[0]) s['width'] = int(s['resolution'].split('x')[0])
s['height'] = int(s.pop('resolution').split('x')[1]) s['height'] = int(s.pop('resolution').split('x')[1])
s['rtsp_width'] = int(s['rtspResolution'].split('x')[0])
s['rtsp_height'] = int(s.pop('rtspResolution').split('x')[1])
s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % ( s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % (
s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0, s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0,
@ -705,13 +731,33 @@ def seResolution():
return None return None
return { return {
'label': 'Video Resolution', 'label': 'MJPEG Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)', 'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices', 'type': 'choices',
'choices': RESOLUTION_CHOICES, 'choices': RESOLUTION_CHOICES,
'section': 'device', 'section': 'device',
'camera': True, 'camera': True,
'required': True, 'required': True,
'depends': ['seProto==mjpeg'],
'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings,
'get_set_dict': True
}
@additional_config
def seRtspResolution():
if not _get_streameye_enabled():
return None
return {
'label': 'RTSP Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices',
'choices': RTSP_RESOLUTION_CHOICES,
'section': 'device',
'camera': True,
'required': True,
'depends': ['seProto==rtsp'],
'get': _get_raspimjpeg_settings, 'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings, 'set': _set_raspimjpeg_settings,
'get_set_dict': True 'get_set_dict': True

View File

@ -130,6 +130,14 @@ function start() {
raspimjpeg_opts="${raspimjpeg_opts} --${line}" raspimjpeg_opts="${raspimjpeg_opts} --${line}"
done < ${RASPIMJPEG_CONF} done < ${RASPIMJPEG_CONF}
video_height=$(grep -e ^rtsp_height ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_height}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --height ${video_height}"
fi
video_width=$(grep -e ^rtsp_width ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_width}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --width ${video_width}"
fi
video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2) video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_iso}" ]; then if [ -n "${video_iso}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}" raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}"

View File

@ -124,6 +124,27 @@ RESOLUTION_CHOICES = [
('3280x2464', '3280x2464') ('3280x2464', '3280x2464')
] ]
RTSP_RESOLUTION_CHOICES = [
('320x200', '320x200'),
('320x240', '320x240'),
('640x480', '640x480'),
('800x480', '800x480'),
('800x600', '800x600'),
('1024x576', '1024x576'),
('1024x768', '1024x768'),
('1280x720', '1280x720'),
('1280x800', '1280x800'),
('1280x960', '1280x960'),
('1280x1024', '1280x1024'),
('1296x972', '1296x972'),
('1440x960', '1440x960'),
('1440x1024', '1440x1024'),
('1600x1200', '1600x1200'),
('1640x922', '1640x922'),
('1640x1232', '1640x1232'),
('1920x1080', '1920x1080')
]
ROTATION_CHOICES = [ ROTATION_CHOICES = [
('0', '0&deg;'), ('0', '0&deg;'),
('90', '90&deg;'), ('90', '90&deg;'),
@ -311,6 +332,8 @@ def _get_raspimjpeg_settings(camera_id):
'imxfx': 'none', 'imxfx': 'none',
'width': 640, 'width': 640,
'height': 480, 'height': 480,
'rtsp_width': 640,
'rtsp_height': 480,
'rotation': 0, 'rotation': 0,
'vflip': False, 'vflip': False,
'hflip': False, 'hflip': False,
@ -372,6 +395,7 @@ def _get_raspimjpeg_settings(camera_id):
s['sharpness'] = (s['sharpness'] + 100) / 2 s['sharpness'] = (s['sharpness'] + 100) / 2
s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height')) s['resolution'] = '%sx%s' % (s.pop('width'), s.pop('height'))
s['rtspResolution'] = '%sx%s' % (s.pop('rtsp_width'), s.pop('rtsp_height'))
s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items()) s = dict(('se' + n[0].upper() + n[1:], v) for (n, v) in s.items())
@ -383,6 +407,8 @@ def _set_raspimjpeg_settings(camera_id, s):
s['width'] = int(s['resolution'].split('x')[0]) s['width'] = int(s['resolution'].split('x')[0])
s['height'] = int(s.pop('resolution').split('x')[1]) s['height'] = int(s.pop('resolution').split('x')[1])
s['rtsp_width'] = int(s['rtspResolution'].split('x')[0])
s['rtsp_height'] = int(s.pop('rtspResolution').split('x')[1])
s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % ( s['zoom'] = '%.2f,%.2f,%.2f,%.2f' % (
s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0, s.pop('zoomx') / 100.0, s.pop('zoomy') / 100.0,
@ -705,13 +731,33 @@ def seResolution():
return None return None
return { return {
'label': 'Video Resolution', 'label': 'MJPEG Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)', 'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices', 'type': 'choices',
'choices': RESOLUTION_CHOICES, 'choices': RESOLUTION_CHOICES,
'section': 'device', 'section': 'device',
'camera': True, 'camera': True,
'required': True, 'required': True,
'depends': ['seProto==mjpeg'],
'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings,
'get_set_dict': True
}
@additional_config
def seRtspResolution():
if not _get_streameye_enabled():
return None
return {
'label': 'RTSP Video Resolution',
'description': 'the video resolution (larger values produce better quality but require more CPU power, larger storage space and bandwidth)',
'type': 'choices',
'choices': RTSP_RESOLUTION_CHOICES,
'section': 'device',
'camera': True,
'required': True,
'depends': ['seProto==rtsp'],
'get': _get_raspimjpeg_settings, 'get': _get_raspimjpeg_settings,
'set': _set_raspimjpeg_settings, 'set': _set_raspimjpeg_settings,
'get_set_dict': True 'get_set_dict': True

View File

@ -130,6 +130,14 @@ function start() {
raspimjpeg_opts="${raspimjpeg_opts} --${line}" raspimjpeg_opts="${raspimjpeg_opts} --${line}"
done < ${RASPIMJPEG_CONF} done < ${RASPIMJPEG_CONF}
video_height=$(grep -e ^rtsp_height ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_height}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --height ${video_height}"
fi
video_width=$(grep -e ^rtsp_width ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_width}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --width ${video_width}"
fi
video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2) video_iso=$(grep -e ^iso ${RASPIMJPEG_CONF} | cut -d ' ' -f 2)
if [ -n "${video_iso}" ]; then if [ -n "${video_iso}" ]; then
raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}" raspimjpeg_opts="${raspimjpeg_opts} --ISO ${video_iso}"