From: Calin Crisan Date: Mon, 12 May 2014 17:49:39 +0000 (+0300) Subject: better available resolutions detection X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=aa3eeec8a0b9065688a905dfbe10b95b85a3cc0a;p=motioneye-debian better available resolutions detection --- diff --git a/src/v4l2ctl.py b/src/v4l2ctl.py index d097fcf..79e6a0d 100644 --- a/src/v4l2ctl.py +++ b/src/v4l2ctl.py @@ -71,7 +71,7 @@ def list_resolutions(device): logging.debug('listing resolutions of device %(device)s...' % {'device': device}) resolutions = set() - output = subprocess.check_output('v4l2-ctl -d %(device)s --list-formats-ext | grep -oE "[0-9]+x[0-9]+" || true' % { + output = subprocess.check_output('v4l2-ctl -d %(device)s --list-formats-ext | grep -vi stepwise | grep -oE "[0-9]+x[0-9]+" || true' % { 'device': device}, shell=True) for pair in output.split('\n'): @@ -83,6 +83,9 @@ def list_resolutions(device): width = int(width) height = int(height) + if width < 96 or height < 96: # some reasonable minimal values + continue + resolutions.add((width, height)) logging.debug('found resolution %(width)sx%(height)s for device %(device)s' % { diff --git a/static/js/main.js b/static/js/main.js index fc033db..5baf633 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1109,7 +1109,10 @@ function pushCameraConfig() { } /* also update the config stored in the camera frame div */ - Object.update($('div.camera-frame#camera' + cameraId)[0].config, cameraConfig); + var cameraFrame = $('div.camera-frame#camera' + cameraId); + if (cameraFrame.length) { + Object.update(cameraFrame[0].config, cameraConfig); + } } function pushPreview(control) { diff --git a/templates/main.html b/templates/main.html index 3d5594e..41a5e53 100644 --- a/templates/main.html +++ b/templates/main.html @@ -473,7 +473,7 @@