| | |
| | | IMPORT_APP_ARGS; |
| | | //nsq set callback func |
| | | DBG("NsqMsgConsumer Init"); |
| | | string pName(argv[0]); |
| | | nsqMsgConsumer = new BasicMsg::Nsq::NsqMsgConsumer("127.0.0.1", "4150", pName, |
| | | to_string(appPref.getIntData("RpcVTIMPort"))); |
| | | 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!!"); |
| | |
| | | for (auto itor_json = value.begin(); itor_json != itor_json_end; ++itor_json) { |
| | | //#todo 使用策略模式?发送端多个指令累积后发送? |
| | | if (itor_json->isString() && reader.parse(itor_json->asString(), cfg_val)) { |
| | | DBG("itor_json.name():" << itor_json.name()); |
| | | if (itor_json.name() == "cut_dura_edit") { |
| | | int cut_max_duration = cfg_val["cut_max_duration"].asInt(); |
| | | int cut_min_duration = cfg_val["cut_min_duration"].asInt(); |
| | |
| | | item.second->SetVideoMinMaxSeconds(cut_min_duration, cut_max_duration); |
| | | } |
| | | } |
| | | } else if (itor_json.name() == "cam_edit" ) { |
| | | string cam_idx = cfg_val["str_cam_dev_id"].asString(); |
| | | } else if (itor_json.name() == "cam_edit") { |
| | | string cam_idx = ""; |
| | | if(pthis->m_GB28181_Enable){ |
| | | cam_idx = cfg_val["equipCode"].asString(); |
| | | }else{ |
| | | cam_idx = cfg_val["str_cam_dev_id"].asString(); |
| | | } |
| | | |
| | | if (pthis->m_GB28181_Enable) { |
| | | if (pthis->m_controllers_videoCapElem.find(cam_idx) != |
| | | pthis->m_controllers_videoCapElem.end()) { |
| | | INFO("cam add is " << cfg_val["str_addr"].asString()); |
| | | INFO("cam add is " << cam_idx); |
| | | pthis->addCamera(cam_idx, "GB28181"); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else if (itor_json.name() == "cam_del") { |
| | | string cam_idx = cfg_val["str_cam_dev_id"].asString(); |
| | | string cam_idx = ""; |
| | | if(pthis->m_GB28181_Enable){ |
| | | cam_idx = cfg_val["equipCode"].asString(); |
| | | }else{ |
| | | cam_idx = cfg_val["str_cam_dev_id"].asString(); |
| | | } |
| | | pthis->removeCamera(cam_idx); |
| | | } else if (itor_json.name() == "cam_startPublish") { |
| | | string cam_idx = cfg_val["id"].asString(); |
| | | if (pthis->m_GB28181_Enable) { |
| | | pthis->removeCamera(cam_idx); |
| | | if (pthis->m_controllers_videoCapElem.find(cam_idx) != |
| | | pthis->m_controllers_videoCapElem.end()) { |
| | | INFO("cam add is " << cam_idx); |
| | | pthis->m_controllers_videoCapElem[cam_idx]->startPublishVideo(); |
| | | } |
| | | } else { |
| | | pthis->removeCamera(cam_idx); |
| | | if (pthis->m_controllers.find(cam_idx) != pthis->m_controllers.end()) { |
| | | INFO("cam add is " << cam_idx); |
| | | pthis->m_controllers[cam_idx]->startPublishVideo(); |
| | | } |
| | | } |
| | | } else if (itor_json.name() == "cam_stopPublish") { |
| | | string cam_idx = cfg_val["id"].asString(); |
| | | if (pthis->m_GB28181_Enable) { |
| | | if (pthis->m_controllers_videoCapElem.find(cam_idx) != |
| | | pthis->m_controllers_videoCapElem.end()) { |
| | | INFO("cam add is " << cfg_val["str_addr"].asString()); |
| | | pthis->m_controllers_videoCapElem[cam_idx]->stopPublishVideo(); |
| | | } |
| | | } else { |
| | | if (pthis->m_controllers.find(cam_idx) != pthis->m_controllers.end()) { |
| | | INFO("cam add is " << cfg_val["str_addr"].asString()); |
| | | pthis->m_controllers[cam_idx]->stopPublishVideo(); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | |
| | | // auto lst = m_lDBTool->searchCamDevTableAll(); |
| | | Record_Config lst_dev = m_lDBTool->searchConfigTableWithinServerInfo(); |
| | | if (m_controllers.find(index) == m_controllers.end()) { |
| | | INFO("MYH DEBUG HERE"); |
| | | // INFO("MYH DEBUG HERE"); |
| | | if (m_currentCount >= m_maxCount) { |
| | | ERR("addCamera faild, camera's num is full!") |
| | | return -1; |
| | |
| | | * @return 总是0 |
| | | */ |
| | | int RtspAnalysManager::removeCamera(const std::string &index) { |
| | | INFO("MYH DEBUG HERE"); |
| | | // INFO("MYH DEBUG HERE"); |
| | | if (m_GB28181_Enable) { |
| | | if (m_controllers_videoCapElem.find(index) == m_controllers_videoCapElem.end())return -1; |
| | | auto controller = m_controllers_videoCapElem[index]; |
| | |
| | | delete imgRedis; |
| | | m_imgRedisControllers.erase(index); |
| | | m_imgRedisCRwLock.unlock(); |
| | | INFO("MYH DEBUG HERE"); |
| | | // INFO("MYH DEBUG HERE"); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | |
| | | //录取视频的RPC的接口函数 |
| | | ::std::string RtspAnalysManager::recordVideo(const ::std::string &name, const ::Ice::Current &) { |
| | | INFO("Record Video For: " << name); |
| | | // INFO("Record Video For: " << name); |
| | | ImageName_s_t nameSt = ImageName_s_t::fromString(name); |
| | | if (nameSt.Valid()) { |
| | | if (m_GB28181_Enable) { |