| | |
| | | elem["str_latitude"] = iter->str_latitude.toStdString(); |
| | | elem["str_ip"] = iter->str_ip.toStdString(); |
| | | elem["n_port"] = iter->n_port; |
| | | elem["type"] = iter->type; |
| | | elem["str_username"] = iter->str_username.toStdString(); |
| | | elem["str_password"] = iter->str_password.toStdString(); |
| | | elem["str_brand"] = iter->str_brand.toStdString(); |
| | |
| | | |
| | | if (count > 0) { |
| | | for (auto rule:ruleMap) { |
| | | elem["nSdkTypes"].append(rule.second.nSdkType); |
| | | if (rule.second.nIsRun == 1) { |
| | | elem["nSdkTypes"].append(rule.second.nSdkType); |
| | | } |
| | | } |
| | | } |
| | | // Record_Cam_Sdk rec_sdk = db_c.searchCamSdkTableByCamId(iter->str_cam_dev_id); |
| | |
| | | if (TableName.find("lt_") != 0) { |
| | | TableName.insert(0, "lt_"); |
| | | } |
| | | fieldValues.insert(std::make_pair("tableName", TableName)); |
| | | fieldValues["tableName"] = TableName; |
| | | |
| | | ret = m_SqliteFaceEncap.updateTable("sys_o_tables", fieldValues); |
| | | } |
| | |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | |
| | | std::string ip = value["str_ip"].asString(); |
| | | std::string str_imgName = ""; |
| | | std::string rtsp_ip = value["str_ip"].asString(); |
| | | // int port= value["n_port"].asInt(); |
| | | int port = 554; |
| | | std::string username = value["str_username"].asString(); |
| | | std::string pass = value["str_password"].asString(); |
| | | std::string brand = value["str_brand"].asString(); |
| | | std::string rtsp_url = rtspAddrBuild(ip, port, username, pass, brand); |
| | | if (rtsp_url.empty()) { |
| | | return "{\"ret_status\":\"内容有误,请检查!\"}"; |
| | | } |
| | | std::string rtsp_url = rtspAddrBuild(rtsp_ip, port, username, pass, brand); |
| | | |
| | | if (value.isMember("id")) { |
| | | if (value["id"].isNull()) return "{\"ret_status\": \"id内容有误,请检查!\"}"; |
| | | str_imgName.append("./").append(value["id"].asString()).append(".jpg"); |
| | | } else { |
| | | if (rtsp_url.empty()) { |
| | | return "{\"ret_status\":\"内容有误,请检查!\"}"; |
| | | } |
| | | // unsigned char serialnumber[SERIALNO_LEN] = {0}; |
| | | // int ret = getDevSerialNumber(ip.c_str(), port,username.c_str(),pass.c_str(),brand.c_str(),serialnumber); |
| | | |
| | |
| | | |
| | | // std::string str_cam_dev_id = std::string((char *) serialnumber);//摄像机id cam_mac |
| | | |
| | | std::string str_imgName = appConfig.getStringProperty("cutPath"); |
| | | if (str_imgName.back() != '/') { |
| | | str_imgName.push_back('/'); |
| | | } |
| | | str_imgName += ip; |
| | | str_imgName += "-"; |
| | | str_imgName += "snapshot.jpg"; |
| | | //admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream -r 1/25 -f image2 -s 1920*1080 /home/basic/work_src/a.jpg |
| | | std::string cmd( |
| | | "ffmpeg -i " + rtsp_url + " -vf select='eq(pict_type\\,I)',setpts='N/(25*TB)' -f image2 -s 1920*1080 -y " + |
| | | str_imgName); |
| | | str_imgName = appConfig.getStringProperty("cutPath"); |
| | | if (str_imgName.back() != '/') { |
| | | str_imgName.push_back('/'); |
| | | } |
| | | str_imgName += rtsp_ip; |
| | | str_imgName += "-"; |
| | | str_imgName += "snapshot.jpg"; |
| | | //admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream -r 1/25 -f image2 -s 1920*1080 /home/basic/work_src/a.jpg |
| | | std::string cmd( |
| | | "ffmpeg -i " + rtsp_url + |
| | | " -vf select='eq(pict_type\\,I)',setpts='N/(25*TB)' -f image2 -s 1920*1080 -y " + |
| | | str_imgName); |
| | | // std::string cmd("ffmpeg -i " + rtsp_url + " -r 1/25 -f image2 -s 1920*1080 -y " + str_imgName); |
| | | DBG(cmd); |
| | | system(cmd.c_str()); |
| | | DBG(cmd); |
| | | system(cmd.c_str()); |
| | | } |
| | | |
| | | cv::Mat img = cv::imread(str_imgName); |
| | | |
| | |
| | | fdfsClient.rwLock.unlock(); |
| | | Json::Value result; |
| | | result["imgUrl"] = strImgUrl; |
| | | db_c.updateCamDevSnapshot(QString::fromStdString(ip), QString::fromStdString(strImgUrl)); |
| | | db_c.updateCamDevSnapshot(QString::fromStdString(rtsp_ip), QString::fromStdString(strImgUrl)); |
| | | |
| | | return result.toStyledString(); |
| | | |