Compare commits
No commits in common. "bddde644c1473c1cad785621e71f524aa19a5e7b" and "b0dbfa0852012bf9f4e500ca87a376998f7f0f71" have entirely different histories.
bddde644c1
...
b0dbfa0852
|
@ -151,7 +151,7 @@ void enforceMaxEvents(shared_t *share)
|
|||
if (exists(imgFile)) remove(imgFile);
|
||||
if (exists(webFile)) remove(webFile);
|
||||
}
|
||||
|
||||
|
||||
names.erase(names.begin());
|
||||
}
|
||||
}
|
||||
|
@ -361,3 +361,36 @@ uint64_t genEpoch()
|
|||
{
|
||||
return duration_cast<seconds>(system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
void wrOutm3u8(const pls_t &pls)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace std;
|
|||
using namespace std::filesystem;
|
||||
using namespace std::chrono;
|
||||
|
||||
#define APP_VER "2.0.t4"
|
||||
#define APP_VER "2.0.t2"
|
||||
#define APP_NAME "Motion Watch"
|
||||
#define REC_LOG_NAME "rec_log_lines.html"
|
||||
#define DET_LOG_NAME "det_log_lines.html"
|
||||
|
@ -93,6 +93,7 @@ void rdLine(const string ¶m, const string &line, string *value);
|
|||
void rdLine(const string ¶m, const string &line, int *value);
|
||||
void cleanupEmptyDirs(const string &path);
|
||||
void cleanupStream(const string &plsPath);
|
||||
void wrOutm3u8(const pls_t &pls);
|
||||
void enforceMaxEvents(shared_t *share);
|
||||
bool rdConf(shared_t *share);
|
||||
vector<string> lsFilesInDir(const string &path, const string &ext = string());
|
||||
|
|
|
@ -42,17 +42,17 @@ void eventLoop(shared_t *share)
|
|||
|
||||
try
|
||||
{
|
||||
wrOutm3u8(pls, share);
|
||||
wrOutm3u8(pls);
|
||||
genHTMLvid(pls.fileName);
|
||||
|
||||
if (!exists(pls.fileName + ".jpg"))
|
||||
{
|
||||
imwrite(string(pls.fileName + ".jpg").c_str(), pls.thumbnail);
|
||||
imwrite(string(pls.fileName + "jpg").c_str(), pls.thumbnail);
|
||||
}
|
||||
}
|
||||
catch (filesystem_error &ex)
|
||||
{
|
||||
recLog(string("err: ") + ex.what(), share);
|
||||
recLog("err: could not copy live file: " + pls.clipPath + " reason - " + ex.what(), share);
|
||||
}
|
||||
|
||||
share->recList.erase(share->recList.begin());
|
||||
|
|
|
@ -99,7 +99,7 @@ bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share)
|
|||
mod = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
prev.release();
|
||||
next.release();
|
||||
}
|
||||
|
@ -116,39 +116,3 @@ bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share)
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,5 @@
|
|||
bool imgDiff(Mat &prev, Mat &next, shared_t *share);
|
||||
bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share);
|
||||
void detectMoInStream(const string &bufPath, shared_t *share);
|
||||
void wrOutm3u8(const pls_t &pls, shared_t *share);
|
||||
|
||||
#endif // MO_DETECT_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user