From 0ac8a18ccb5b60e251954bb8901b4be47b52622e Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期一, 18 二月 2019 09:54:34 +0800 Subject: [PATCH] 启动多个解码进程 --- QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp | 43 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp index 0335346..7d6a0af 100644 --- a/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp +++ b/QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp @@ -48,16 +48,45 @@ appPref.setIntData("n_cut_min_duration", lst_dev.n_cut_min_duration); if (lst.size() > 0) { - for (auto item : lst) + int startCamNO = appPref.getIntData("CamStart") * appPref.getIntData("CamStep"); + int CamCount = appPref.getIntData("CamStep"); + auto itor = lst.begin(); + + if(startCamNO >= lst.size()) { - std::string t_camIdex = item.str_cam_dev_id.toStdString(); - std::string rtsp_url = 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()); + 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 = rtspAddrBuild(itor->str_ip.toStdString(), 554, itor->str_username.toStdString(), + itor->str_password.toStdString(), itor->str_brand.toStdString()); + INFO("cam add is " << itor->str_addr.toStdString()); addCamera(t_camIdex, rtsp_url); - + itor++; } + +// for (auto item : lst) +// { +// std::string t_camIdex = item.str_cam_dev_id.toStdString(); +// std::string rtsp_url = 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()); +// +// addCamera(t_camIdex, rtsp_url); +// +// } } else { ERR("searchCamDevTableAll size is 0"); } @@ -101,7 +130,7 @@ } else { removeCamera(index); DBG("removeCamera " << index); - return addCamera(rtsp, index); + return addCamera(index, rtsp); } } -- Gitblit v1.8.0