| | |
| | | return rtsp_url; |
| | | } |
| | | |
| | | //初始化函数 |
| | | void RtspAnalysManager::init() { |
| | | |
| | | auto lst = m_lDBTool->searchCamDevTableAll(); |
| | |
| | | m_controllers.clear(); |
| | | } |
| | | |
| | | /** |
| | | * 根据摄像机ID和RTSP路径,增加摄像机 |
| | | * 对于每个摄像机有一个 RtspImageRedisElement 对象用于保存图片到Redis |
| | | * 有一个 RtspCaptureElement 用户录取和保存视频 |
| | | * @param index 摄像机id |
| | | * @param rtsp 上面的摄像机对应的视频路径 |
| | | * @return -1 添加失败,0 添加成功 |
| | | */ |
| | | int RtspAnalysManager::addCamera(const std::string &index, const std::string& rtsp) { |
| | | auto lst = m_lDBTool->searchCamDevTableAll(); |
| | | Record_Config lst_dev = m_lDBTool->searchConfigTableWithinServerInfo(); |
| | |
| | | |
| | | } else { |
| | | removeCamera(index); |
| | | DBG("removeCamera " << index) |
| | | DBG("removeCamera " << index); |
| | | return addCamera(rtsp, index); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据CamID移除摄像机,同时停止视频的抓取和保存图片到Redis |
| | | * @param index 摄像机ID |
| | | * @return 总是0 |
| | | */ |
| | | int RtspAnalysManager::removeCamera(const std::string &index) { |
| | | if (m_controllers.find(index) == m_controllers.end())return -1; |
| | | auto controller = m_controllers[index]; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 移除所有的摄像机 |
| | | * @return |
| | | */ |
| | | int RtspAnalysManager::removeAll() { |
| | | for (auto controller: m_controllers) { |
| | | controller.second->stop(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | //获取最大的摄像机数量 |
| | | int RtspAnalysManager::getMaxCamCount() { |
| | | return m_maxCount; |
| | | } |
| | | |
| | | //获取当前的摄像机数量 |
| | | int RtspAnalysManager::getCurrentCamCount() { |
| | | return m_currentCount; |
| | | } |
| | | |
| | | |
| | | //录取视频的RPC的接口函数 |
| | | ::std::string RtspAnalysManager::recordVideo(const ::std::string& name, const ::Ice::Current&) |
| | | { |
| | | INFO("Record Video For: "<<name); |
| | |
| | | return name; |
| | | } |
| | | |
| | | |
| | | //保存视频到RtspImageRedis的队列,由RtspCaptureElement调用 |
| | | bool RtspAnalysManager::SaveImageToRedis(const std::string& camId,const std::string& imageName,const cv::Mat& img) |
| | | { |
| | | auto item = m_imgRedisControllers.find(camId); |