From e15c4888f720b8781260b901ac82d058f8f7c3b5 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期三, 27 三月 2019 14:34:37 +0800
Subject: [PATCH] 移植nsq到项目中,将最短最长时长的参数修改成nsq配置

---
 QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
index da8e966..94f3750 100644
--- a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
+++ b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
@@ -9,23 +9,43 @@
 #include <map>
 #include "RtspCaptureElement.h"
 #include "RtspImageRedis.h"
-#include <VideoServer/QiaoJia/DB/LDBTool.h>
+//#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
+#include "pushStream/PushStreamAppPipeController.h"
+//#include <VideoCaptureElementWithRtp.h>
+#include <QiaoJia/DB/LDBTool.h>
 #include <basic/util/app/AppPreference.hpp>
 #include "RtspAnalysServer.h"
 
-class RtspAnalysManager :public ::RtspAnalys::RtspAnalysServer{
+#include "NsqMsgTool.hpp"
+//#include <GB28181DecoderModel/VideoCaptureElementWithRtp.h>
+//#include <VideoToImageMulth/rpc/RtspAnalysServer.h>
+
+//using BASICGB28181::VideoCaptureElementWithRtp;
+
+//鐢ㄦ潵瀹炵幇recordVideo鐨凴PC鐨勬帴鍙g被
+class RtspAnalysManager : public ::RtspAnalys::RtspAnalysServer {
 
 public:
 
-    RtspAnalysManager():m_maxCount(50), m_currentCount(0){
-        m_lDBTool=new LDBTool;
+    RtspAnalysManager() : m_maxCount(50), m_currentCount(0) {
+        m_lDBTool = new LDBTool;
         init();
+
+        //nsq   set callback func
+        DBG("NsqMsgConsumer Init");
+        nsqMsgConsumer = new BasicMsg::Nsq::NsqMsgConsumer("127.0.0.1", "4150", "cut_dura_edit", to_string(appPref.getIntData("RpcVTIMPort")));
+        nsqMsgConsumer->setMessageCallback(std::bind(&OnMsgFunc, std::placeholders::_1, this));
+        nsqMsgConsumer->init();
+        DBG("NsqMsgConsumer Init END!!");
     }
+
     RtspAnalysManager(LDBTool *_dbTool);
-    virtual ::std::string recordVideo(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent);
+
+    virtual ::std::string recordVideo(const ::std::string &, const ::Ice::Current & = ::Ice::emptyCurrent);
+
     virtual ~RtspAnalysManager();
 
-    int addCamera(const std::string &, const std::string& rtsp);
+    int addCamera(const std::string &, const std::string &rtsp);
 
     int removeCamera(const std::string &);
 
@@ -36,20 +56,32 @@
     int getCurrentCamCount();
 
     // 鏍规嵁camId淇濆瓨img鍒癛edis,img鐨凨ey涓篿mageName
-    bool SaveImageToRedis(const std::string& camId,const std::string& imageName,const cv::Mat& img);
+    bool SaveImageToRedis(const std::string &camId, const std::string &imageName, const cv::Mat &img);
 
 private:
     void init();
+    static void OnMsgFunc(void *msgPtr, void *pThisPtr);
 
 private:
 
+    //nsq
+    BasicMsg::Nsq::NsqMsgConsumer *nsqMsgConsumer;
+
+    RWLock m_imgRedisCRwLock;
+
     LDBTool *m_lDBTool;
+
+    int m_GB28181_Enable;
 
     //淇濆瓨CamID鍜孯tspCaptureElement鐨勬槧灏勫叧绯�
     std::map<std::string, RtspCaptureElement *> m_controllers;
 
+    //淇濆瓨CamID鍜孷ideoCaptureElementWithRtp鐨勬槧灏勫叧绯�
+//    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;
+    std::map<std::string, RtspImageRedisElement *> m_imgRedisControllers;
     //褰撳墠鎽勫儚澶寸殑鏁伴噺
     int m_currentCount;
     // 鎽勫儚澶寸殑鏈�澶ф暟閲�

--
Gitblit v1.8.0