派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
GB28181集成完成,集成推流模块
2个文件已添加
9个文件已修改
444 ■■■■■ 已修改文件
QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h 187 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoAnalysFromHC/main.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/main.cpp 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h
@@ -17,47 +17,52 @@
 */
class VssLocalSettingTblController : public VssBaseController {
private:
    /** 本地国标配置构造函数 */
    VssLocalSettingTblController() {}
    /** 本地国标配置构造函数 */
    VssLocalSettingTblController() {}
public:
    /** 本地国标配置单例模式 */
    static VssLocalSettingTblController* instance() {
    /** 本地国标配置单例模式 */
    static VssLocalSettingTblController *instance() {
        static VssLocalSettingTblController instance;
        return &instance;
    }
public:
    /** 注册{label}http服务 */
    void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) {
        _HttpSrvRetRecieve.setInfo("^/addVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::addVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/delVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::delVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/updateVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::updateVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTblList$", "POST",
                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTblList, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
public:
    /** 注册{label}http服务 */
    void registerHttpServices(HttpSrvRetRecieve &_HttpSrvRetRecieve) {
        _HttpSrvRetRecieve.setInfo("^/addVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::addVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/delVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::delVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/updateVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::updateVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTbl$", "POST",
                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTbl, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
        _HttpSrvRetRecieve.setInfo("^/findVssLocalSettingTblList$", "POST",
                                   std::bind(&VssLocalSettingTblController::findVssLocalSettingTblList, this,
                                             std::placeholders::_1, std::placeholders::_2,
                                             std::placeholders::_3, std::placeholders::_4));
    }
public:
    /** 添加本地国标配置 */
    /** 添加本地国标配置 */
    std::string addVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
        DBG("ip:" << ip << "; port:" << port);
        DBG("content: " << content);
        Json::Reader requestJsonReader;
        Json::Value requestJsonValue;
        Json::Value responseJsonValue;
@@ -65,43 +70,43 @@
        responseJsonValue["success"] = "false";
        if (requestJsonReader.parse(content, requestJsonValue)) {
            VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
            }
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
            }
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
            }
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
            }
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
            }
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
            }
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
            }
            auto keyValuesToAdd = vssLocalSettingTblBuilder.buildVssLocalSettingTblMap();
            if (keyValuesToAdd.size() > 0) {
            auto keyValuesToAdd = vssLocalSettingTblBuilder.buildVssLocalSettingTblMap();
            if (keyValuesToAdd.size() > 0) {
                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->addVssLocalSettingTbl(keyValuesToAdd);
            }
        }
@@ -110,16 +115,18 @@
    /** 删除本地国标配置 */
    std::string delVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
        DBG("ip:" << ip << "; port:" << port);
        DBG("content: " << content);
        Json::Reader requestJsonReader;
        Json::Value requestJsonValue;
        Json::Value responseJsonValue;
        responseJsonValue["message"] = "删除失败!";
        responseJsonValue["success"] = "false";
        if (requestJsonReader.parse(content, requestJsonValue)) {
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                string iDValue = iDJsonValue.asString();
                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->deleteByColumn("ID", iDValue);
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                string iDValue = iDJsonValue.asString();
                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->deleteByColumn("ID", iDValue);
            }
        }
@@ -128,6 +135,8 @@
    /** 更新本地国标配置 */
    std::string updateVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
        DBG("ip:" << ip << "; port:" << port);
        DBG("content: " << content);
        Json::Reader requestJsonReader;
        Json::Value requestJsonValue;
        Json::Value responseJsonValue;
@@ -136,43 +145,44 @@
        if (requestJsonReader.parse(content, requestJsonValue)) {
            VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
            }
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
            }
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
            }
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
            }
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
            }
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
            }
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
            }
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                string iDValue = iDJsonValue.asString();
                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->updateVssLocalSettingTbl(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap(), "ID", iDValue);
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                string iDValue = iDJsonValue.asString();
                responseJsonValue = VssLocalSettingTblSqliteDao::instance()->updateVssLocalSettingTbl(
                    vssLocalSettingTblBuilder.buildVssLocalSettingTblMap(), "ID", iDValue);
            }
        }
        return responseJsonValue.toStyledString();
