From d8cfbb5980817d904e305acee4a3d7b36d78c656 Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期五, 15 三月 2019 11:20:23 +0800 Subject: [PATCH] GB28181集成完成。录像bug暂未解决,已注释 --- QiaoJiaSystem/DataManagerServer/http_configserver.cpp | 51 +++++++++++++++++++++++++++++---------------------- 1 files changed, 29 insertions(+), 22 deletions(-) diff --git a/QiaoJiaSystem/DataManagerServer/http_configserver.cpp b/QiaoJiaSystem/DataManagerServer/http_configserver.cpp index 07d6de6..0750366 100644 --- a/QiaoJiaSystem/DataManagerServer/http_configserver.cpp +++ b/QiaoJiaSystem/DataManagerServer/http_configserver.cpp @@ -3342,17 +3342,22 @@ Json::Value value; if (reader.parse(content, value)) { + std::string str_imgName = ""; - std::string ip = value["str_ip"].asString(); + if (value.isMember("id")) { + if (value["id"].isNull()) return "{\"ret_status\": \"id鍐呭鏈夎锛岃妫�鏌ワ紒\"}"; + str_imgName.append("./").append(value["id"].asString()).append(".jpg"); + } else { + std::string 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\":\"鍐呭鏈夎锛岃妫�鏌ワ紒\"}"; - } + 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\":\"鍐呭鏈夎锛岃妫�鏌ワ紒\"}"; + } // unsigned char serialnumber[SERIALNO_LEN] = {0}; // int ret = getDevSerialNumber(ip.c_str(), port,username.c_str(),pass.c_str(),brand.c_str(),serialnumber); @@ -3364,20 +3369,22 @@ // std::string str_cam_dev_id = std::string((char *) serialnumber);//鎽勫儚鏈篿d 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 += 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); -- Gitblit v1.8.0