From 9da528754982515a6aacc144627e6f594169fae7 Mon Sep 17 00:00:00 2001 From: stan Date: Sun, 30 Mar 2003 18:44:15 +0000 Subject: [PATCH] Added option to switch off throttling during alarms. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@443 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_config.h.z | 2 ++ src/zmc.cpp | 45 ++++++++++++++++++++++++++------------------- zmconfig.pl.in | 9 ++++++++- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/zm_config.h.z b/src/zm_config.h.z index 216bfe974..c5a67ab50 100644 --- a/src/zm_config.h.z +++ b/src/zm_config.h.z @@ -42,3 +42,5 @@ #define ZM_STRICT_VIDEO_CONFIG // Whether to allow errors in setting video config to be fatal #define ZM_LOCAL_BGR_INVERT // Invert BGR colours to RGB #define ZM_BLEND_ALARMED_IMAGES // Whether alarmed images are blended to update the reference image +#define ZM_NO_MAX_FPS_ON_ALARM // Should any Maximum FPS be ignored if an alarm occurs + diff --git a/src/zmc.cpp b/src/zmc.cpp index e57565462..da2581e18 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -186,30 +186,37 @@ int main( int argc, char *argv[] ) for ( int i = 0; i < n_monitors; i++ ) { long min_delay = MAXINT; - gettimeofday( &now, &dummy_tz ); - for ( int j = 0; j < n_monitors; j++ ) + if ( ZM_NO_MAX_FPS_ON_ALARM && monitors[i]->GetState() == Monitor::ALARM ) { - if ( last_capture_times[j].tv_sec ) + next_delays[i] = 0; + } + else + { + gettimeofday( &now, &dummy_tz ); + for ( int j = 0; j < n_monitors; j++ ) { - static struct DeltaTimeval delta_time; - //Info(( "Now %d.%d", now.tv_sec, now.tv_usec )); - //Info(( "Capture %d.%d", last_capture_times[j].tv_sec, last_capture_times[j].tv_usec )); - DELTA_TIMEVAL( delta_time, now, last_capture_times[j] ); - //Info(( "Delta %d-%d.%d", delta_time.positive, delta_time.tv_sec, delta_time.tv_usec )); - next_delays[j] = capture_delays[j]-((delta_time.tv_sec*1000000)+delta_time.tv_usec); - if ( next_delays[j] < 0 ) + if ( last_capture_times[j].tv_sec ) + { + static struct DeltaTimeval delta_time; + //Info(( "Now %d.%d", now.tv_sec, now.tv_usec )); + //Info(( "Capture %d.%d", last_capture_times[j].tv_sec, last_capture_times[j].tv_usec )); + DELTA_TIMEVAL( delta_time, now, last_capture_times[j] ); + //Info(( "Delta %d-%d.%d", delta_time.positive, delta_time.tv_sec, delta_time.tv_usec )); + next_delays[j] = capture_delays[j]-((delta_time.tv_sec*1000000)+delta_time.tv_usec); + if ( next_delays[j] < 0 ) + { + next_delays[j] = 0; + } + } + else { next_delays[j] = 0; } - } - else - { - next_delays[j] = 0; - } - //Info(( "%d: %d", j, next_delays[j] )); - if ( next_delays[j] <= min_delay ) - { - min_delay = next_delays[j]; + //Info(( "%d: %d", j, next_delays[j] )); + if ( next_delays[j] <= min_delay ) + { + min_delay = next_delays[j]; + } } } if ( next_delays[i] <= min_delay || next_delays[i] <= 0 ) diff --git a/zmconfig.pl.in b/zmconfig.pl.in index 483595dd8..faf16de6c 100755 --- a/zmconfig.pl.in +++ b/zmconfig.pl.in @@ -222,10 +222,17 @@ my @options = { name => "ZM_BLEND_ALARMED_IMAGES", default => "yes", - description => "Whether alarmed images are blended to update the reference image ", + description => "Whether alarmed images are blended to update the reference image", help => "To detect alarms ZoneMinder compares an image with a reference image which is formed from a composite of the previous images. This option determines whether images that cause events are included in this process. Doing so may increase the precision of the alarmed region but can cause problems if wholescale lighting changes cause alarms as this would not get fed back into the image.", type => $types{boolean}, }, + { + name => "ZM_NO_MAX_FPS_ON_ALARM", + default => "yes", + description => "Should any Maximum FPS be ignored if an alarm occurs", + help => "When configuring monitors you can optionally specify a maximum setting for the capture rate rate in frames per second. This can used to limit your video or network bandwidth or reduce CPU load. This setting tells ZoneMinder to ignore these constraints if an alarm is detected an attempt to capture as fast as possible.", + type => $types{boolean}, + }, { name => "ZM_OPT_REMOTE_CAMERAS", default => "no",