diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 2172d4d1b9..71041f1373 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -359,6 +359,7 @@ CREATE TABLE `Monitors` ( `FrameSkip` smallint(5) unsigned NOT NULL default '0', `MotionFrameSkip` smallint(5) unsigned NOT NULL default '0', `AnalysisFPS` decimal(5,2) default NULL, + `AnalysisUpdateDelay` smallint(5) unsigned NOT NULL default '0', `MaxFPS` decimal(5,2) default NULL, `AlarmMaxFPS` decimal(5,2) default NULL, `FPSReportInterval` smallint(5) unsigned NOT NULL default '250', diff --git a/db/zm_update-1.28.101.sql b/db/zm_update-1.28.101.sql index 5dd76f99a3..d667e0398a 100644 --- a/db/zm_update-1.28.101.sql +++ b/db/zm_update-1.28.101.sql @@ -20,3 +20,20 @@ SET @s = (SELECT IF( PREPARE stmt FROM @s; EXECUTE stmt; +-- +-- Add AnalysisUpdateDelay column to Monitors +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Monitors' + AND table_schema = DATABASE() + AND column_name = 'AnalysisUpdateDelay' + ) > 0, +"SELECT 'Column AnalysisUpdateDelay exists in Monitors'", +"ALTER TABLE Monitors ADD `AnalysisUpdateDelay` smallint(5) unsigned not null default 0 AFTER `AnalysisFPS`" + +PREPARE stmt FROM @s; +EXECUTE stmt; + diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index f4b6ea4646..a8674d6f1c 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -282,6 +282,7 @@ Monitor::Monitor( int p_frame_skip, int p_motion_frame_skip, double p_analysis_fps, + int p_analysis_update_delay, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, @@ -309,6 +310,7 @@ Monitor::Monitor( frame_skip( p_frame_skip ), motion_frame_skip( p_motion_frame_skip ), analysis_fps( p_analysis_fps ), + analysis_update_delay( p_analysis_update_delay ), capture_delay( p_capture_delay ), alarm_capture_delay( p_alarm_capture_delay ), alarm_frame_count( p_alarm_frame_count ), @@ -353,7 +355,6 @@ Monitor::Monitor( fps = 0.0; event_count = 0; image_count = 0; - processed_image_count = 0; ready_count = warmup_count; first_alarm_count = 0; last_alarm_count = 0; @@ -443,7 +444,6 @@ Monitor::Monitor( zones[0] = new Zone( this, 0, "All", Zone::ACTIVE, Polygon( sizeof(coords)/sizeof(*coords), coords ), RGB_RED, Zone::BLOBS ); } start_time = last_fps_time = time( 0 ); - last_analysis_time = (double)start_time; event = 0; @@ -498,6 +498,9 @@ Monitor::Monitor( n_linked_monitors = 0; linked_monitors = 0; + + adaptive_skip = true; + ReloadLinkedMonitors( p_linked_monitors ); } } @@ -788,6 +791,41 @@ double Monitor::GetFPS() const return( curr_fps ); } +useconds_t Monitor::GetAnalysisRate() +{ + double capturing_fps = GetFPS(); + if ( !analysis_fps || ( analysis_fps > capturing_fps ) ) + { + return( 0 ); + } + else + { + return( 1000000 / analysis_fps ); + } +} + +void Monitor::UpdateAdaptiveSkip() +{ + if ( config.opt_adaptive_skip ) + { + double capturing_fps = GetFPS(); + if ( adaptive_skip && analysis_fps && ( analysis_fps < capturing_fps ) ) + { + Info( "Analysis fps (%.2f) is lower than capturing fps (%.2f), disabling adaptive skip", analysis_fps, capturing_fps ); + adaptive_skip = false; + } + else if ( !adaptive_skip && ( analysis_fps >= capturing_fps ) ) + { + Info( "Enabling adaptive skip" ); + adaptive_skip = true; + } + } + else + { + adaptive_skip = false; + } +} + void Monitor::ForceAlarmOn( int force_score, const char *force_cause, const char *force_text ) { trigger_data->trigger_state = TRIGGER_ON; @@ -1177,27 +1215,15 @@ bool Monitor::Analyse() struct timeval now; gettimeofday( &now, NULL ); - // Compute the current fps - fps = double( 1 / ( now.tv_sec + now.tv_usec / 1000000.0 - last_analysis_time ) ); - - // Skip frame if the current fps is above the requested analysis fps - if ( ( analysis_fps > 0 ) && ( fps > analysis_fps ) ) + if ( image_count && fps_report_interval && !(image_count%fps_report_interval) ) { - shared_data->last_read_index = shared_data->last_write_index; - shared_data->last_read_time = now.tv_sec; - image_count++; - return( true ); - } - - if ( processed_image_count && fps_report_interval && !(processed_image_count%fps_report_interval) ) - { - // fps = double(fps_report_interval)/(now.tv_sec-last_fps_time); - Info( "%s: %d - Processing at %.2f fps", name, processed_image_count, fps ); + fps = double(fps_report_interval)/(now.tv_sec-last_fps_time); + Info( "%s: %d - Analysing at %.2f fps", name, image_count, fps ); last_fps_time = now.tv_sec; } int index; - if ( config.opt_adaptive_skip ) + if ( adaptive_skip ) { int read_margin = shared_data->last_read_index - shared_data->last_write_index; if ( read_margin < 0 ) read_margin += image_buffer_count; @@ -1672,9 +1698,7 @@ bool Monitor::Analyse() shared_data->last_read_index = index%image_buffer_count; //shared_data->last_read_time = image_buffer[index].timestamp->tv_sec; shared_data->last_read_time = now.tv_sec; - last_analysis_time = now.tv_sec + now.tv_usec / 1000000.0; image_count++; - processed_image_count++; return( true ); } @@ -1689,7 +1713,7 @@ void Monitor::Reload() closeEvent(); static char sql[ZM_SQL_MED_BUFSIZ]; - snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id ); + snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id ); if ( mysql_query( &dbconn, sql ) ) { @@ -1727,6 +1751,7 @@ void Monitor::Reload() frame_skip = atoi(dbrow[index++]); motion_frame_skip = atoi(dbrow[index++]); analysis_fps = atof(dbrow[index++]); + analysis_update_delay = atoi(dbrow[index++]); capture_delay = (dbrow[index]&&atof(dbrow[index])>0.0)?int(DT_PREC_3/atof(dbrow[index])):0; index++; alarm_capture_delay = (dbrow[index]&&atof(dbrow[index])>0.0)?int(DT_PREC_3/atof(dbrow[index])):0; index++; fps_report_interval = atoi(dbrow[index++]); @@ -1882,11 +1907,11 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose static char sql[ZM_SQL_MED_BUFSIZ]; if ( !device[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device ); } if ( mysql_query( &dbconn, sql ) ) { @@ -1966,6 +1991,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame ); int frame_skip = atoi(dbrow[col]); col++; int motion_frame_skip = atoi(dbrow[col]); col++; double analysis_fps = atof(dbrow[col]); col++; + int analysis_update_delay = atoi(dbrow[col]); col++; int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; @@ -2027,6 +2053,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame ); frame_skip, motion_frame_skip, analysis_fps, + analysis_update_delay, capture_delay, alarm_capture_delay, fps_report_interval, @@ -2060,11 +2087,11 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c static char sql[ZM_SQL_MED_BUFSIZ]; if ( !protocol ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2125,6 +2152,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c int frame_skip = atoi(dbrow[col]); col++; int motion_frame_skip = atoi(dbrow[col]); col++; double analysis_fps = atof(dbrow[col]); col++; + int analysis_update_delay = atoi(dbrow[col]); col++; int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; @@ -2202,6 +2230,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c frame_skip, motion_frame_skip, analysis_fps, + analysis_update_delay, capture_delay, alarm_capture_delay, fps_report_interval, @@ -2235,11 +2264,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu static char sql[ZM_SQL_MED_BUFSIZ]; if ( !file[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2296,6 +2325,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu int frame_skip = atoi(dbrow[col]); col++; int motion_frame_skip = atoi(dbrow[col]); col++; double analysis_fps = atof(dbrow[col]); col++; + int analysis_update_delay = atoi(dbrow[col]); col++; int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; @@ -2341,6 +2371,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu frame_skip, motion_frame_skip, analysis_fps, + analysis_update_delay, capture_delay, alarm_capture_delay, fps_report_interval, @@ -2374,11 +2405,11 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose static char sql[ZM_SQL_MED_BUFSIZ]; if ( !file[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Method, Options, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Method, Options, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Method, Options, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Method, Options, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2437,6 +2468,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose int frame_skip = atoi(dbrow[col]); col++; int motion_frame_skip = atoi(dbrow[col]); col++; double analysis_fps = atof(dbrow[col]); col++; + int analysis_update_delay = atoi(dbrow[col]); col++; int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; @@ -2484,6 +2516,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose frame_skip, motion_frame_skip, analysis_fps, + analysis_update_delay, capture_delay, alarm_capture_delay, fps_report_interval, @@ -2515,7 +2548,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) { static char sql[ZM_SQL_MED_BUFSIZ]; - snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Protocol, Method, Host, Port, Path, Options, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id ); + snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Protocol, Method, Host, Port, Path, Options, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id ); if ( mysql_query( &dbconn, sql ) ) { Error( "Can't run query: %s", mysql_error( &dbconn ) ); @@ -2603,6 +2636,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame ); int frame_skip = atoi(dbrow[col]); col++; int motion_frame_skip = atoi(dbrow[col]); col++; double analysis_fps = atof(dbrow[col]); col++; + int analysis_update_delay = atoi(dbrow[col]); col++; int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; @@ -2799,6 +2833,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame ); frame_skip, motion_frame_skip, analysis_fps, + analysis_update_delay, capture_delay, alarm_capture_delay, fps_report_interval, diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 927e58ddfa..20bc6c4373 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -232,9 +232,11 @@ friend class MonitorStream; int post_event_count; // How many unalarmed images must occur before the alarm state is reset int stream_replay_buffer; // How many frames to store to support DVR functions, IGNORED from this object, passed directly into zms now int section_length; // How long events should last in continuous modes + bool adaptive_skip; // Whether to use the newer adaptive algorithm for this monitor int frame_skip; // How many frames to skip in continuous modes int motion_frame_skip; // How many frames to skip in motion detection double analysis_fps; // Target framerate for video analysis + int analysis_update_delay; // How long we wait before updating analysis parameters int capture_delay; // How long we wait between capture frames int alarm_capture_delay; // How long we wait between capture frames when in alarm state int alarm_frame_count; // How many alarm frames are required before an event is triggered @@ -253,7 +255,6 @@ friend class MonitorStream; Purpose purpose; // What this monitor has been created to do int event_count; int image_count; - int processed_image_count; int ready_count; int first_alarm_count; int last_alarm_count; @@ -262,7 +263,6 @@ friend class MonitorStream; State state; time_t start_time; time_t last_fps_time; - double last_analysis_time; time_t auto_resume_time; unsigned int last_motion_score; @@ -301,7 +301,7 @@ friend class MonitorStream; public: // OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info. //bool OurCheckAlarms( Zone *zone, const Image *pImage ); - Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_motion_frame_skip, double p_analysis_fps, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 ); + Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_motion_frame_skip, double p_analysis_fps, int p_analysis_update_delay, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 ); ~Monitor(); void AddZones( int p_n_zones, Zone *p_zones[] ); @@ -356,6 +356,9 @@ friend class MonitorStream; State GetState() const; int GetImage( int index=-1, int scale=100 ); struct timeval GetTimestamp( int index=-1 ) const; + void UpdateAdaptiveSkip(); + useconds_t GetAnalysisRate(); + int GetAnalysisUpdateDelay() const { return( analysis_update_delay ); } int GetCaptureDelay() const { return( capture_delay ); } int GetAlarmCaptureDelay() const { return( alarm_capture_delay ); } unsigned int GetLastReadIndex() const; diff --git a/src/zma.cpp b/src/zma.cpp index fdf15303e7..4c80163278 100644 --- a/src/zma.cpp +++ b/src/zma.cpp @@ -153,14 +153,36 @@ int main( int argc, char *argv[] ) sigset_t block_set; sigemptyset( &block_set ); + useconds_t analysis_rate = monitor->GetAnalysisRate(); + int analysis_update_delay = monitor->GetAnalysisUpdateDelay(); + time_t last_analysis_update_time, cur_time; + monitor->UpdateAdaptiveSkip(); + last_analysis_update_time = time( 0 ); + while( !zm_terminate ) { // Process the next image sigprocmask( SIG_BLOCK, &block_set, 0 ); + + cur_time = time( 0 ); + + // Some periodic updates are required for variable capturing framerate + if ( analysis_update_delay && ( ( cur_time - last_analysis_update_time ) > analysis_update_delay ) ) + { + analysis_rate = monitor->GetAnalysisRate(); + monitor->UpdateAdaptiveSkip(); + last_analysis_update_time = cur_time; + } + if ( !monitor->Analyse() ) { usleep( monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE ); } + else if ( analysis_rate ) + { + usleep( analysis_rate ); + } + if ( zm_reload ) { monitor->Reload(); diff --git a/web/lang/big5_big5.php b/web/lang/big5_big5.php index ad5b3420b9..7f4b52d9b9 100644 --- a/web/lang/big5_big5.php +++ b/web/lang/big5_big5.php @@ -96,6 +96,7 @@ 'Alert' => '警告', 'All' => '全部', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => '確定', 'ApplyingStateChange' => '確定狀態改變', 'ArchArchived' => 'Archived Only', @@ -133,6 +134,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/cn_zh.php b/web/lang/cn_zh.php index c1766539e8..7b8232e1bd 100644 --- a/web/lang/cn_zh.php +++ b/web/lang/cn_zh.php @@ -92,6 +92,7 @@ 'Alert' => '警报', 'All' => '全部', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => '应用', 'ApplyingStateChange' => '状态改变生效', 'ArchArchived' => '仅限于存档', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => '报警帧数必须设为大于1的整数', 'BadAlarmMaxFPS' => '报警最大帧率必须是正整数或正浮点数', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => '通道必须设为大于零的整数', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => '必须为器件设置有效值', diff --git a/web/lang/cs_cz.php b/web/lang/cs_cz.php index 63df8dd845..88f7b05b7d 100644 --- a/web/lang/cs_cz.php +++ b/web/lang/cs_cz.php @@ -92,6 +92,7 @@ 'Alert' => 'Pozor', 'All' => 'Vechny', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Pout', 'ApplyingStateChange' => 'Aplikuji zmnu stavu', 'ArchArchived' => 'Pouze archivovan', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/de_de.php b/web/lang/de_de.php index 857d0b12da..13b3e4835e 100644 --- a/web/lang/de_de.php +++ b/web/lang/de_de.php @@ -94,6 +94,7 @@ 'Alert' => 'Alarm', 'All' => 'Alle', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Anwenden', 'ApplyingStateChange' => 'Aktiviere neuen Status', 'ArchArchived' => 'Nur Archivierte', @@ -131,6 +132,7 @@ 'BadAlarmFrameCount' => 'Die Bildanzahl muss ganzzahlig 1 oder größer sein', 'BadAlarmMaxFPS' => 'Alarm-Maximum-FPS muss eine positive Ganzzahl oder eine Gleitkommazahl sein', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Der Kanal muss ganzzahlig 0 oder größer sein', 'BadColours' => 'Zielfarbe muss auf einen gültigen Wert gesetzt werden', // Added - 2011-06-15 'BadDevice' => 'Das Gerät muss eine gültige Systemresource sein', diff --git a/web/lang/dk_dk.php b/web/lang/dk_dk.php index 0b843564c9..8ba852bd28 100644 --- a/web/lang/dk_dk.php +++ b/web/lang/dk_dk.php @@ -93,6 +93,7 @@ 'Alert' => 'Alarm', 'All' => 'Alle', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Aktiver', 'ApplyingStateChange' => 'Aktivere State ndring', 'ArchArchived' => 'Kun Arkiverede', @@ -130,6 +131,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index 93df57c8b6..82725fb58f 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -101,6 +101,7 @@ 'Alert' => 'Alert', 'All' => 'All', 'AnalysisFPS' => 'Analysis FPS', + 'AnalysisUpdateDelay' => 'Analysis Update Delay', 'Apply' => 'Apply', 'ApplyingStateChange' => 'Applying State Change', 'ArchArchived' => 'Archived Only', @@ -139,6 +140,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadDevice' => 'Device must be set to a valid value', 'BadFormat' => 'Format must be set to a valid value', diff --git a/web/lang/es_ar.php b/web/lang/es_ar.php index 7570fd0662..cb050361a6 100644 --- a/web/lang/es_ar.php +++ b/web/lang/es_ar.php @@ -43,6 +43,7 @@ 'Alert' => 'Alerta', 'All' => 'Todo', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Aplicar', 'ApplyingStateChange' => 'Aplicar Cambio Estado', 'ArchArchived' => 'Solo Archivados', @@ -80,6 +81,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/es_es.php b/web/lang/es_es.php index 5a820b4d99..df328fe1db 100644 --- a/web/lang/es_es.php +++ b/web/lang/es_es.php @@ -92,6 +92,7 @@ 'Alert' => 'Alerta', 'All' => 'Todo', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Aplicar', 'ApplyingStateChange' => 'Aplicando cambio de estado...', 'ArchArchived' => 'Sólo archivados', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'El número de marcos de alarma debe tener un número entero de uno o más', 'BadAlarmMaxFPS' => 'Máximos MPS de alarma debe ser un valor entero positivo o de punto flotante', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'El canal debe estar establecido en un entero de cero o más', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2015-04-18 'BadDevice' => 'El dispositivo debe tener un valor válido', diff --git a/web/lang/et_ee.php b/web/lang/et_ee.php index 0bee5d798a..f6777bbf95 100644 --- a/web/lang/et_ee.php +++ b/web/lang/et_ee.php @@ -93,6 +93,7 @@ 'Alert' => 'Hoiatus', 'All' => 'All', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Apply', 'ApplyingStateChange' => 'Applying State Change', 'ArchArchived' => 'Arhiveeritud Ainult', @@ -130,6 +131,7 @@ 'BadAlarmFrameCount' => 'Alarmi kaadri hulga ühik peab olema integer. Kas üks või rohkem', 'BadAlarmMaxFPS' => 'Alarmi maksimaalne FPS peab olema positiivne integer või floating point väärtus', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Kanal peab olema integer, null või rohkem', 'BadColours' => 'Sihtmärgi värv peab olema pandud õige väärtus', // Added - 2011-06-15 'BadDevice' => 'Seadmel peab olema õige väärtus', diff --git a/web/lang/fr_fr.php b/web/lang/fr_fr.php index 5d238a94b0..90bfbb8a49 100644 --- a/web/lang/fr_fr.php +++ b/web/lang/fr_fr.php @@ -98,6 +98,7 @@ 'Alert' => 'Alerte', 'All' => 'Tous', 'AnalysisFPS' => 'i/s à traiter en analyse', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Délai mise à jour analyse', // Added - 2015-07-23 'Apply' => 'Appliquer', 'ApplyingStateChange' => 'Appl. chgt état', 'ArchArchived' => 'Archivé seul.', @@ -135,6 +136,7 @@ 'BadAlarmFrameCount' => 'Le nombre d\'images en alarme doit être un entier supérieur ou égal à 1', 'BadAlarmMaxFPS' => 'Le nombre maximum d\'i/s en alarme doit être un entier ou un nombre à virgule flottante supérieur à 0', 'BadAnalysisFPS' => 'Le nombre d\'i/s à traiter en analyse doit être un entier ou un nombre à virgule flottante supérieur à 0', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Le délai de mise à jour analyse doit être un nombre entier supérieur ou égal à 0', // Added - 2015-07-23 'BadChannel' => 'Le canal doit être un nombre entier supérieur ou égal à 0', 'BadColours' => 'La valeur de la couleur cible est invalide', // Added - 2011-06-15 'BadDevice' => 'Le chemin de l\'équipement être défini', diff --git a/web/lang/he_il.php b/web/lang/he_il.php index e69bd08623..c452b52bcf 100644 --- a/web/lang/he_il.php +++ b/web/lang/he_il.php @@ -92,6 +92,7 @@ 'Alert' => '', 'All' => '', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => '', 'ApplyingStateChange' => ' ', 'ArchArchived' => ' ', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/hu_hu.php b/web/lang/hu_hu.php index cd5b5341dc..564e9d1f6f 100644 --- a/web/lang/hu_hu.php +++ b/web/lang/hu_hu.php @@ -135,6 +135,7 @@ 'Alert' => 'Figyelem', 'All' => 'Mind', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Alkalmaz', 'ApplyingStateChange' => 'Állapot váltása...', 'ArchArchived' => 'Csak archivált', @@ -172,6 +173,7 @@ 'BadAlarmFrameCount' => 'Riasztáshoz szükséges képkockák száma legyen legalább 1', 'BadAlarmMaxFPS' => 'Maximális FPS riasztott állapotban legyen megadva', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'A csatorna száma legyen legalább 0', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2015-04-18 'BadDevice' => 'Az eszköz elérése valós legyen', diff --git a/web/lang/it_it.php b/web/lang/it_it.php index 632f431672..22b03ef40f 100644 --- a/web/lang/it_it.php +++ b/web/lang/it_it.php @@ -97,6 +97,7 @@ 'Alert' => 'Attenzione', 'All' => 'Tutto', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Applica', 'ApplyingStateChange' => 'Sto applicando le modifiche', 'ArchArchived' => 'Archiviato', @@ -134,6 +135,7 @@ 'BadAlarmFrameCount' => 'Il numero di frame di un allarme deve essere un numero intero superiore a uno', 'BadAlarmMaxFPS' => 'Il numero massimo di FPS dell\'allarme deve essere un numero intero positivo o un valore in virgola mobile', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Il canale deve essere settato con un numero intero uguale o maggiore di zero', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Il dispositivo deve essere impostato con un valore valido', diff --git a/web/lang/ja_jp.php b/web/lang/ja_jp.php index e628f38146..be18787e41 100644 --- a/web/lang/ja_jp.php +++ b/web/lang/ja_jp.php @@ -92,6 +92,7 @@ 'Alert' => 'x', 'All' => 'S', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Kp', 'ApplyingStateChange' => 'ύXKp', 'ArchArchived' => 'ۑ̂', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/nl_nl.php b/web/lang/nl_nl.php index 49d8b20b7d..4c3f6a0601 100644 --- a/web/lang/nl_nl.php +++ b/web/lang/nl_nl.php @@ -92,6 +92,7 @@ 'Alert' => 'Waarschuwing', 'All' => 'Alle', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Voer uit', 'ApplyingStateChange' => 'Status verandering aan het uitvoeren', 'ArchArchived' => 'Alleen gearchiveerd', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame moet een getal zijn van 1 of meer', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS moet een positiev getal zijn of een floating point waarde', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Kanaal moet een getal zijn van 1 of meer', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2015-04-18 'BadDevice' => 'Apparaat moet een bestaande waarde krijgen', diff --git a/web/lang/pl_pl.php b/web/lang/pl_pl.php index 846963f722..14688e1893 100644 --- a/web/lang/pl_pl.php +++ b/web/lang/pl_pl.php @@ -92,6 +92,7 @@ 'Alert' => 'Gotowosc', 'All' => 'Wszystko', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Zastosuj', 'ApplyingStateChange' => 'Zmieniam stan pracy', 'ArchArchived' => 'Tylko zarchiwizowane', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/pt_br.php b/web/lang/pt_br.php index ea8c0c0339..6ac24a837b 100644 --- a/web/lang/pt_br.php +++ b/web/lang/pt_br.php @@ -32,6 +32,7 @@ 'Alert' => 'Alerta', 'All' => 'Tudo', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Aplicar', 'ApplyingStateChange' => 'Aplicando mudana de estado', 'ArchArchived' => 'Somente Arquivados', @@ -69,6 +70,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/ro_ro.php b/web/lang/ro_ro.php index bd9ce8b411..761a24527d 100644 --- a/web/lang/ro_ro.php +++ b/web/lang/ro_ro.php @@ -63,6 +63,7 @@ 'Alert' => 'Alert', 'All' => 'Toate', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Accept', 'ApplyingStateChange' => 'Aplic schimbarea de stare', 'ArchArchived' => 'Numai arhivate', @@ -100,6 +101,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/ru_ru.php b/web/lang/ru_ru.php index 73c878713d..64f7a8ec74 100644 --- a/web/lang/ru_ru.php +++ b/web/lang/ru_ru.php @@ -92,6 +92,7 @@ 'Alert' => '', 'All' => '', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => '', 'ApplyingStateChange' => ' ', 'ArchArchived' => ' ', @@ -129,6 +130,7 @@ 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', 'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Channel must be set to an integer of zero or more', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Device must be set to a valid value', diff --git a/web/lang/se_se.php b/web/lang/se_se.php index 511bb7b494..eaa7122596 100644 --- a/web/lang/se_se.php +++ b/web/lang/se_se.php @@ -93,6 +93,7 @@ 'Alert' => 'Varning', 'All' => 'Alla', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 + 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 'Apply' => 'Lgg till', 'ApplyingStateChange' => 'Aktivera statusndring', 'ArchArchived' => 'Arkivera endast', @@ -130,6 +131,7 @@ 'BadAlarmFrameCount' => 'Ramantalet fr larm mste vara ett heltal, minsta vrdet r 1', 'BadAlarmMaxFPS' => 'Larm fr bilder/s mste vara ett positivt heltal eller ett flyttal', 'BadAnalysisFPS' => 'Analysis FPS must be a positive integer or floating point value', // Added - 2015-07-22 + 'BadAnalysisUpdateDelay'=> 'Analysis update delay must be set to an integer of zero or more', // Added - 2015-07-23 'BadChannel' => 'Kanalen mste vara ett heltal, noll eller hgre', 'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15 'BadDevice' => 'Enheten mste sttas till ett giltigt vrde', diff --git a/web/skins/classic/views/js/monitor.js.php b/web/skins/classic/views/js/monitor.js.php index 14a5afddaa..1ceba3ffff 100644 --- a/web/skins/classic/views/js/monitor.js.php +++ b/web/skins/classic/views/js/monitor.js.php @@ -121,6 +121,8 @@ function validateForm( form ) errors[errors.length] = ""; if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) ) errors[errors.length] = ""; + if ( !form.elements['newMonitor[AnalysisUpdateDelay]'].value || !(parseInt(form.elements['newMonitor[AnalysisUpdateDelay]'].value) >= 0 ) ) + errors[errors.length] = ""; if ( !form.elements['newMonitor[FPSReportInterval]'].value || !(parseInt(form.elements['newMonitor[FPSReportInterval]'].value) >= 0 ) ) errors[errors.length] = ""; if ( !form.elements['newMonitor[FrameSkip]'].value || !(parseInt(form.elements['newMonitor[FrameSkip]'].value) >= 0 ) ) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 9911cadf22..2b64dc41ab 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -101,6 +101,7 @@ 'MotionFrameSkip' => 0, 'EventPrefix' => 'Event-', 'AnalysisFPS' => "", + 'AnalysisUpdateDelay' => 0, 'MaxFPS' => "", 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, @@ -600,6 +601,7 @@ function fourcc( $a, $b, $c, $d ) + @@ -871,6 +873,7 @@ function fourcc( $a, $b, $c, $d ) +