#ifndef COMMON_H #define COMMON_H // This file is part of JustMotion. // JustMotion is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // JustMotion is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define APP_VERSION "3.6.t4" #define APP_NAME "JustMotion" #define APP_TARGET "jmotion" #define DATETIME_FMT "yyyyMMddhhmmss" #define PREV_IMG "&prev&" #define NEXT_IMG "&next&" enum CmdExeType { MAIN_LOOP, VID_LOOP }; struct evt_t { QList vidList; QString timeStamp; QString imgPath; float score; bool inQue; int queAge; }; struct shared_t { QList recList; QString conf; QString recordUri; QString buffPath; QString postCmd; QString camName; QString recPath; QString outputType; QString compCmd; QString vidCodec; QString audCodec; QString streamExt; QString recExt; QString thumbExt; QString recScale; QString imgScale; quint64 seed; bool singleTenant; bool skipCmd; int liveSecs; int recFps; int evMaxSecs; int postSecs; int imgThresh; int maxEvents; int retCode; }; QString buildThreadCount(int count); QStringList lsFilesInDir(const QString &path, const QString &ext = QString()); QStringList lsDirsInDir(const QString &path); QStringList listFacingFiles(const QString &path, const QString &ext, const QDateTime &stamp, int secs, char dir); QStringList backwardFacingFiles(const QString &path, const QString &ext, const QDateTime &stamp, int secs); QStringList forwardFacingFiles(const QString &path, const QString &ext, const QDateTime &stamp, int secs); QStringList parseArgs(const QByteArray &data, int maxArgs, int *pos = nullptr); bool rdConf(const QString &filePath, shared_t *share); bool mkPath(const QString &path); void setupBuffDir(const QString &path, bool del = false); void rdLine(const QString ¶m, const QString &line, QString *value); void rdLine(const QString ¶m, const QString &line, int *value); void rdLine(const QString ¶m, const QString &line, bool *value); void enforceMaxEvents(shared_t *share); void enforceMaxImages(shared_t *share); void enforceMaxClips(shared_t *share); void extCorrection(QString &ext); #endif // COMMON_H