]> www.vanbest.org Git - motioneye-debian/commitdiff
implemented a streaming resoution (as percent of the video resolution)
authorCalin Crisan <ccrisan@gmail.com>
Sun, 24 Nov 2013 15:49:02 +0000 (17:49 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 24 Nov 2013 15:49:02 +0000 (17:49 +0200)
src/config.py
src/mediafiles.py
static/js/main.js
static/js/ui.js

index ac0e8eab422db0374ee688c9a44d552d4f5ee063..0a9ab30b3a1672f6fcc5d8f59a10c51c023e89f7 100644 (file)
@@ -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'],
index aa0b2e53c63202e630db6303e43a076af18769c8..df98a80622cd47d34d9f12d738f5f0fd248cc922 100644 (file)
@@ -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
     
index 829c218b07a8217afc62759f94270727973dfd9a..97dace887f0bc98ad273e375ad3b2e5ea1c5656b 100644 (file)
@@ -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('<img class="main-loading-progress" src="' + staticUrl + 'img/main-loading-progress.gif">');
+    
     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('<img class="main-loading-progress" src="' + staticUrl + 'img/main-loading-progress.gif">');
 }
 
 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() {
index 686e0e254671a4c36f426f66565721870c6baa61..b4ad04b5382bbbb212805f5ef5ccf58b3f37490b 100644 (file)
@@ -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();
     };