From b64e83af6e9e5b56e2af97560c5535816b8b94bd Mon Sep 17 00:00:00 2001
From: xuxiuxi <554325746@qq.com>
Date: 星期五, 08 三月 2019 12:58:02 +0800
Subject: [PATCH] Merge branch 'yw.1.2.fixbug' of http://192.168.1.226:10010/r/development/c++ into yw.1.2.fixbug

---
 QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h |  187 ++++++++++++++------------
 QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt                                |    6 
 QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h      |   29 ++++
 QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h                           |    6 
 QiaoJiaSystem/VideoToImageMulth/main.cpp                                      |   10 +
 QiaoJiaSystem/VideoAnalysFromHC/main.cpp                                      |    2 
 QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp                             |    5 
 QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h                             |   24 +-
 QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp    |   50 +++++++
 QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp                        |   60 +++++---
 QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp                         |   11 +
 QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp                        |    3 
 12 files changed, 254 insertions(+), 139 deletions(-)

diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h
index 13c8d09..2bef196 100755
--- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h
+++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h
@@ -17,47 +17,52 @@
  */
 class VssLocalSettingTblController : public VssBaseController {
 private:
-	/** 鏈湴鍥芥爣閰嶇疆鏋勯�犲嚱鏁� */
-	VssLocalSettingTblController() {}
+    /** 鏈湴鍥芥爣閰嶇疆鏋勯�犲嚱鏁� */
+    VssLocalSettingTblController() {}
+
 public:
-	/** 鏈湴鍥芥爣閰嶇疆鍗曚緥妯″紡 */
-    static VssLocalSettingTblController* instance() {
+    /** 鏈湴鍥芥爣閰嶇疆鍗曚緥妯″紡 */
+    static VssLocalSettingTblController *instance() {
         static VssLocalSettingTblController instance;
         return &instance;
     }
-public:
-	/** 娉ㄥ唽{label}http鏈嶅姟 */
-    void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) {
 
-	    _HttpSrvRetRecieve.setInfo("^/addVssLocalSettingTbl$", "POST",
-	                               std::bind(&VssLocalSettingTblController::addVssLocalSettingTbl, this,
-	                                         std::placeholders::_1, std::placeholders::_2,
-	                                         std::placeholders::_3, std::placeholders::_4));
-	
-	    _HttpSrvRetRecieve.setInfo("^/delVssLocalSettingTbl$", "POST",
-	                               std::bind(&VssLocalSettingTblController::delVssLocalSettingTbl, this,
-	                                         std::placeholders::_1, std::placeholders::_2,
-	                                         std::placeholders::_3, std::placeholders::_4));
-	
-	    _HttpSrvRetRecieve.setInfo("^/updateVssLocalSettingTbl$", "POST",
-	                               std::bind(&VssLocalSettingTblController::updateVssLocalSettingTbl, this,
-	                                         std::placeholders::_1, std::placeholders::_2,
-	                                         std::placeholders::_3, std::placeholders::_4));
-	
-	    _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTbl$", "POST",
-	                               std::bind(&VssLocalSettingTblController::findVssLocalSettingTbl, this,
-	                                         std::placeholders::_1, std::placeholders::_2,
-	                                         std::placeholders::_3, std::placeholders::_4));
-	
-	    _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTblList$", "POST",
-	                               std::bind(&VssLocalSettingTblController::findVssLocalSettingTblList, this,
-	                                         std::placeholders::_1, std::placeholders::_2,
-	                                         std::placeholders::_3, std::placeholders::_4));
+public:
+    /** 娉ㄥ唽{label}http鏈嶅姟 */
+    void registerHttpServices(HttpSrvRetRecieve &_HttpSrvRetRecieve) {
+
+        _HttpSrvRetRecieve.setInfo("^/addVssLocalSettingTbl$", "POST",
+                                   std::bind(&VssLocalSettingTblController::addVssLocalSettingTbl, this,
+                                             std::placeholders::_1, std::placeholders::_2,
+                                             std::placeholders::_3, std::placeholders::_4));
+
+        _HttpSrvRetRecieve.setInfo("^/delVssLocalSettingTbl$", "POST",
+                                   std::bind(&VssLocalSettingTblController::delVssLocalSettingTbl, this,
+                                             std::placeholders::_1, std::placeholders::_2,
+                                             std::placeholders::_3, std::placeholders::_4));
+
+        _HttpSrvRetRecieve.setInfo("^/updateVssLocalSettingTbl$", "POST",
+                                   std::bind(&VssLocalSettingTblController::updateVssLocalSettingTbl, this,
+                                             std::placeholders::_1, std::placeholders::_2,
+                                             std::placeholders::_3, std::placeholders::_4));
+
+        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTbl$", "POST",
+                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTbl, this,
+                                             std::placeholders::_1, std::placeholders::_2,
+                                             std::placeholders::_3, std::placeholders::_4));
+
+        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTblList$", "POST",
+                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTblList, this,
+                                             std::placeholders::_1, std::placeholders::_2,
+                                             std::placeholders::_3, std::placeholders::_4));
 
     }
