From da941d8d187fb3ce0b10e6971a55bd5d3d754127 Mon Sep 17 00:00:00 2001 From: Zii Date: Thu, 23 Nov 2023 09:22:06 -0500 Subject: [PATCH] v3.3.t7 -detect loop will now use the previous video clip as a base for the next 3 video clips. doing this prevents the same clips from being processed multiple times. --- src/camera.cpp | 15 ++++++++------- src/camera.h | 2 ++ src/common.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index e172925..69c25c6 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -167,9 +167,6 @@ void DetectLoop::init() void DetectLoop::reset() { - vidAPath.clear(); - vidBPath.clear(); - eventQue.inQue = false; eventQue.score = 0; eventQue.queAge = 0; @@ -182,15 +179,19 @@ void DetectLoop::reset() void DetectLoop::updated(const QString &path) { auto clips = lsFilesInDir(path, shared->streamExt); + auto index = clips.indexOf(vidBName); - if (clips.size() < 3) + if (clips.size() - (index + 1) < 3) { - thread()->sleep(5); reset(); + thread()->sleep(1); } else { - vidAPath = shared->buffPath + "/live/" + clips[clips.size() - 3]; - vidBPath = shared->buffPath + "/live/" + clips[clips.size() - 2]; + vidAName = clips[clips.size() - 3]; + vidBName = clips[clips.size() - 2]; + + vidAPath = shared->buffPath + "/live/" + vidAName; + vidBPath = shared->buffPath + "/live/" + vidBName; exec(); thread()->sleep(1); } diff --git a/src/camera.h b/src/camera.h index daaec75..6a2440d 100644 --- a/src/camera.h +++ b/src/camera.h @@ -62,6 +62,8 @@ private: QString vidAPath; QString vidBPath; + QString vidAName; + QString vidBName; QStringList prevClips; QTimer *pcTimer; evt_t eventQue; diff --git a/src/common.h b/src/common.h index 6f76f4d..a311dc7 100644 --- a/src/common.h +++ b/src/common.h @@ -30,7 +30,7 @@ using namespace std; -#define APP_VER "3.3.t6" +#define APP_VER "3.3.t7" #define APP_NAME "Motion Watch" #define APP_BIN "mow" #define DATETIME_FMT "yyyyMMddhhmmss"