chenshijun
2019-04-16 f946a62d3921e86b44ff8e2973138304b9cd53cd
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
@@ -9,15 +9,20 @@
#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>
#include "RtspAnalysServer.h"
#include "NsqMsgTool.hpp"
//#include <GB28181DecoderModel/VideoCaptureElementWithRtp.h>
//#include <VideoToImageMulth/rpc/RtspAnalysServer.h>
//using BASICGB28181::VideoCaptureElementWithRtp;
//外部使用的全局指针
extern void *gRtspAnalysManagerCamera;
//用来实现recordVideo的RPC的接口类
class RtspAnalysManager : public ::RtspAnalys::RtspAnalysServer {
@@ -27,6 +32,25 @@
    RtspAnalysManager() : m_maxCount(50), m_currentCount(0) {
        m_lDBTool = new LDBTool;
        init();
        IMPORT_APP_ARGS;
        //nsq   set callback func
        DBG("NsqMsgConsumer Init");
        DBG("argv[0]:" << argv[0]);
        if(argv[0][0] == '.' && argv[0][1] == '/'){
            string pName(argv[0]+2, argv[0]+strlen(argv[0]));
            DBG("pName:" << pName);
            nsqMsgConsumer = new BasicMsg::Nsq::NsqMsgConsumer("127.0.0.1", "4150", pName,
                                                               to_string(appPref.getIntData("RpcVTIMPort")));
        }else{
            string pName(argv[0]);
            DBG("pName:" << pName);
            nsqMsgConsumer = new BasicMsg::Nsq::NsqMsgConsumer("127.0.0.1", "4150", pName,
                                                               to_string(appPref.getIntData("RpcVTIMPort")));
        }
        nsqMsgConsumer->setMessageCallback(std::bind(&OnMsgFunc, std::placeholders::_1, this));
        nsqMsgConsumer->init();
        DBG("NsqMsgConsumer Init END!!");
    }
    RtspAnalysManager(LDBTool *_dbTool);
@@ -51,7 +75,12 @@
private:
    void init();
    static void OnMsgFunc(void *msgPtr, void *pThisPtr);
private:
    //nsq
    BasicMsg::Nsq::NsqMsgConsumer *nsqMsgConsumer;
    RWLock m_imgRedisCRwLock;
@@ -63,7 +92,8 @@
    std::map<std::string, RtspCaptureElement *> m_controllers;
    //保存CamID和VideoCaptureElementWithRtp的映射关系
    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和RtspImageRedisElement的映射关系
    std::map<std::string, RtspImageRedisElement *> m_imgRedisControllers;