派生自 development/c++

pansen
2019-02-25 8d1ead663449e6bf508d4d703b6d56381141daeb
GPU idx 变更
8个文件已修改
103 ■■■■■ 已修改文件
QiaoJiaSystem/DataManagerServer/http_configserver.cpp 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/FaceDetectServer/FaceDetectServerI.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/FaceDetectServer/FaceExtractServerI.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/FaceDetectServer/main_detect.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/StructureApp/AppPipeController.cpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/StructureApp/AppPipeController.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/main.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/YoloServer/main.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/http_configserver.cpp
@@ -22,6 +22,7 @@
#include <time.h>
#include <dirent.h>
#include "basic/pipe_element/ffmpeg/basic_struct_for_video_image.h"
using namespace std;
devHttpServer_c::devHttpServer_c()
@@ -1004,8 +1005,10 @@
    std::string out = value.size() > 0 ? value.toStyledString() : "[]";
    return out;
}
#define ADD_CAMERA 0
#define EDIT_CAMERA 1
//编辑摄像机
std::string devHttpServer_c::cam_edit(std::string ip, unsigned int port, std::string content, PResponse &response) {
    DBG("ip:" << ip << "; port:" << port);
@@ -1051,36 +1054,25 @@
//        rec_sdk.str_det_thr = QString::fromStdString(value["str_det_thr"].asString());
//        rec_sdk.str_cmp_thr = QString::fromStdString(value["str_cmp_thr"].asString());
        bool is_exist=db_c.searchCamDevByCamId(rec.str_cam_dev_id);
        if(ADD_CAMERA == type )
        {
           if(is_exist)
           {
        if (ADD_CAMERA == type) {
            if (is_exist) {
               return "{\"ret_status\": \"请勿重复添加!\"}";
           }
           else
           {
            } else {
               ret =db_c.insertCamDevTable(rec);
               if (!ret) {
                   return "err_db_content";
               }
           }
        }
        else if(EDIT_CAMERA == type )
        {
            if(is_exist)
            {
        } else if (EDIT_CAMERA == type) {
            if (is_exist) {
                ret = db_c.updateCamDevTable(rec);
                if (!ret) {
                    return "err_db_content";
                }
            }
            else
            {
            } else {
                 return "{\"ret_status\": \"内容有误,请检查!\"}";
            }
        }
        else
        {
        } else {
             return "{\"ret_status\": \"内容有误,请检查!\"}";
        }
@@ -2413,8 +2405,7 @@
std::string devHttpServer_c::getAlarmImageByPicDateAndDevId(const std::string& picDate,const std::string& devId,
                                                        PResponse &response) {
    try {
        if(!devId.empty() && !picDate.empty())
        {
        if (!devId.empty() && !picDate.empty()) {
            std::string videoPath;
            qint64 sub;
            std::string path = getVideoPathByPicDate(picDate, devId, sub);
@@ -2524,7 +2515,6 @@
}
std::string devHttpServer_c::getAlarmImageFromVideoFile(std::string ip, unsigned int port, std::string content,
                                                        PResponse &response)  {
    INFO("ip:" << ip << "; port:" << port << "content: " << content);
@@ -2536,16 +2526,14 @@
            std::string picDate = value["picDate"].asString();
            std::string imgKey = value["imgKey"].asString();
            //兼容旧版本
            if(imgKey=="undefined" || imgKey.empty())
            {
            if (imgKey == "undefined" || imgKey.empty()) {
                DBG("getAlarmImageByPicDateAndDevId " << imgKey);
                return getAlarmImageByPicDateAndDevId(picDate,devId,response);
            }
            else
            {
            } else {
                DBG("getAlarmImageByImageKeyAndDevId " << imgKey);
                return getAlarmImageByImageKeyAndDevId(imgKey,devId,response);
            }    
        }
        else{
        } else {
            response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"传输错误,请检查!\"}");
            ERR("ImageURL:传输错误,请检查");
            return "";
@@ -2559,7 +2547,6 @@
        return "";
    }
}
std::string devHttpServer_c::getAlarmImageByImageKeyAndDevId(const std::string& imgKey,const std::string& devId,
@@ -2586,11 +2573,11 @@
            std::string strSelectTemplate=R"#( -vf "select=eq(n\,%d)")#";
            sprintf(selectExpBuff,strSelectTemplate.c_str(),frameIdDiff-1);
            if(videoSt.Valid() && imgSt.Valid() ) {
                std::string cmd("ffmpeg -i '" + videoPath+"'"+std::string(selectExpBuff)+" -vframes 1" +" -y '" + str_imgName + "'");
                std::string cmd("ffmpeg -i '" + videoPath + "'" + std::string(selectExpBuff) + " -vframes 1" + " -y '" +
                                str_imgName + "'");
                INFO("Video To Image Cmd: "<<cmd);
                system(cmd.c_str());
            }
            else {
            } else {
                ERR("Parse Video and Image Failed Path: "<<path <<" ImageId: "<<imgKey);
                return "{\"error\":\"未查到视频路径\"}";
            }
@@ -2652,13 +2639,10 @@
        std::string path;
        //兼容旧版本
        if(imgKey=="undefined"||imgKey.empty())
        {
        if (imgKey == "undefined" || imgKey.empty()) {
            qint64 sub;
            path = getVideoPathByPicDate(picDate,devId,sub);
        }
        else
        {
        } else {
            path = getVideoPathByImgKey(imgKey,devId);
        }
        //std::string path = getVideoPathByImgKey(imgKey, devId, sub);
@@ -2823,8 +2807,7 @@
    std::lock_guard<std::mutex> lock(g_mutex);
    std::vector<std::string> vec = forEachFileByImgKey(strPath);
    ImageName_s_t imgSt = ImageName_s_t::fromString(imgKey);
    if(!imgSt.Valid())
    {
    if (!imgSt.Valid()) {
        ERR("ParseImageName Failed : "<<imgKey);
        return "";
    }
@@ -2843,7 +2826,8 @@
                    ERR("Image " << imgKey << "   Video: " << item << " Not Match");
                }
            } else{
                ERR("ImageID: "<<imgSt.m_frameId <<" VideoRange: "<<videoParseResult.m_startFrameId<<" , "<<videoParseResult.m_endFrameId);
                ERR("ImageID: " << imgSt.m_frameId << " VideoRange: " << videoParseResult.m_startFrameId << " , "
                                << videoParseResult.m_endFrameId);
            }
        } else {
@@ -2857,8 +2841,7 @@
        return strVideoName;
    } else {
        ERR("ImageName: "<<imgKey<<"  MatchVideoCount: "<<videoStVec.size());
        for(auto& item:vec)
        {
        for (auto &item:vec) {
            ERR("VideoName: "<<item);
        }
        return "";
@@ -2866,8 +2849,7 @@
}
//新的根据图片名称获取路径的方法
std::string devHttpServer_c::getVideoPathByImgKey(const std::string &imgKey, const std::string &camId)
{
std::string devHttpServer_c::getVideoPathByImgKey(const std::string &imgKey, const std::string &camId) {
    INFO("GetVideoFor: "<<imgKey<<" CamID:"<<camId);
    ImageName_s_t imgSt= ImageName_s_t::fromString(imgKey);
@@ -2881,7 +2863,6 @@
    std::string videoPath = t_FilePath+"/"+camId+"/"+std::string(curFolder);
    return GetVideoNameByImgKey(imgKey,videoPath);
}
qint64 devHttpServer_c::getVideoTime(/*const std::string &videoPath,*/std::string &str_tmpTime) {
@@ -3271,8 +3252,7 @@
        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() )
        {
        if (rtsp_url.empty()) {
            return "{\"ret_status\":\"内容有误,请检查!\"}";
        }
//        unsigned char serialnumber[SERIALNO_LEN] = {0};
@@ -3294,7 +3274,9 @@
        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 + " -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());
QiaoJiaSystem/FaceDetectServer/FaceDetectServerI.cpp
@@ -90,6 +90,7 @@
        }
        return thftResult;
    } else {
        throw std::runtime_error("shareMemory attach faild");
        ERR("shareMemory error  " << shareMemoryName);
//        throw std::runtime_error("shareMemory attach faild");
    }
}
QiaoJiaSystem/FaceDetectServer/FaceExtractServerI.cpp
@@ -47,7 +47,8 @@
        }
        return feature;
    } else {
        throw std::runtime_error("shareMemory attach faild");
        ERR("shareMemory attach faild");
//        throw std::runtime_error("shareMemory attach faild");
    }
}
QiaoJiaSystem/FaceDetectServer/main_detect.cpp
@@ -47,7 +47,7 @@
    ENABLEGLOG(GET_STR_CONFIG("logPath").c_str());
    auto ich = Ice::initialize(argc, argv);
    appPref.setLongData("gpu.index", 0);
    appPref.setLongData("gpu.index", 1);
    appPref.setLongData("thread.max", 32);
    IceRpcServer<FaceDetectServerI> server("faceServer", 10002, "tcp");
QiaoJiaSystem/StructureApp/AppPipeController.cpp
@@ -30,7 +30,7 @@
    faceRpcElement(folderPath + "faceRpc", ruleMap[FaceSdk]),
    faceExtractElement(folderPath + "faceExtract", ruleMap[FaceSdk]),
    triggerElement(25, 10),
    recordVideoElement(-1, ""),
//    recordVideoElement(-1, ""),
    bRecordVideoEnable(false),
    m_bSetWH(false)
@@ -80,8 +80,8 @@
    faceRpcElement(camId + "faceRpc", ruleMap[FaceSdk]),
    faceExtractElement(camId + "faceExtract", ruleMap[FaceSdk]),
    triggerElement(25, 4),
    recordVideoElement(camId, appPref.getStringData(camId + "rtsp")),
    newRecordVideoElement(camId),
//    recordVideoElement(camId, appPref.getStringData(camId + "rtsp")),
//    newRecordVideoElement(camId),
    perimeterElement(ruleMap[PerimeterSdk]),
    crowdElement(ruleMap[CrowdSdk]),
    perStaticElement(ruleMap[PerStaticSdk]),
QiaoJiaSystem/StructureApp/AppPipeController.h
@@ -109,8 +109,8 @@
    FaceRpcElement faceRpcElement;
    FaceExtractElement faceExtractElement;
    ImageDrawElement imageDrawElement;
    RecordVideoElement recordVideoElement;
    NewRecordVideoElement newRecordVideoElement;
//    RecordVideoElement recordVideoElement;
//    NewRecordVideoElement newRecordVideoElement;
    PersonElement personElement;
    int m_index;
QiaoJiaSystem/VideoToImageMulth/main.cpp
@@ -24,7 +24,6 @@
}
int main(int argc, char **argv) {
    std::cout<<__DATE__<<" "<<__TIME__<<std::endl;
    SAVE_APP_ARGS
@@ -33,7 +32,9 @@
        ENABLEGLOG(GET_STR_CONFIG("logPath").c_str());
#endif
    appPref.setLongData("gpu.index", 1);
    int gindx = atoi(argv[1]) % 2;
    DBG(gindx);
    appPref.setLongData("gpu.index", gindx);
    appPref.setIntData("show.image", 0);
    //todo
QiaoJiaSystem/YoloServer/main.cpp
@@ -30,7 +30,7 @@
//        return -1;
//    }
    int gpuindex = 0;
    int gpuindex = 1;
    int poolNum = 1;
    int portNum = 10003;