From: Calin Crisan Date: Sun, 24 Nov 2013 15:49:02 +0000 (+0200) Subject: implemented a streaming resoution (as percent of the video resolution) X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=652b8efd254d9c5745c2361ea1255d8ec613f9dc;p=motioneye-debian implemented a streaming resoution (as percent of the video resolution) --- diff --git a/src/config.py b/src/config.py index ac0e8ea..0a9ab30 100644 --- a/src/config.py +++ b/src/config.py @@ -439,7 +439,7 @@ def camera_ui_to_dict(ui): # streaming 'webcam_localhost': not ui['video_streaming'], 'webcam_port': int(ui['streaming_port']), - 'webcam_maxrate': int(['streaming_framerate']), + 'webcam_maxrate': int(ui['streaming_framerate']), 'webcam_quality': max(1, int(ui['streaming_quality'])), '@webcam_resolution': max(1, int(ui['streaming_resolution'])), 'webcam_motion': ui['streaming_motion'], diff --git a/src/mediafiles.py b/src/mediafiles.py index aa0b2e5..df98a80 100644 --- a/src/mediafiles.py +++ b/src/mediafiles.py @@ -298,6 +298,13 @@ def get_current_picture(camera_config, width, height): width = width and int(width) or image.size[0] height = height and int(height) or image.size[1] + webcam_resolution = camera_config['@webcam_resolution'] + max_width = image.size[0] * webcam_resolution / 100 + max_height = image.size[1] * webcam_resolution / 100 + + width = min(max_width, width) + height = min(max_height, height) + if width >= image.size[0] and height >= image.size[1]: return jpg # no enlarging of the picture on the server side diff --git a/static/js/main.js b/static/js/main.js index 829c218..97dace8 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -172,13 +172,13 @@ function initUI() { {value: 25, label: '25'}, {value: 30, label: '30'} ], null, 0); - makeSlider($('#streamingQualitySlider'), 0, 100, 0, null, 5, 0, '%'); - makeSlider($('#streamingResolutionSlider'), 0, 100, 0, null, 5, 0, '%'); - makeSlider($('#imageQualitySlider'), 0, 100, 0, null, 5, 0, '%'); - makeSlider($('#movieQualitySlider'), 0, 100, 0, null, 5, 0, '%'); + makeSlider($('#streamingQualitySlider'), 0, 100, 2, null, 5, 0, '%'); + makeSlider($('#streamingResolutionSlider'), 0, 100, 2, null, 5, 0, '%'); + makeSlider($('#imageQualitySlider'), 0, 100, 2, null, 5, 0, '%'); + makeSlider($('#movieQualitySlider'), 0, 100, 2, null, 5, 0, '%'); thresholdSlider = makeSlider($('#frameChangeThresholdSlider'), 0, 20000, 0, null, 3, 0, 'px'); - makeSlider($('#noiseLevelSlider'), 0, 100, 0, null, 5, 0, '%'); + makeSlider($('#noiseLevelSlider'), 0, 100, 2, null, 5, 0, '%'); /* text validators */ makeTextValidator($('#adminUsernameEntry'), true); @@ -727,6 +727,9 @@ function showApply() { function showProgress() { refreshDisabled++; + /* replace the main page message with a progress indicator */ + $('div.add-camera-message').html(''); + if (!$('div.settings-container').is(':visible')) { return; /* settings panel is not open */ } @@ -743,7 +746,6 @@ function showProgress() { applyButton.addClass('progress'); $('div.camera-progress').css('opacity', '0.5'); - $('div.add-camera-message').html(''); } function hideApply() { @@ -761,6 +763,7 @@ function hideApply() { function endProgress() { refreshDisabled--; + $('div.add-camera-message').remove(); /* remove any existing message on the main page */ if (Object.keys(pushConfigs).length === 0) { hideApply(); @@ -770,7 +773,6 @@ function endProgress() { } $('div.camera-progress').css('opacity', '0'); - $('div.add-camera-message').remove(); /* in case the message exists */ } function isProgress() { diff --git a/static/js/ui.js b/static/js/ui.js index 686e0e2..b4ad04b 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -173,17 +173,20 @@ function makeSlider($input, minVal, maxVal, snapMode, ticks, ticksNumber, decima labels.html(''); - var i, ticks = []; - for (i = 0; i < ticksNumber; i++) { - var val = minVal + i * (maxVal - minVal) / (ticksNumber - 1); - var valStr; - if (Math.round(val) == val) { - valStr = '' + val; - } - else { - valStr = val.toFixed(decimals); + if (autoTicks) { + ticks = []; + var i; + for (i = 0; i < ticksNumber; i++) { + var val = minVal + i * (maxVal - minVal) / (ticksNumber - 1); + var valStr; + if (Math.round(val) == val) { + valStr = '' + val; + } + else { + valStr = val.toFixed(decimals); + } + ticks.push({value: val, label: valStr + unit}); } - ticks.push({value: val, label: valStr + unit}); } for (i = 0; i < ticks.length; i++) { @@ -198,9 +201,7 @@ function makeSlider($input, minVal, maxVal, snapMode, ticks, ticksNumber, decima return ticks; } - if (autoTicks) { - ticks = makeTicks(); - } + makeTicks(); function input2slider() { var value = parseFloat($input.val()); @@ -274,17 +275,13 @@ function makeSlider($input, minVal, maxVal, snapMode, ticks, ticksNumber, decima slider.setMinVal = function (mv) { minVal = mv; - if (autoTicks) { - ticks = makeTicks(); - } + makeTicks(); }; slider.setMaxVal = function (mv) { maxVal = mv; - if (autoTicks) { - ticks = makeTicks(); - } + makeTicks(); input2slider(); };