提交 1e165174 authored 作者: blu's avatar blu

new feature entropy filter to ignore gray frame without iframe

上级 61bccc25
...@@ -96,8 +96,9 @@ namespace LVDB { ...@@ -96,8 +96,9 @@ namespace LVDB {
return ret; return ret;
} }
int traverseConfigureModules(json &config, cb_traverse_configration_module cb, string moduleName){ int traverseConfigureModules(json &config, cb_traverse_configration_module cb, void *pUser, string moduleName){
int ret = 0; int ret = 0;
int cnt = 0;
if(config.count("data") == 0) { if(config.count("data") == 0) {
return -1; return -1;
} }
...@@ -135,7 +136,8 @@ namespace LVDB { ...@@ -135,7 +136,8 @@ namespace LVDB {
if(!sub.empty()) { if(!sub.empty()) {
for(auto &m:module) { for(auto &m:module) {
if(m.count("type") != 0 && m["type"] == sub) { if(m.count("type") != 0 && m["type"] == sub) {
ret = cb(modname, m); ret = cb(modname, m, pUser);
cnt++;
if(ret <0) { if(ret <0) {
spdlog::error("failed to traverse and callback config on module: {}", m.dump()); spdlog::error("failed to traverse and callback config on module: {}", m.dump());
return ret; return ret;
...@@ -147,7 +149,8 @@ namespace LVDB { ...@@ -147,7 +149,8 @@ namespace LVDB {
}else{ }else{
for(auto &[mn, mod]:modules.items()) { for(auto &[mn, mod]:modules.items()) {
for(auto &m:mod) { for(auto &m:mod) {
ret = cb(mn,m); ret = cb(mn,m, pUser);
cnt++;
if(ret <0) { if(ret <0) {
spdlog::error("failed to traverse and callback config on module: {}", m.dump()); spdlog::error("failed to traverse and callback config on module: {}", m.dump());
return ret; return ret;
...@@ -159,7 +162,8 @@ namespace LVDB { ...@@ -159,7 +162,8 @@ namespace LVDB {
} }
} }
} }
return 0;
return cnt;
} }
int _getDB(string fileName, DB** pdb) { int _getDB(string fileName, DB** pdb) {
......
...@@ -156,6 +156,7 @@ class HttpSrv{ ...@@ -156,6 +156,7 @@ class HttpSrv{
try{ try{
string sn = req.get_param_value("sn"); string sn = req.get_param_value("sn");
string module = req.get_param_value("module"); string module = req.get_param_value("module");
auto cfg = json::parse(req.body);
if(sn.empty()||module.empty()){ if(sn.empty()||module.empty()){
throw StrException("no para sn/module"); throw StrException("no para sn/module");
} }
...@@ -163,9 +164,13 @@ class HttpSrv{ ...@@ -163,9 +164,13 @@ class HttpSrv{
string key, modname; string key, modname;
if(module == "evmgr") { if(module == "evmgr") {
key = sn; key = sn;
// trigger exception if
(void)cfg["data"][key];
}else { }else {
if(modname == "evml") { if(modname == "evml") {
string
modname = "evml:" + module.substr(4, module.size()); modname = "evml:" + module.substr(4, module.size());
}else{ }else{
modname = module; modname = module;
} }
......
...@@ -74,7 +74,7 @@ private: ...@@ -74,7 +74,7 @@ private:
} }
// set all module status to 0 // set all module status to 0
ret = LVDB::traverseConfigureModules(config, [](string modname, json &m)->int{ ret = LVDB::traverseConfigureModules(config, [](string modname, json &m, void* pUser)->int{
if(m.count("status") != 0) if(m.count("status") != 0)
{ {
//cout << modname <<" ," << m.dump() << endl; //cout << modname <<" ," << m.dump() << endl;
......
...@@ -53,8 +53,8 @@ namespace LVDB { ...@@ -53,8 +53,8 @@ namespace LVDB {
int getLog(json &log, json &writeOptions, string fileName); int getLog(json &log, json &writeOptions, string fileName);
int setLog(json &log, json &readOptions, string fileName); int setLog(json &log, json &readOptions, string fileName);
typedef int(*cb_traverse_configration_module)(string modname, json &mod); typedef int(*cb_traverse_configration_module)(string modname, json &mod, void *pUser);
int traverseConfigureModules(json &config, cb_traverse_configration_module cb, string moduleName = ""); int traverseConfigureModules(json &config, cb_traverse_configration_module cb, void *pUser = NULL, string moduleName = "");
} // namespace LVDB } // namespace LVDB
#endif #endif
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论