From b8c5eb8048b566d632b25391a79ccbd6ce33c010 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期六, 30 三月 2019 16:10:01 +0800 Subject: [PATCH] 1.3 增加nsq消息,解决进程重启 --- QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 45 insertions(+), 7 deletions(-) diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp index 01b854a..d786f47 100644 --- a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp +++ b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp @@ -44,10 +44,29 @@ DBG("searchCamDevTableByType size:" << lst.size()); if (lst.size() > 0) { - for (auto item : lst) { - std::string t_camIdex = item.str_cam_dev_id.toStdString(); + int startCamNO = appPref.getIntData("CamStartNO"); + int CamCount = appPref.getIntData("CamEndNO") - appPref.getIntData("CamStartNO") + 1; + INFO("StartCamNO: " << startCamNO << " CamCount: " << CamCount); + auto itor = lst.begin(); + + if (startCamNO >= lst.size()) { + ERR("startCamNO > lst.size()"); + return; + } + + for (int i = 0; i < startCamNO; i++) { + itor++; + } + + for (int i = 0; i < CamCount; i++) { + if (itor == lst.end()) { + ERR("itor == lst.end()"); + return; + } + std::string t_camIdex = itor->str_cam_dev_id.toStdString(); DBG("-----camID:" << t_camIdex << "min:" << cut_min_duration << "max:" << cut_max_duration); pthis->m_controllers_videoCapElem[t_camIdex]->SetVideoMinMaxSeconds(cut_min_duration, cut_max_duration); + itor++; } } else { ERR("searchCamDevTableByType size is 0"); @@ -127,14 +146,33 @@ appPref.setIntData("n_cut_max_duration", lst_dev.n_cut_max_duration); appPref.setIntData("n_cut_min_duration", lst_dev.n_cut_min_duration); if (lst.size() > 0) { - for (auto item : lst) { - std::string t_camIdex = item.str_cam_dev_id.toStdString(); + int startCamNO = appPref.getIntData("CamStartNO"); + int CamCount = appPref.getIntData("CamEndNO") - appPref.getIntData("CamStartNO") + 1; + INFO("StartCamNO: " << startCamNO << " CamCount: " << CamCount); + auto itor = lst.begin(); + + if (startCamNO >= lst.size()) { + ERR("startCamNO > lst.size()"); + return; + } + + for (int i = 0; i < startCamNO; i++) { + itor++; + } + + for (int i = 0; i < CamCount; i++) { + if (itor == lst.end()) { + ERR("itor == lst.end()"); + return; + } + std::string t_camIdex = itor->str_cam_dev_id.toStdString(); std::string rtsp_url = "GB28181"; -// rtspAddrBuild(item.str_ip.toStdString(), 554, item.str_username.toStdString(), -// item.str_password.toStdString(), item.str_brand.toStdString()); - INFO("cam add is " << item.str_addr.toStdString()); + + INFO("cam add is " << itor->str_addr.toStdString()); + addCamera(t_camIdex, rtsp_url); sleep(1); + itor++; } } else { ERR("searchCamDevTableByType size is 0"); -- Gitblit v1.8.0