From aa3eeec8a0b9065688a905dfbe10b95b85a3cc0a Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Mon, 12 May 2014 20:49:39 +0300 Subject: [PATCH] better available resolutions detection --- src/v4l2ctl.py | 5 ++++- static/js/main.js | 5 ++++- templates/main.html | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) 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 @@ -- 2.39.5