@@ -180,6 +190,8 @@
    /** 查找单个本地国标配置 */
    std::string findVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
        DBG("ip:" << ip << "; port:" << port);
        DBG("content: " << content);
        Json::Reader requestJsonReader;
        Json::Value requestJsonValue;
        Json::Value responseJsonValue;
@@ -188,49 +200,53 @@
        if (requestJsonReader.parse(content, requestJsonValue)) {
            VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
            }
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
            }
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
            }
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
            }
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
            }
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
            }
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
            }
            responseJsonValue["message"] = "查询成功!";
            responseJsonValue["success"] = "true";
            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
            responseJsonValue["message"] = "查询成功!";
            responseJsonValue["success"] = "true";
            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(
                vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
        }
        return responseJsonValue.toStyledString();
    }
    /** 查找本地国标配置列表 */
    std::string findVssLocalSettingTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
    std::string
    findVssLocalSettingTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
        DBG("ip:" << ip << "; port:" << port);
        DBG("content: " << content);
        Json::Reader requestJsonReader;
        Json::Value requestJsonValue;
        Json::Value responseJsonValue;
@@ -239,52 +255,49 @@
        if (content == "" || requestJsonReader.parse(content, requestJsonValue)) {
            VssLocalSettingTblBuilder vssLocalSettingTblBuilder;
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID];
            if (iDJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString()));
            }
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp];
            if (serverIpJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString());
            }
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort];
            if (serverPortJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString());
            }
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId];
            if (serverIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString());
            }
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId];
            if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString());
            }
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password];
            if (passwordJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString());
            }
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime];
            if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
                vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
            }
            responseJsonValue["message"] = "查询成功!";
            responseJsonValue["success"] = "true";
            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
            responseJsonValue["message"] = "查询成功!";
            responseJsonValue["success"] = "true";
            responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(
                vssLocalSettingTblBuilder.buildVssLocalSettingTblMap());
        }
        return responseJsonValue.toStyledString();
    }
};
#endif //VSSLOCALSETTINGTBL_CONTROLLER_H
QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h
@@ -11,10 +11,11 @@
using namespace std;
static mysqlpp::Connection* conn;
static mysqlpp::Connection *conn;
class BaseDao {
public:
    static mysqlpp::SimpleResult add(std::map<std::string, std::string>& columns, string tableName) {
    static mysqlpp::SimpleResult add(std::map<std::string, std::string> &columns, string tableName) {
        initConnection();
        mysqlpp::SimpleResult simpleResult;
        try {
@@ -28,17 +29,20 @@
        }
        return simpleResult;
    }
    static bool del(string tableName, std::map<std::string, std::string>& whereColumns) {
    static bool del(string tableName, std::map<std::string, std::string> &whereColumns) {
        initConnection();
        string sql = "DELETE FROM " + tableName + " where 1=1 " + getWhereColumnNameValuePair(whereColumns);
        mysqlpp::Query query = conn->query(sql);
        bool ret = query.exec();
        if (!ret) {
            cout << "error " <<query.error() << endl;
            cout << "error " << query.error() << endl;
        }
        return ret;
    }
    static bool update(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) {
    static bool update(std::map<std::string, std::string> &columns, string tableName,
                       std::map<std::string, std::string> &whereColumns) {
        string updateSql = getUpdateSql(columns, tableName, whereColumns);
        initConnection();
        mysqlpp::Query query = conn->query(updateSql);
@@ -58,7 +62,7 @@
                map<string, string> rowData;
                mysqlpp::Row row = *it;
                auto field_list = row.field_list();
                const mysqlpp::FieldNames* fieldNames = field_list.list;
                const mysqlpp::FieldNames *fieldNames = field_list.list;
                for (int i = 0; i < fieldNames->size(); i++) {
                    string columnValue;
                    row[i].to_string(columnValue);
@@ -80,7 +84,7 @@
        if (auto res = query.store()) {
            for (auto it = res.begin(); it != res.end(); ++it) {
                Json::Value row;
                const mysqlpp::FieldNames* fieldNames = it->field_list().list;
                const mysqlpp::FieldNames *fieldNames = it->field_list().list;
                for (int i = 0; i < fieldNames->size(); i++) {
                    string columnValue;
                    (*it)[i].to_string(columnValue);
@@ -103,12 +107,13 @@
        mysqlpp::Query query = conn->query(sql);
        bool ret = query.exec();
        if (!ret) {
            cout << "error " <<query.error() << endl;
            cout << "error " << query.error() << endl;
        }
        return ret;
    }
    static string getInsertSql(std::map<std::string, std::string>& columns, string tableName) {
        string insertSql = "INSERT INTO "+tableName+" ("
    static string getInsertSql(std::map<std::string, std::string> &columns, string tableName) {
        string insertSql = "INSERT INTO " + tableName + " ("
                           + getColumnNames(columns) +
                           " ) values ( "
                           + getColumnValues(columns) +
@@ -116,35 +121,38 @@
        cout << "insertSql " << insertSql << endl;
        return insertSql;
    }
    static string getUpdateSql(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) {
        string updateSql = "update "+tableName+" set "
    static string getUpdateSql(std::map<std::string, std::string> &columns, string tableName,
                               std::map<std::string, std::string> &whereColumns) {
        string updateSql = "update " + tableName + " set "
                           + getColumnNameValuePair(columns) +
                           " where 1=1 "+
                           getWhereColumnNameValuePair(whereColumns)
        ;
                           " where 1=1 " +
                           getWhereColumnNameValuePair(whereColumns);
        cout << "updateSql " << updateSql << endl;
        return updateSql;
    }
    static void doConnect() {
        //            if (conn->connect(
//                    appConfig.getStringProperty("database").c_str(),
//                    appConfig.getStringProperty("db_host").c_str(),
//                    appConfig.getStringProperty("db_user").c_str(),
//                    appConfig.getStringProperty("db_password").c_str(),
//                    appConfig.getIntProperty("db_port")
//            )) {
        if (conn->connect(
                "EGEyesForVSS",
                "127.0.0.1",
                "root",
                "123456",
                3306
            appConfig.getStringProperty("database").c_str(),
            appConfig.getStringProperty("db_host").c_str(),
            appConfig.getStringProperty("db_user").c_str(),
            appConfig.getStringProperty("db_password").c_str(),
            appConfig.getIntProperty("db_port")
        )) {
//        if (conn->connect(
//                "EGEyesForVSS",
//                "192.168.1.148",
//                "root",
//                "123456",
//                3306
//        )) {
            cout << "connect success" << endl;
        } else {
            cout << "connect failed" << endl;
        }
    }
    static void initConnection() {
        static bool inited = false;
        if (!inited) {
@@ -156,7 +164,8 @@
            doConnect();
        }
    }
    static string getColumnNames(std::map<std::string, std::string>& columns) {
    static string getColumnNames(std::map<std::string, std::string> &columns) {
        string columnNames;
        auto size = columns.size();
        int i = 0;
@@ -169,12 +178,13 @@
        }
        return columnNames;
    }
    static string getColumnValues(std::map<std::string, std::string>& columns) {
    static string getColumnValues(std::map<std::string, std::string> &columns) {
        string columnValues;
        auto size = columns.size();
        int i = 0;
        for (auto column : columns) {
            columnValues.append("'"+column.second+"'");
            columnValues.append("'" + column.second + "'");
            if (i != columns.size() - 1) {
                columnValues.append(",");
            }
@@ -182,14 +192,15 @@
        }
        return columnValues;
    }
    static string getColumnNameValuePair(std::map<std::string, std::string>& columns) {
    static string getColumnNameValuePair(std::map<std::string, std::string> &columns) {
        string columnNameValuePair;
        auto size = columns.size();
        int i = 0;
        for (auto column : columns) {
            columnNameValuePair.append(column.first);
            columnNameValuePair.append("=");
            columnNameValuePair.append("'"+column.second+"'");
            columnNameValuePair.append("'" + column.second + "'");
            if (i != size - 1) {
                columnNameValuePair.append(",");
@@ -198,7 +209,8 @@
        }
        return columnNameValuePair;
    }
    static string getWhereColumnNameValuePair(std::map<std::string, std::string>& columns) {
    static string getWhereColumnNameValuePair(std::map<std::string, std::string> &columns) {
        string columnNameValuePair;
        auto size = columns.size();
        int i = 0;
@@ -206,7 +218,7 @@
            columnNameValuePair.append(" and ");
            columnNameValuePair.append(column.first);
            columnNameValuePair.append("=");
            columnNameValuePair.append("'"+column.second+"' ");
            columnNameValuePair.append("'" + column.second + "' ");
            i++;
        }
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
@@ -44,7 +44,6 @@
}
BASICGB28181::FFmpegDecoderJPG::~FFmpegDecoderJPG() {
    while (m_rtpQueue.count_queue()) {
        m_rtpQueue.popNotWait();
    }
@@ -65,10 +64,20 @@
        info->buffLen = datalen;
        info->camIdx = camIdx;
        memcpy(info->buff, data, datalen);
    {
//        FILE *fp11 = NULL;
//        if (!fp11) {
//        fp11 = fopen(camIdx.c_str(), "a+");
//    }
//        fwrite(data, sizeof(char), datalen, fp11);
//        fclose(fp11);
    }
#ifdef TestCode
        DBG(" m_rtpQueue.push before ");
#endif
        m_rtpQueue.push(info);
        m_rtpQueue.
        push(info);
#ifdef TestCode
        DBG(" m_rtpQueue.push after ");
#endif
@@ -193,7 +202,7 @@
        p_this->frame_number++;
        int err6 = avcodec_send_packet(ctx, &pkt);
        av_packet_unref(&pkt);
//        av_packet_unref(&pkt);
        int err7 = avcodec_receive_frame(ctx, frame);
        if ((err7 == AVERROR(EAGAIN)) || (err5 < 0) || (err6 < 0)) {
            ERR(" error << err7:" << err7 << "  err5: " << err5 << " err6: " << err6);
@@ -446,6 +455,7 @@
    m_frameIndex++;
    m_packetsVec.push_back({m_frameIndex, newPacket});
    if (newPacket.flags & AV_PKT_FLAG_KEY) {
        DBG("newPacket.flags & AV_PKT_FLAG_KEY   ");
        m_last_I_FrameId = m_frameIndex;
    }
}
@@ -466,27 +476,27 @@
    */
    m_pOutVideo_stream = avformat_new_stream(m_pOutFmtCtx, NULL);
    {
//        AVCodecContext *c;
//        c = m_pOutVideo_stream->codec;
//        c->bit_rate = 400000;
//        c->codec_id = video_st->codec->codec_id;
//        c->codec_type = video_st->codec->codec_type;
//        c->time_base.num = video_st->time_base.num;
//        c->time_base.den = video_st->time_base.den;
//        fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den);
//        c->width = video_st->codec->width;
//        c->height = video_st->codec->height;
//        c->pix_fmt = video_st->codec->pix_fmt;
//        printf("%d %d %d", c->width, c->height, c->pix_fmt);
//        c->flags = video_st->codec->flags;
//        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
//        c->me_range = video_st->codec->me_range;
//        c->max_qdiff = video_st->codec->max_qdiff;
//
//        c->qmin = video_st->codec->qmin;
//        c->qmax = video_st->codec->qmax;
//
//        c->qcompress = video_st->codec->qcompress;
        AVCodecContext *c;
        c = m_pOutVideo_stream->codec;
        c->bit_rate = 400000;
        c->codec_id = video_st->codec->codec_id;
        c->codec_type = video_st->codec->codec_type;
        c->time_base.num = video_st->time_base.num;
        c->time_base.den = video_st->time_base.den;
        fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den);
        c->width = video_st->codec->width;
        c->height = video_st->codec->height;
        c->pix_fmt = video_st->codec->pix_fmt;
        printf("%d %d %d", c->width, c->height, c->pix_fmt);
        c->flags = video_st->codec->flags;
        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
        c->me_range = video_st->codec->me_range;
        c->max_qdiff = video_st->codec->max_qdiff;
        c->qmin = video_st->codec->qmin;
        c->qmax = video_st->codec->qmax;
        c->qcompress = video_st->codec->qcompress;
    }
    ret = avio_open(&m_pOutFmtCtx->pb, filename, AVIO_FLAG_WRITE);
    if (ret < 0) {
@@ -494,7 +504,7 @@
        return -1;
    }
    avformat_write_header(m_pOutFmtCtx, NULL);
    DBG(" avformat_write_header   " << avformat_write_header(m_pOutFmtCtx, NULL));
    m_bstartWrite = true;
    m_bFirstKeyFrame = true;
QiaoJiaSystem/VideoAnalysFromHC/main.cpp
@@ -84,7 +84,7 @@
    int arg1 = atoi(argv[1]);
    int gindx = abs(arg1) % 2;
    int GB28181_Enable = arg1 < 0 ? gindx : -1;
    int GB28181_Enable = arg1 < 0 ? 1 : -1;
    DBG(gindx);
    appPref.setIntData("GB28181_Enable", GB28181_Enable);
QiaoJiaSystem/VideoToImageMulth/CMakeLists.txt
@@ -96,12 +96,14 @@
)
add_executable(${PROJECT_NAME}
    ./pushStream/PushStreamAppPipeController.cpp
    ../GB28181DecoderModel/FFmpegDecoderJPG.cpp
    ../GB28181DecoderModel/GB28181Server.cpp
    ../GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
    ../../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp
    #    ../../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp
    ../../../BasicPlatForm/basic/util/BASE64/Base64.cpp
    #       ../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp
#        ../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp
    ../VideoServer/QiaoJia/DB/LDBTool.cpp
    ./rpc/RtspAnalysServer.cpp
    RtspCaptureElement.cpp
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp
@@ -165,9 +165,12 @@
            m_imgRedisCRwLock.unlock();
            //VideoCaptureElementWithRtp(std::string &chanPubID, int fps, int streamTransType, int gpuIdx = -1)
            m_controllers_videoCapElem[index] = new BASICGB28181::VideoCaptureElementWithRtp(
                const_cast<string &>(index),
                25, 0, 0, this);
//            m_controllers_videoCapElem[index] = new BASICGB28181::VideoCaptureElementWithRtp(
//                const_cast<string &>(index),
//                25, 0, 0, this);
            m_controllers_videoCapElem[index] = new PushStreamAppPipeController(const_cast<string &>(index),
                                                                                25, 0, 0, this);
            m_controllers_videoCapElem[index]->SetVideoMinMaxSeconds(lst_dev.n_cut_min_duration,
                                                                     lst_dev.n_cut_max_duration);
            m_controllers_videoCapElem[index]->start();
@@ -310,7 +313,7 @@
            auto pCaptureElem = m_controllers_videoCapElem.find(nameSt.m_camId);
            if (pCaptureElem != m_controllers_videoCapElem.end()) {
//#todo ~~~~~~!!!!!!! 这里有bug 需要放开调试
//                pCaptureElem->second->SaveVideo(name);
                pCaptureElem->second->SaveVideo(name);
            } else {
                ERR("Can not Find CamId " << nameSt.m_camId);
            }
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.h
@@ -9,7 +9,8 @@
#include <map>
#include "RtspCaptureElement.h"
#include "RtspImageRedis.h"
#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
//#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
#include "pushStream/PushStreamAppPipeController.h"
//#include <VideoCaptureElementWithRtp.h>
#include <QiaoJia/DB/LDBTool.h>
#include <basic/util/app/AppPreference.hpp>
@@ -63,7 +64,8 @@
    std::map<std::string, RtspCaptureElement *> m_controllers;
    //保存CamID和VideoCaptureElementWithRtp的映射关系
    std::map<std::string, BASICGB28181::VideoCaptureElementWithRtp *> m_controllers_videoCapElem;
//    std::map<std::string, BASICGB28181::VideoCaptureElementWithRtp *> m_controllers_videoCapElem;
    std::map<std::string, PushStreamAppPipeController *> m_controllers_videoCapElem;
    //保存CamID和RtspImageRedisElement的映射关系
    std::map<std::string, RtspImageRedisElement *> m_imgRedisControllers;
QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp
@@ -2,12 +2,13 @@
#include <basic/debug/Debug.h>
#include <opencv2/opencv.hpp>
#include <basic/timer_counter/Clocktimer.h>
#include <basic/pipe_element/ffmpeg/cap_ffmpeg_impl.hpp>
#include <thread>
#include <basic/util/app/AppPreference.hpp>
#include <QString>
#include <QDateTime>
#include "RtspAnalysManager.h"
//#include <basic/pipe_element/ffmpeg/cap_ffmpeg_impl.hpp>
#include "../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp"
RtspCaptureElement::RtspCaptureElement(const std::string &path, const std::string &camId, int fps, int reopenTime,
                                       int gpuIndex, RtspAnalysManager *manager) :
QiaoJiaSystem/VideoToImageMulth/main.cpp
@@ -62,11 +62,17 @@
    if (argc < 4) {
        assert("t_value.size()");
    }
    {
//            std::string rtmpAddr = appConfig.getStringProperty("srsAddr");
//            std::string publish_basepath = rtmpAddr + "" ;
//            appPref.setStringData("publish.basepath", publish_basepath);
        appPref.setIntData("pulish.width", 640);
        appPref.setIntData("pulish.height", 360);
    }
    int arg1 = atoi(argv[1]);
    int gindx = abs(arg1) % 2;
    int GB28181_Enable = arg1 < 0 ? gindx : -1;
    int GB28181_Enable = arg1 < 0 ? 1 : 0;
    DBG(gindx);
    appPref.setIntData("GB28181_Enable", GB28181_Enable);
QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.cpp
New file
@@ -0,0 +1,50 @@
#include "PushStreamAppPipeController.h"
#include <basic/util/app/AppPreference.hpp>
#include <basic/util/app/AppUtil.h>
//#include <sstream>
#include <algorithm>
#include <basic/util/app/AppConfig.h>
PushStreamAppPipeController::PushStreamAppPipeController(std::string &chanPubID, int fps,
                                                         int streamTransType,
                                                         int gpuIdx, RtspAnalysManager *manager) :
    videoCaptureElement(chanPubID, fps, streamTransType, gpuIdx, manager),
    index(chanPubID),
    videoPublishElement(nullptr) {
    string path = appConfig.getStringProperty("srsAddr") + "cam" + chanPubID + ".flv";
    cv::Size size_(appPref.getIntData("pulish.width"), appPref.getIntData("pulish.height"));
    int gupIdx = appPref.getLongData("gpu.index");
    videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx);
    if (appPref.getIntData("pulish.width") < 0 || appPref.getIntData("pulish.height") < 0) {
        ERR("pulish.width:  " << appPref.getIntData("pulish.width") << "  Height: "
                              << appPref.getIntData("pulish.height"));
    }
    videoCaptureElement.registerConnector([&] {
        //if(!videoPublishElement.isBusy()){
        videoPublishElement->setImage(videoCaptureElement.getImage());
        //videoPublishElement.submit();
        //}
    });
    registerElement(videoCaptureElement);
    registerElement(*videoPublishElement);
//    videoCaptureElement.setOutPutInterval(3);
}
std::string PushStreamAppPipeController::getRtmp() {
    std::string ret = videoPublishElement->getPath();
    size_t pos = ret.find(".flv");
    ret = ret.substr(0, pos);
    INFO(ret);
    return ret;
}
void PushStreamAppPipeController::SaveVideo(const std::string &strImageName) {
    videoCaptureElement.SaveVideo(strImageName);
}
void PushStreamAppPipeController::SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds) {
    videoCaptureElement.SetVideoMinMaxSeconds(minSeconds, maxSeconds);
}
QiaoJiaSystem/VideoToImageMulth/pushStream/PushStreamAppPipeController.h
New file
@@ -0,0 +1,29 @@
#ifndef PUSHSTREAMAPPPIPECONTROLLER_H
#define PUSHSTREAMAPPPIPECONTROLLER_H
#include <basic/pipe/PipeController.h>
#include <basic/pipe_element/ffmpeg/FfmpegElement.h>
#include <jsoncpp/json/json.h>
#include "../GB28181DecoderModel/VideoCaptureElementWithRtp.h"
class PushStreamAppPipeController : public PipeController {
public:
    PushStreamAppPipeController(std::string &chanPubID, int fps,
                                int streamTransType,
                                int gpuIdx, RtspAnalysManager *manager);
    std::string getRtmp();
    void SaveVideo(const std::string &strImageName);
    //设置保存视频的最小和最大长度,单位是秒,实际的运行情况有一些差距,需要完善
    void SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds);
private:
    BASICGB28181::VideoCaptureElementWithRtp videoCaptureElement;
    ffmpeg::VideoPublishElement* videoPublishElement;
    std::string index;
};
#endif // PUSHSTREAMAPPPIPECONTROLLER_H