From 8a9c283c1cd80e8b82e7c0f7c8544000cb43d3b8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 13 Oct 2021 16:06:22 -0400 Subject: [PATCH] Fix loading importance. Needs to be -1 not -2. The first value is 1, but we want zero based. --- src/zm_monitor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 727e9bc51..cd17f3fe0 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -83,7 +83,7 @@ std::string load_monitor_sql = "`SectionLength`, `MinSectionLength`, `FrameSkip`, `MotionFrameSkip`, " "`FPSReportInterval`, `RefBlendPerc`, `AlarmRefBlendPerc`, `TrackMotion`, `Exif`," "`RTSPServer`, `RTSPStreamName`," -"`SignalCheckPoints`, `SignalCheckColour`, `Importance`-2 FROM `Monitors`"; +"`SignalCheckPoints`, `SignalCheckColour`, `Importance`-1 FROM `Monitors`"; std::string CameraType_Strings[] = { "Local", @@ -435,7 +435,7 @@ Monitor::Monitor() "SectionLength, MinSectionLength, FrameSkip, MotionFrameSkip, " "FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, Exif," "`RTSPServer`,`RTSPStreamName`, - "SignalCheckPoints, SignalCheckColour, Importance-2 FROM Monitors"; + "SignalCheckPoints, SignalCheckColour, Importance-1 FROM Monitors"; */ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { @@ -601,7 +601,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { rtsp_server = (*dbrow[col] != '0'); col++; rtsp_streamname = dbrow[col]; col++; - /*"SignalCheckPoints, SignalCheckColour, Importance-2 FROM Monitors"; */ + /*"SignalCheckPoints, SignalCheckColour, Importance-1 FROM Monitors"; */ signal_check_points = atoi(dbrow[col]); col++; signal_check_colour = strtol(dbrow[col][0] == '#' ? dbrow[col]+1 : dbrow[col], 0, 16); col++; @@ -613,6 +613,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { grayscale_val = signal_check_colour & 0xff; /* Clear all bytes but lowest byte */ importance = dbrow[col] ? atoi(dbrow[col]) : 0;// col++; + if (importance < 0) importance = 0; // Should only be >= 0 // How many frames we need to have before we start analysing ready_count = std::max(warmup_count, pre_event_count);