派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef APPPACONTROLLER_H
#define APPPACONTROLLER_H
 
#include <basic/pipe/PipeController.h>
#include <basic/pipe_element/ffmpeg/FfmpegElement.h>
#include <basic/pipe_element/ImageShowElement.h>
#include <basic/util/curl/HttpRequestWithCrul.hpp>
#include "PaImageDrawElement.h"
#include "../StructureApp/RecordVideoElement.h"
#include "PaYoloRpcElement.h"
#include <TriggerElement.h>
#include <QtCore/QDateTime>
#include <jsoncpp/json/json.h>
//#include <basic/rpc/IceRpc.hpp>
//#include "../Alarm/rpc/Alarm.h"
//#include "../netsoundbox/rpc/NetSoundBox.h"
//#include <QtCore/QVector>
//网络音箱配置
struct SoundPlayInfo
{
    SoundPlayInfo():nSoundDuration(-1)
    {}
    //int nID;
    std::string strIP;//音箱IP
    int nSoundDuration;//声音间隔时间
    std::string strPath;//声音路径
};
//摄像头信息
struct CamInfo
{
    int nFps;//帧率
    std::string strCamId;
    std::string strAdrr;
    std::string strRtsp;//RTSP地址
};
 
//报警信息
struct PaAlarmInfo
{
//    int nWallNum;//墙号
//    int nWallSubNum;//子墙号
//    int nWindowNum;//窗口号
    int nTriggerDelay;//报警开始延时时间间隔
    int nAlarmDelay;//报警结束延时时间间隔
    QString strMaskPath; //alarm maskPath解码器报警的ROI区域小图路径
    float fSensitivity;//alarm sensitivity报警的检测阈值
    int nAssembleCount;//聚集的人数
};
 
//聚集信息
struct AssembleInfo
{
    int nAssembleCount;//聚集的人数
    float fSensitivity;//AssembleInfo sensitivity聚集的检测阈值
    //std::string strProxy;
    std::string strMaskPath;// AssembleInfo maskPath聚集的ROI区域小图路径
    std::vector<SoundPlayInfo> sounds;//网络音箱播放信息
};
 
struct RuleWeekInfo
{
    RuleWeekInfo()
    {
        m_nType = 1;
        m_strBegin = "";
        m_strEnd = "";
    }
 
    int m_nType; //周几
    QString m_strBegin;//00:00
    QString m_strEnd;
};
//addcamera配置项
struct ControllerConfig
{
 
    //NONE neither alarm nor assemble
    //ALARM alarm
    //ASSEMBLE Assemble
 
    //camInfo
    CamInfo camInfo;//摄像头信息
 
    //alarmInfo
    PaAlarmInfo paAlarmInfo;//报警信息
 
    //AssembleInfo
  //  AssembleInfo assembleInfo;//聚集信息
 
    QVector<RuleWeekInfo> ruleWeekInfoVec;
 
};
 
class AppPaController : public PipeController {
public:
    /***
     * 用于快速视频结构化
     * @param folderPath 任务根目录,用于做共享内存id
     * @param json 参数为rtsp流地址 sdk是否启用的标识
     */
 
    AppPaController(int index, const ControllerConfig& cfg);
 
    virtual ~AppPaController();
 
    void sendVideoAlarm(bool value);
    //通知报警服务报警
    void openSoundAlarm();
    //通知报警服务关闭报警
    void closeSoundAlarm();
    //通知网络音箱播放音乐
    void playSound();
    //通知网络音箱停止播放音乐
    void stopSound();
 
    //void alarmResultSaveToDB(std::string&,std::string&,std::string&);
 
    //保存人体裁剪图
    static int saveRectsImage(const vector<cv::Rect2f>& rects,const cv::Mat& img,const char* path);
 
 
    bool isSaveVideo();
 
    bool isSaveResult();
 
    bool isSaveImage();
 
 
    bool getRunning();
 
    std::string getRtmp();
 
    void setfdfsClient(FastFdsWithLock *p_fdfsClient);
 
private:
    void init();
 
private:
    ffmpeg::VideoCaptureElement videoCaptureElement;
    PaYoloRpcElement yoloRpcElement;
    PaImageDrawElement imageDrawElement;
    RecordVideoElement recordVideoElement;
//    VideoPublishElement videoPublishElement;
 
    int m_index;
    std::string m_folderPath;
    Json::Value m_json_Record;
 
    Json::FastWriter m_fastWriter;
    FastFdsWithLock *fdfsClient;
 
 
    TriggerElement triggerElement;
    std::atomic<bool> bUp;
 
    QDateTime m_dt;
 
 
    const ControllerConfig m_cfg;
 
  //  NetSoundBox::SoundInfos soundInfos;
//    IceRpcClient<Alarm::AlarmInterfacePrx> alarmRpc;
//    IceRpcClient<NetSoundBox::SoundInterfacePrxPtr> soundRpc;
  //  IceRpcClient<SaveModule::SaveAlarmPrx> m_SaveAlarmRpc;
 
};
 
#endif // APPPIPECONTROLLER_H