提交 4b48f51f authored 作者: blu's avatar blu

big refacting of communitation architect

上级 ba7dadb0
#include "dirmon.h"
int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events, FSW_EVENT_CALLBACK cb)
int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events, FSW_EVENT_CALLBACK cb, void *pUserData)
{
vector<string> paths= {path};
vector<fsw_event_type_filter> event_filters = {{fsw_event_flag::Created}};
......@@ -8,7 +8,7 @@ int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events,
*m = monitor_factory::create_monitor(
fsw_monitor_type::system_default_monitor_type,
paths,
cb);
cb, pUserData);
(*m)->set_latency(1.1);
(*m)->set_filters(flt);
(*m)->start();
......
......@@ -15,7 +15,7 @@
using namespace std;
using namespace fsw;
int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events, FSW_EVENT_CALLBACK cb);
int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events, FSW_EVENT_CALLBACK cb, void *pUserData);
int CloseDirMon(monitor*m);
#endif
\ No newline at end of file
......@@ -21,6 +21,7 @@ update: 2019/09/10
#include <future>
#include <vector>
#include <ctime>
#include <functional>
#include <cstdlib>
#include "inc/zmqhelper.hpp"
......@@ -88,7 +89,6 @@ private:
}
}
else {
spdlog::error("evslicer {} get invalid msg with size {}: {}", selfId, v.size(), msg);
}
......@@ -297,7 +297,6 @@ private:
if(pAVFormatRemux->pb) {
avio_closep(&pAVFormatRemux->pb);
}
avformat_free_context(pAVFormatRemux);
}
pAVFormatRemux = nullptr;
......@@ -522,6 +521,12 @@ protected:
return v;
}
static void fileMonHandler(const std::vector<event>& evts, void *pUserData) {
auto self = static_cast<EvSlicer*>(pUserData);
for(auto &i : evts) {
spdlog::info("evslicer {} filemon file: {}, ts: {}", self->selfId, i.get_path().c_str(), i.get_time());
}
}
public:
EvSlicer()
{
......@@ -581,8 +586,9 @@ public:
this->vTsActive = this->LoadVideoFiles(this->urlOut, this->days, this->numSlices, this->mapTs2BaseName, this->vTsOld);
this->segHead = 0;
this->segTail = vTsActive.size();
monitor * m = nullptr;
// auto fn = (FSW_EVENT_CALLBACK)bind(&EvSlicer::fileMonHandler, this, placeholders::_1, placeholders::_2);
CreateDirMon(&m, this->urlOut, ".mp4", vector<string>(), EvSlicer::fileMonHandler, (void *)this);
});
thSliceMgr.detach();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论