Fixed the compile error.
This commit is contained in:
Maurice ONeal 2023-03-10 19:47:36 -05:00
parent ae46834777
commit bddde644c1
5 changed files with 41 additions and 41 deletions

View File

@ -361,39 +361,3 @@ uint64_t genEpoch()
{ {
return duration_cast<seconds>(system_clock::now().time_since_epoch()).count(); return duration_cast<seconds>(system_clock::now().time_since_epoch()).count();
} }
void wrOutm3u8(const pls_t &pls)
{
recLog("live-to-event-src: " + pls.clipPath);
recLog("live-to-event-dst: " + pls.dstPath);
createDirTree(path(pls.dstPath).parent_path().string());
copy_file(pls.clipPath, pls.dstPath);
auto plsFile = pls.fileName + ".m3u8";
if (exists(plsFile))
{
ofstream file(plsFile.c_str(), ofstream::app);
file << endl;
file << pls.extINF << endl;
file << pls.dstPath;
file.close();
}
else
{
ofstream file(plsFile.c_str());
file << "#EXTM3U" << endl;
file << "#EXT-X-VERSION:3" << endl;
file << "#EXT-X-TARGETDURATION:10" << endl;
file << "#EXT-X-MEDIA-SEQUENCE:0" << endl;
file << "#EXT-X-DISCONTINUITY" << endl;
file << pls.extINF << endl;
file << pls.dstPath;
file.close();
}
}

View File

@ -37,7 +37,7 @@ using namespace std;
using namespace std::filesystem; using namespace std::filesystem;
using namespace std::chrono; using namespace std::chrono;
#define APP_VER "2.0.t3" #define APP_VER "2.0.t4"
#define APP_NAME "Motion Watch" #define APP_NAME "Motion Watch"
#define REC_LOG_NAME "rec_log_lines.html" #define REC_LOG_NAME "rec_log_lines.html"
#define DET_LOG_NAME "det_log_lines.html" #define DET_LOG_NAME "det_log_lines.html"
@ -93,7 +93,6 @@ void rdLine(const string &param, const string &line, string *value);
void rdLine(const string &param, const string &line, int *value); void rdLine(const string &param, const string &line, int *value);
void cleanupEmptyDirs(const string &path); void cleanupEmptyDirs(const string &path);
void cleanupStream(const string &plsPath); void cleanupStream(const string &plsPath);
void wrOutm3u8(const pls_t &pls);
void enforceMaxEvents(shared_t *share); void enforceMaxEvents(shared_t *share);
bool rdConf(shared_t *share); bool rdConf(shared_t *share);
vector<string> lsFilesInDir(const string &path, const string &ext = string()); vector<string> lsFilesInDir(const string &path, const string &ext = string());

View File

@ -42,7 +42,7 @@ void eventLoop(shared_t *share)
try try
{ {
wrOutm3u8(pls); wrOutm3u8(pls, share);
genHTMLvid(pls.fileName); genHTMLvid(pls.fileName);
if (!exists(pls.fileName + ".jpg")) if (!exists(pls.fileName + ".jpg"))
@ -52,7 +52,7 @@ void eventLoop(shared_t *share)
} }
catch (filesystem_error &ex) catch (filesystem_error &ex)
{ {
recLog("err: " + ex.what(), share); recLog(string("err: ") + ex.what(), share);
} }
share->recList.erase(share->recList.begin()); share->recList.erase(share->recList.begin());

View File

@ -116,3 +116,39 @@ bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share)
return mod; return mod;
} }
void wrOutm3u8(const pls_t &pls, shared_t *share)
{
recLog("live-to-event-src: " + pls.clipPath, share);
recLog("live-to-event-dst: " + pls.dstPath, share);
createDirTree(path(pls.dstPath).parent_path().string());
copy_file(pls.clipPath, pls.dstPath);
auto plsFile = pls.fileName + ".m3u8";
if (exists(plsFile))
{
ofstream file(plsFile.c_str(), ofstream::app);
file << endl;
file << pls.extINF << endl;
file << pls.dstPath;
file.close();
}
else
{
ofstream file(plsFile.c_str());
file << "#EXTM3U" << endl;
file << "#EXT-X-VERSION:3" << endl;
file << "#EXT-X-TARGETDURATION:10" << endl;
file << "#EXT-X-MEDIA-SEQUENCE:0" << endl;
file << "#EXT-X-DISCONTINUITY" << endl;
file << pls.extINF << endl;
file << pls.dstPath;
file.close();
}
}

View File

@ -19,5 +19,6 @@
bool imgDiff(Mat &prev, Mat &next, shared_t *share); bool imgDiff(Mat &prev, Mat &next, shared_t *share);
bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share); bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share);
void detectMoInStream(const string &bufPath, shared_t *share); void detectMoInStream(const string &bufPath, shared_t *share);
void wrOutm3u8(const pls_t &pls, shared_t *share);
#endif // MO_DETECT_H #endif // MO_DETECT_H