+
 public:
-	/** 娣诲姞鏈湴鍥芥爣閰嶇疆 */
+    /** 娣诲姞鏈湴鍥芥爣閰嶇疆 */
     std::string addVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+        DBG("ip:" << ip << "; port:" << port);
+        DBG("content: " << content);
         Json::Reader requestJsonReader;
         Json::Value requestJsonValue;
         Json::Value responseJsonValue;
@@ -65,43 +70,43 @@
         responseJsonValue["success"] = "false";
         if (requestJsonReader.parse(content, requestJsonValue)) {
             VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
-	    
-	    	Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
+
+            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
             if (iDJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
             }
 
-	    	Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
+            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
             if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
             }
 
-	    	Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
+            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
             if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
             }
 
-	    	Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
+            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
             if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
             }
 
-	    	Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
+            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
             if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
             }
 
-	    	Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
+            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
             if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
             }
 
-	    	Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
+            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
             if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
             }
-	    	auto keyValuesToAdd = vssLocalSettingTblBuilder.buildVssLocalSettingTblMap();
-	    	if (keyValuesToAdd.size() > 0) {
+            auto keyValuesToAdd = vssLocalSettingTblBuilder.buildVssLocalSettingTblMap();
+            if (keyValuesToAdd.size() > 0) {
                 responseJsonValue = VssLocalSettingTblSqliteDao::instance()->addVssLocalSettingTbl(keyValuesToAdd);
             }
         }
@@ -110,16 +115,18 @@
 
     /** 鍒犻櫎鏈湴鍥芥爣閰嶇疆 */
     std::string delVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+        DBG("ip:" << ip << "; port:" << port);
+        DBG("content: " << content);
         Json::Reader requestJsonReader;
         Json::Value requestJsonValue;
         Json::Value responseJsonValue;
         responseJsonValue["message"] = "鍒犻櫎澶辫触锛�";
         responseJsonValue["success"] = "false";
         if (requestJsonReader.parse(content, requestJsonValue)) {
-        	Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
-        	if (iDJsonValue.type() != Json::ValueType::nullValue) {
-        		string iDValue = iDJsonValue.asString();
-        		responseJsonValue = VssLocalSettingTblSqliteDao::instance()->deleteByColumn("ID", iDValue);
+            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
+            if (iDJsonValue.type() != Json::ValueType::nullValue) {
+                string iDValue = iDJsonValue.asString();
+                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->deleteByColumn("ID", iDValue);
             }
 
         }
@@ -128,6 +135,8 @@
 
     /** 鏇存柊鏈湴鍥芥爣閰嶇疆 */
     std::string updateVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+        DBG("ip:" << ip << "; port:" << port);
+        DBG("content: " << content);
         Json::Reader requestJsonReader;
         Json::Value requestJsonValue;
         Json::Value responseJsonValue;
@@ -136,43 +145,44 @@
         if (requestJsonReader.parse(content, requestJsonValue)) {
             VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
 
-	    	Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
+            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
             if (iDJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
             }
 
-	    	Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
+            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
             if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
             }
 
-	    	Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
+            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
             if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
             }
 
