From c56015c5c73861b5f794cac48064d0394f8fd37d Mon Sep 17 00:00:00 2001
From: pansen <pansen626@sina.com>
Date: 星期二, 02 四月 2019 15:48:39 +0800
Subject: [PATCH] 对抓拍记录的picMaxUrl字段赋值(大图路径)
---
QiaoJiaSystem/VideoToImageMulth/main.cpp | 122 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 116 insertions(+), 6 deletions(-)
diff --git a/QiaoJiaSystem/VideoToImageMulth/main.cpp b/QiaoJiaSystem/VideoToImageMulth/main.cpp
index 684fd82..4f96c52 100644
--- a/QiaoJiaSystem/VideoToImageMulth/main.cpp
+++ b/QiaoJiaSystem/VideoToImageMulth/main.cpp
@@ -14,7 +14,10 @@
#include <basic/util/file/FileUtil.h>
#include <basic/util/app/AppPreference.hpp>
#include <basic/util/app/AppConfig.h>
-#include <basic/util/app/AppConfig.h>
+
+#include <GB28181Server.h>
+#include <basic/util/net_config/net_config.h>
+#include <DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h>
static void startManager(LDBTool *_dbTool) {
RtspAnalysManager rtspAnalysManager(_dbTool);
@@ -23,25 +26,132 @@
}
}
+std::string getLocalIp() {
+ unsigned char netmask_old[15] = {0};
+ unsigned char gateway_old[15] = {0};
+ unsigned char ip_old[15] = {0};
+ std::string net_ifname = appConfig.getStringProperty("netIfName");
+ std::string str_ip;
+ if (GetIpAddress(net_ifname.c_str(), ip_old)) {
+ std::string ip_old_temp((char *) ip_old);
+ str_ip = ip_old_temp;
+ } else {
+// value["ipaddr"] = "";
+ ERR("not get ip addr");
+ }
+ assert(!str_ip.empty());
+ return std::move(str_ip);
+}
+
+/***
+ * arg1 涓�-1鏃跺惎鐢╣b28181
+ * @param argc
+ * @param argv
+ * @return
+ */
int main(int argc, char **argv) {
- std::cout<<__DATE__<<" "<<__TIME__<<std::endl;
+ std::cout << __DATE__ << " " << __TIME__ << std::endl;
SAVE_APP_ARGS
#ifdef GLOG
- ENABLEGLOG(GET_STR_CONFIG("logPath").c_str());
+ ENABLEGLOG(GET_STR_CONFIG("logPath").c_str());
#endif
- appPref.setLongData("gpu.index", 1);
+ if (argc < 4) {
+ assert("t_value.size()");
+ }
+ {
+// std::string rtmpAddr = appConfig.getStringProperty("srsAddr");
+// std::string publish_basepath = rtmpAddr + "" ;
+// appPref.setStringData("publish.basepath", publish_basepath);
+ appPref.setIntData("pulish.width", 640);
+ appPref.setIntData("pulish.height", 360);
+ }
+ int arg1 = atoi(argv[1]);
+
+ int gindx = abs(arg1) % 2;
+ int GB28181_Enable = arg1 < 0 ? 1 : 0;
+
+ DBG(gindx);
+ appPref.setIntData("GB28181_Enable", GB28181_Enable);
+ appPref.setLongData("gpu.index", gindx);
appPref.setIntData("show.image", 0);
//todo
- appPref.setIntData("CamStart", atoi(argv[1]));
+ appPref.setIntData("CamStart", arg1);
appPref.setIntData("CamStep", atoi(argv[2]));
+ appPref.setIntData("RpcServerPort", atoi(argv[3]));
+ if (GB28181_Enable) {
+ //#todo search from db
+ MysqlDBServerCfg mysqlDBServerCfg;
+ mysqlDBServerCfg.Host = getLocalIp();
+ mysqlDBServerCfg.Port = 3306;
+ mysqlDBServerCfg.UserName = "root";
+ mysqlDBServerCfg.Passwd = "123456";
+ mysqlDBServerCfg.DBName = "EGEyesForVSS";
+ mysqlDBServerCfg.DBConnCount = 5;
+
+ LDBTool ldbTool;
+ BaseSqliteDao::setLDBTool(&ldbTool);
+
+ //#todo search from db
+ Json::Value t_value;
+ {
+ LDBTool ldbTool;
+ BaseSqliteDao::setLDBTool(&ldbTool);
+ t_value = VssLocalSettingTblSqliteDao::instance()->findAllVssLocalSettingTblList();
+ }
+ if (t_value.size() == 1 && t_value["data"].size() > 1) {
+ assert("t_value.size()");
+ }
+ DBG(t_value["data"].begin()->toStyledString());
+ auto &t_cfg = *t_value["data"].begin();
+ GBServerCfg gbServerCfg;
+ gbServerCfg.SvrIp = t_cfg["ServerIp"].asString(); // 鍥芥爣鏈嶅姟鐨刬p鍦板潃 (鏈満鐨刬p鍦板潃)
+ gbServerCfg.SvrPort = atoi(t_cfg["ServerPort"].asString().c_str());// 7060; // 鍥芥爣鏈嶅姟鐩戝惉鐨勭鍙�
+ gbServerCfg.SvrPubID = t_cfg["ServerId"].asString();// "44120000002000000001"; // 鍥芥爣鏈嶅姟鍣ㄧ殑ID
+ gbServerCfg.bMD5Auth = false; // 鏄惁闇�瑕丮D5鍔犲瘑
+ gbServerCfg.UserName = t_cfg["UserAuthId"].asString();// "44120100002000000002"; // 鍥芥爣鏈嶅姟鐨勭敤鎴峰悕 (涓嬬骇璁惧娉ㄥ唽鐨勭敤鎴峰悕)
+ gbServerCfg.Passwd = t_cfg["Password"].asString();// "123456"; // 鍥芥爣鏈嶅姟鐨勫瘑鐮� (涓嬬骇璁惧娉ㄥ唽鐨勫瘑鐮�)
+ gbServerCfg.SubScribeTime = 3600; // 璁㈤槄鏃堕棿 濡傛灉涓�0 琛ㄧず涓嶈闃�
+
+ SpinLock spinLock;
+
+ bool running = false;
+ bool serinit = false;
+ auto func = [&] {
+ spinLock.lock();
+ GB28181Server m_gbs;
+ m_gbs.setMysqlConnParam(mysqlDBServerCfg);
+ m_gbs.setGBServerParam(gbServerCfg);
+ DBG("initServer start before");
+ running = true;
+ m_gbs.initServer();
+ DBG("initServer start after");
+
+ spinLock.unlock();
+ while (running) {
+ usleep(4000);
+ }
+ };
+
+ std::thread thd(func);
+ thd.detach();
+
+ usleep(400);
+ // ---------------------娴嬭瘯------------------------
+ spinLock.lock();
+// if (!running) {
+// ERR("running is false << DB init error");
+// exit(0);
+// }
+ }
+ DBG("test start");
appPref.setStringData("user.loop.absolute.path", appConfig.getStringProperty("cutPath"));
- IceRpcServer<RtspAnalysManager> server("RtspAnalysServer", 10009, "tcp");
+ IceRpcServer<RtspAnalysManager> server("RtspAnalysServer", appPref.getIntData("RpcServerPort"), "tcp");
server.setMessageSizeMax(1024 * 1024 * 50);
server.setPoolInitSize(1);
server.setPoolMaxSize(1);
--
Gitblit v1.8.0