Compare commits
2 Commits
b0dbfa0852
...
bddde644c1
Author | SHA1 | Date | |
---|---|---|---|
|
bddde644c1 | ||
|
ae46834777 |
|
@ -361,36 +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)
|
|
||||||
{
|
|
||||||
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::filesystem;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
#define APP_VER "2.0.t2"
|
#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 ¶m, const string &line, string *value);
|
||||||
void rdLine(const string ¶m, const string &line, int *value);
|
void rdLine(const string ¶m, 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());
|
||||||
|
|
|
@ -42,17 +42,17 @@ 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"))
|
||||||
{
|
{
|
||||||
imwrite(string(pls.fileName + "jpg").c_str(), pls.thumbnail);
|
imwrite(string(pls.fileName + ".jpg").c_str(), pls.thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (filesystem_error &ex)
|
catch (filesystem_error &ex)
|
||||||
{
|
{
|
||||||
recLog("err: could not copy live file: " + pls.clipPath + " reason - " + ex.what(), share);
|
recLog(string("err: ") + ex.what(), share);
|
||||||
}
|
}
|
||||||
|
|
||||||
share->recList.erase(share->recList.begin());
|
share->recList.erase(share->recList.begin());
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user