-	    	Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
+            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
             if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
             }
 
-	    	Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
+            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
             if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
             }
 
-	    	Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
+            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
             if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
             }
 
-	    	Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
+            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
             if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
             }
-        	if (iDJsonValue.type() != Json::ValueType::nullValue) {
-        		string iDValue = iDJsonValue.asString();
-                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->updateVssLocalSettingTbl(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap(), "ID", iDValue);
+            if (iDJsonValue.type() != Json::ValueType::nullValue) {
+                string iDValue = iDJsonValue.asString();
+                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->updateVssLocalSettingTbl(
+                    vssLocalSettingTblBuilder.buildVssLocalSettingTblMap(), "ID", iDValue);
             }
         }
         return responseJsonValue.toStyledString();
@@ -180,6 +190,8 @@
 
     /** 鏌ユ壘鍗曚釜鏈湴鍥芥爣閰嶇疆 */
     std::string findVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+        DBG("ip:" << ip << "; port:" << port);
+        DBG("content: " << content);
         Json::Reader requestJsonReader;
         Json::Value requestJsonValue;
         Json::Value responseJsonValue;
@@ -188,49 +200,53 @@
         if (requestJsonReader.parse(content, requestJsonValue)) {
             VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
 
-	    	Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
+            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
             if (iDJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
             }
 
-	    	Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
+            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
             if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
             }
 
-	    	Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
+            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
             if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
             }
 
-	    	Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
+            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
             if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
             }
 
-	    	Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
+            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
             if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
             }
 
-	    	Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
+            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
             if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
             }
 
-	    	Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
+            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
             if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
             }
-	        responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
-	        responseJsonValue["success"] = "true";
-            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
+            responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
+            responseJsonValue["success"] = "true";
+            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(
+                vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
         }
         return responseJsonValue.toStyledString();
     }
 
     /** 鏌ユ壘鏈湴鍥芥爣閰嶇疆鍒楄〃 */
-    std::string findVssLocalSettingTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
+    std::string
+    findVssLocalSettingTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
+        DBG("ip:" << ip << "; port:" << port);
+        DBG("content: " << content);
         Json::Reader requestJsonReader;
         Json::Value requestJsonValue;
         Json::Value responseJsonValue;
@@ -239,52 +255,49 @@
         if (content == "" || requestJsonReader.parse(content, requestJsonValue)) {
             VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
 
-	    	Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
+            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
             if (iDJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
             }
-	    
-	    	Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
+
+            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
             if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
             }
-	    
-	    	Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
+
+            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
             if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
             }
-	    
-	    	Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
+
+            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
             if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
             }
-	    
-	    	Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
+
+            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
             if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
             }
-	    
-	    	Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
+
+            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
             if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
             }
-	    
-	    	Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
+
+            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
             if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                 vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
             }
-	        responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
-	        responseJsonValue["success"] = "true";
-	    	responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
+            responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
+            responseJsonValue["success"] = "true";
+            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(
+                vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
 
         }
         return responseJsonValue.toStyledString();
     }
 };
-
-
-
-
 
 
 #endif //VSSLOCALSETTINGTBL_CONTROLLER_H
diff --git a/QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h b/QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h
index b596996..bc1c593 100644
--- a/QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h
+++ b/QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h
@@ -131,20 +131,20 @@
         return updateSql;
     }
     static void doConnect() {
-        //            if (conn->connect(
-//                    appConfig.getStringProperty("database").c_str(),
-//                    appConfig.getStringProperty("db_host").c_str(),
-//                    appConfig.getStringProperty("db_user").c_str(),
-//                    appConfig.getStringProperty("db_password").c_str(),
-//                    appConfig.getIntProperty("db_port")
-//            )) {
         if (conn->connect(
-                "EGEyesForVSS",
-                "192.168.1.148",
-                "root",
-                "123456",
-                3306
+            appConfig.getStringProperty("database").c_str(),
+            appConfig.getStringProperty("db_host").c_str(),
+            appConfig.getStringProperty("db_user").c_str(),
+            appConfig.getStringProperty("db_password").c_str(),
+            appConfig.getIntProperty("db_port")
         )) {
+//        if (conn->connect(
+//                "EGEyesForVSS",
+//                "192.168.1.148",
+//                "root",
+//                "123456",
+//                3306
+//        )) {
             cout << "connect success" << endl;
         } else {
             cout << "connect failed" << endl;
diff --git a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
index 5106cbf..c353675 100644
--- a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
+++ b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
@@ -44,7 +44,6 @@
 }
 
 BASICGB28181::FFmpegDecoderJPG::~FFmpegDecoderJPG() {
-
     while (m_rtpQueue.count_queue()) {
         m_rtpQueue.popNotWait();
     }
@@ -65,10 +64,20 @@
         info->buffLen = datalen;
         info->camIdx = camIdx;
         memcpy(info->buff, data, datalen);
+    {
+//        FILE *fp11 = NULL;
+//        if (!fp11) {
+//        fp11 = fopen(camIdx.c_str(), "a+");
+//    }
+//        fwrite(data, sizeof(char), datalen, fp11);
+//        fclose(fp11);
+    }
+
 #ifdef TestCode
         DBG(" m_rtpQueue.push before ");
 #endif
-        m_rtpQueue.push(info);
+        m_rtpQueue.
+        push(info);
 #ifdef TestCode
         DBG(" m_rtpQueue.push after ");
 #endif
@@ -193,7 +202,7 @@
         p_this->frame_number++;
 
         int err6 = avcodec_send_packet(ctx, &pkt);
-        av_packet_unref(&pkt);
+//        av_packet_unref(&pkt);
         int err7 = avcodec_receive_frame(ctx, frame);
         if ((err7 == AVERROR(EAGAIN)) || (err5 < 0) || (err6 < 0)) {
             ERR(" error << err7:" << err7 << "  err5: " << err5 << " err6: " << err6);
@@ -446,6 +455,7 @@
     m_frameIndex++;
     m_packetsVec.push_back({m_frameIndex, newPacket});
     if (newPacket.flags & AV_PKT_FLAG_KEY) {
+        DBG("newPacket.flags & AV_PKT_FLAG_KEY   ");
         m_last_I_FrameId = m_frameIndex;
     }
 }
@@ -466,27 +476,27 @@
     */
     m_pOutVideo_stream = avformat_new_stream(m_pOutFmtCtx, NULL);
     {
-//        AVCodecContext *c;
-//        c = m_pOutVideo_stream->codec;
-//        c->bit_rate = 400000;
-//        c->codec_id = video_st->codec->codec_id;
-//        c->codec_type = video_st->codec->codec_type;
-//        c->time_base.num = video_st->time_base.num;
-//        c->time_base.den = video_st->time_base.den;
-//        fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den);
-//        c->width = video_st->codec->width;
-//        c->height = video_st->codec->height;
-//        c->pix_fmt = video_st->codec->pix_fmt;
-//        printf("%d %d %d", c->width, c->height, c->pix_fmt);
-//        c->flags = video_st->codec->flags;
-//        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-//        c->me_range = video_st->codec->me_range;
-//        c->max_qdiff = video_st->codec->max_qdiff;
-//
-//        c->qmin = video_st->codec->qmin;
-//        c->qmax = video_st->codec->qmax;
-//
-//        c->qcompress = video_st->codec->qcompress;
+        AVCodecContext *c;
+        c = m_pOutVideo_stream->codec;
+        c->bit_rate = 400000;
+        c->codec_id = video_st->codec->codec_id;
+        c->codec_type = video_st->codec->codec_type;
+        c->time_base.num = video_st->time_base.num;
+        c->time_base.den = video_st->time_base.den;
+        fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den);
+        c->width = video_st->codec->width;
+        c->height = video_st->codec->height;
+        c->pix_fmt = video_st->codec->pix_fmt;
+        printf("%d %d %d", c->width, c->height, c->pix_fmt);
+        c->flags = video_st->codec->flags;
+        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+        c->me_range = video_st->codec->me_range;
+        c->max_qdiff = video_st->codec->max_qdiff;
+
+        c->qmin = video_st->codec->qmin;
+        c->qmax = video_st->codec->qmax;
+
+        c->qcompress = video_st->codec->qcompress;
     }
     ret = avio_open(&m_pOutFmtCtx->pb, filename, AVIO_FLAG_WRITE);
     if (ret < 0) {
@@ -494,7 +504,7 @@
         return -1;
     }
 
-    avformat_write_header(m_pOutFmtCtx, NULL);
+    DBG(" avformat_write_header   " << avformat_write_header(m_pOutFmtCtx, NULL));
 
     m_bstartWrite = true;
     m_bFirstKeyFrame = true;
diff --git a/QiaoJiaSystem/VideoAnalysFromHC/main.cpp b/QiaoJiaSystem/VideoAnalysFromHC/main.cpp
index 5103ad8..39abc9a 100644
--- a/QiaoJiaSystem/VideoAnalysFromHC/main.cpp
+++ b/QiaoJiaSystem/VideoAnalysFromHC/main.cpp
@@ -84,7 +84,7 @@
     int arg1 = atoi(argv[1]);
 
     int gindx = abs(arg1) % 2;
-    int GB28181_Enable = arg1 < 0 ? gindx : -1;
+    int GB28181_Enable = arg1 < 0 ? 1 : -1;
     DBG(gindx);
     appPref.setIntData("GB28181_Enable", GB28181_Enable);
 
diff --git a/QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt b/QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt
index 8b92de1..d484908 100644
--- a/QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt
+++ b/QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt
@@ -96,12 +96,14 @@
 )
 
 add_executable(${PROJECT_NAME}
+
+    ./pushStream/PushStreamAppPipeController.cpp
     ../GB28181DecoderModel/FFmpegDecoderJPG.cpp
     ../GB28181DecoderModel/GB28181Server.cpp
     ../GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
-    ../../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp
+    #    ../../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp
     ../../../BasicPlatForm/basic/util/BASE64/Base64.cpp
-    #       ../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp
+#        ../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp
     ../VideoServer/QiaoJia/DB/LDBTool.cpp
     ./rpc/RtspAnalysServer.cpp
     RtspCaptureElement.cpp
diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp
index 8eafe6d..a49c256 100644
--- a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp
+++ b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp
@@ -165,9 +165,12 @@
             m_imgRedisCRwLock.unlock();
 
             //VideoCaptureElementWithRtp(std::string &chanPubID, int fps, int streamTransType, int gpuIdx = -1)
-            m_controllers_videoCapElem[index] = new BASICGB28181::VideoCaptureElementWithRtp(
-                const_cast<string &>(index),
-                25, 0, 0, this);
+//            m_controllers_videoCapElem[index] = new BASICGB28181::VideoCaptureElementWithRtp(
+//                const_cast<string &>(index),
+//                25, 0, 0, this);
+
+            m_controllers_videoCapElem[index] = new PushStreamAppPipeController(const_cast<string &>(index),
+                                                                                25, 0, 0, this);
             m_controllers_videoCapElem[index]->SetVideoMinMaxSeconds(lst_dev.n_cut_min_duration,
                                                                      lst_dev.n_cut_max_duration);
             m_controllers_videoCapElem[index]->start();
@@ -310,7 +313,7 @@
             auto pCaptureElem = m_controllers_videoCapElem.find(nameSt.m_camId);
             if (pCaptureElem != m_controllers_videoCapElem.end()) {
 //#todo ~~~~~~!!!!!!! 杩欓噷鏈塨ug 闇�瑕佹斁寮�璋冭瘯
-//                pCaptureElem->second->SaveVideo(name);
+                pCaptureElem->second->SaveVideo(name);
             } else {
                 ERR("Can not Find CamId " << nameSt.m_camId);
             }
diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
index d608547..fbd73ba 100644
--- a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
+++ b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
@@ -9,7 +9,8 @@
 #include <map>
 #include "RtspCaptureElement.h"
 #include "RtspImageRedis.h"
-#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
+//#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
+#include "pushStream/PushStreamAppPipeController.h"
 //#include <VideoCaptureElementWithRtp.h>
 #include <QiaoJia/DB/LDBTool.h>
 #include <basic/util/app/AppPreference.hpp>
@@ -63,7 +64,8 @@
     std::map<std::string, RtspCaptureElement *> m_controllers;
 
     //淇濆瓨CamID鍜孷ideoCaptureElementWithRtp鐨勬槧灏勫叧绯�
-    std::map<std::string, BASICGB28181::VideoCaptureElementWithRtp *> m_controllers_videoCapElem;
+//    std::map<std::string, BASICGB28181::VideoCaptureElementWithRtp *> m_controllers_videoCapElem;
+    std::map<std::string, PushStreamAppPipeController *> m_controllers_videoCapElem;
 
     //淇濆瓨CamID鍜孯tspImageRedisElement鐨勬槧灏勫叧绯�
     std::map<std::string, RtspImageRedisElement *> m_imgRedisControllers;
diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp b/QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp
index 70c9143..b8d983d 100644
--- a/QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp
+++ b/QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp
@@ -2,12 +2,13 @@
 #include <basic/debug/Debug.h>
 #include <opencv2/opencv.hpp>
 #include <basic/timer_counter/Clocktimer.h>
-#include <basic/pipe_element/ffmpeg/cap_ffmpeg_impl.hpp>
 #include <thread>
 #include <basic/util/app/AppPreference.hpp>
 #include <QString>
 #include <QDateTime>
 #include "RtspAnalysManager.h"
+//#include <basic/pipe_element/ffmpeg/cap_ffmpeg_impl.hpp>
+#include "../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp"
 
 RtspCaptureElement::RtspCaptureElement(const std::string &path, const std::string &camId, int fps, int reopenTime,
                                        int gpuIndex, RtspAnalysManager *manager) :
diff --git a/QiaoJiaSystem/VideoToImageMulth/main.cpp b/QiaoJiaSystem/VideoToImageMulth/main.cpp
index 6403ebd..4f96c52 100644
--- a/QiaoJiaSystem/VideoToImageMulth/main.cpp
+++ b/QiaoJiaSystem/VideoToImageMulth/main.cpp
@@ -62,11 +62,17 @@
     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 ? gindx : -1;
+    int GB28181_Enable = arg1 < 0 ? 1 : 0;
 
     DBG(gindx);
     appPref.setIntData("GB28181_Enable", GB28181_Enable);
diff --git a/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp b/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp
new file mode 100644
index 0000000..553a451
--- /dev/null
+++ b/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp
@@ -0,0 +1,50 @@
+#include "PushStreamAppPipeController.h"
+#include <basic/util/app/AppPreference.hpp>
+#include <basic/util/app/AppUtil.h>
+//#include <sstream>
+#include <algorithm>
+#include <basic/util/app/AppConfig.h>
+
+PushStreamAppPipeController::PushStreamAppPipeController(std::string &chanPubID, int fps,
+                                                         int streamTransType,
+                                                         int gpuIdx, RtspAnalysManager *manager) :
+    videoCaptureElement(chanPubID, fps, streamTransType, gpuIdx, manager),
+    index(chanPubID),
+    videoPublishElement(nullptr) {
+
+    string path = appConfig.getStringProperty("srsAddr") + "cam" + chanPubID + ".flv";
+    cv::Size size_(appPref.getIntData("pulish.width"), appPref.getIntData("pulish.height"));
+    int gupIdx = appPref.getLongData("gpu.index");
+    videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx);
+    if (appPref.getIntData("pulish.width") < 0 || appPref.getIntData("pulish.height") < 0) {
+        ERR("pulish.width:  " << appPref.getIntData("pulish.width") << "  Height: "
+                              << appPref.getIntData("pulish.height"));
+    }
+    videoCaptureElement.registerConnector([&] {
+        //if(!videoPublishElement.isBusy()){
+        videoPublishElement->setImage(videoCaptureElement.getImage());
+        //videoPublishElement.submit();
+        //}
+    });
+
+    registerElement(videoCaptureElement);
+    registerElement(*videoPublishElement);
+
+//    videoCaptureElement.setOutPutInterval(3);
+}
+
+std::string PushStreamAppPipeController::getRtmp() {
+    std::string ret = videoPublishElement->getPath();
+    size_t pos = ret.find(".flv");
+    ret = ret.substr(0, pos);
+    INFO(ret);
+    return ret;
+}
+
+void PushStreamAppPipeController::SaveVideo(const std::string &strImageName) {
+    videoCaptureElement.SaveVideo(strImageName);
+}
+
+void PushStreamAppPipeController::SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds) {
+    videoCaptureElement.SetVideoMinMaxSeconds(minSeconds, maxSeconds);
+}
diff --git a/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h b/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h
new file mode 100644
index 0000000..ea0085f
--- /dev/null
+++ b/QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h
@@ -0,0 +1,29 @@
+#ifndef PUSHSTREAMAPPPIPECONTROLLER_H
+#define PUSHSTREAMAPPPIPECONTROLLER_H
+
+#include <basic/pipe/PipeController.h>
+#include <basic/pipe_element/ffmpeg/FfmpegElement.h>
+#include <jsoncpp/json/json.h>
+#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
+
+class PushStreamAppPipeController : public PipeController {
+public:
+    PushStreamAppPipeController(std::string &chanPubID, int fps,
+                                int streamTransType,
+                                int gpuIdx, RtspAnalysManager *manager);
+
+    std::string getRtmp();
+
+
+    void SaveVideo(const std::string &strImageName);
+
+    //璁剧疆淇濆瓨瑙嗛鐨勬渶灏忓拰鏈�澶ч暱搴�,鍗曚綅鏄,瀹為檯鐨勮繍琛屾儏鍐垫湁涓�浜涘樊璺濓紝闇�瑕佸畬鍠�
+    void SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds);
+
+private:
+    BASICGB28181::VideoCaptureElementWithRtp videoCaptureElement;
+    ffmpeg::VideoPublishElement* videoPublishElement;
+    std::string index;
+};
+
+#endif // PUSHSTREAMAPPPIPECONTROLLER_H
diff --git a/QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp b/QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp
index bb406ce..60c32ed 100644
--- a/QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp
+++ b/QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp
@@ -75,12 +75,11 @@
     appPref.setIntData("yolo.port", 10003);
 //    rpcClient(appPref.getStringData("yolo.proxy"), appPref.getStringData("yolo.ip"), appPref.getLongData("yolo.port"),"tcp"),
 
-    Controllor *_Controllor = new Controllor(1, "/home/bsk/210235C23NF187000045$2019-02-28-23-07-30_209850_210049.mp4");
+    Controllor *_Controllor = new Controllor(1,
+                                             "/home/pans/work/qiaojia/cut/44120000001325000005/201903/06/2019030617/44120000001325000005$2019-03-06-17-51-53_4747_4946.mp4");
     _Controllor->start();
 
     getchar();
-
-
 
 
     YoloRpcElement m_YoloRpcElement("YoloRpc");

--
Gitblit v1.8.0