代码格式化

This commit is contained in:
hehaoyang 2023-10-21 23:39:10 +08:00
parent f0f073da51
commit 5bbc23649b
5 changed files with 90 additions and 85 deletions

View File

@ -36,7 +36,7 @@ public:
static DataBase database(void);
static CarInfoInput *get_car_info(void);
static CarInfoInput* get_car_info(void);
static QString get_video_frame_data(int type, int channel, int id);
@ -83,10 +83,10 @@ private:
QDateTime vehicle_status_update_time;
/* 边缘云 Socket (客户端) */
HxSocketUtils *platform;
HxSocketUtils* platform;
/* DebugTool Socket (服务端) */
HxSocketUtils *debug_tool;
HxSocketUtils* debug_tool;
/* 车辆状态信息 */
CarInfoInput car_info;

View File

@ -90,6 +90,9 @@ public slots:
}
}
/**
* @brief
*/
void reconnection()
{
/* 取消已有的连接 */
@ -127,12 +130,15 @@ private:
QString address;
bool is_reconnect = false;
QTcpServer server;
QTcpSocket *socket = nullptr;
QTcpSocket* socket = nullptr;
};
class HxProcessUtils
{
public:
/**
*
*/
static int execute(QString command)
{
auto array = command.split(" ");

View File

@ -1,7 +1,7 @@
#include "HxVideoDevice.h"
/* bsd算法结果处理函数 */
void algorithm_alarm_callback(int nDataChannel, ObjectTrackEventResult *pObjectTrackEventResult, void *pPrivData)
void algorithm_alarm_callback(int nDataChannel, ObjectTrackEventResult* pObjectTrackEventResult, void* pPrivData)
{
Q_UNUSED(nDataChannel);
Q_UNUSED(pPrivData);
@ -160,9 +160,8 @@ QString VideoDevice::build_video(int id)
QString url = QString("ftp://%3/%4/%5/alarm/").arg(DataBase::ftp_address, QDateTime::currentDateTime().toString("yyyyMMdd"), DataBase::device_id);
QString filename = QString("%1.mp4").arg(QDateTime::currentDateTime().toString("yyyyMMddHHmmsszzz"));
QtConcurrent::run([=]()
{
if(video_frames_string.contains(id))
QtConcurrent::run([=]() {
if (video_frames_string.contains(id))
{
frame_mutex.lock();
auto first_key = video_frames_string.firstKey();
@ -172,9 +171,9 @@ QString VideoDevice::build_video(int id)
start_id = start_id < first_key ? first_key : start_id;
qDebug() << "build video; start id = "<<start_id << " end id = " << end_id;
qDebug() << "build video; start id = " << start_id << " end id = " << end_id;
while(true)
while (true)
{
frame_mutex.lock();
auto last_key = video_frames_string.lastKey();
@ -183,7 +182,7 @@ QString VideoDevice::build_video(int id)
// qDebug() << " end id = " << end_id << " last id = "<< last_key;
/* 判断最新的视频帧是否超过设定的时间 */
if(last_key >= end_id)
if (last_key >= end_id)
{
frame_mutex.lock();
auto _video_frames_string = video_frames_string;
@ -192,7 +191,7 @@ QString VideoDevice::build_video(int id)
VideoWriter writer(filename.toUtf8().data(), CV_FOURCC('m', 'p', '4', 'v'), frame_fps, Size(video_capture.get(CV_CAP_PROP_FRAME_WIDTH), video_capture.get(CV_CAP_PROP_FRAME_HEIGHT)), true);
for(int i = start_id; i <= end_id; i++)
for (int i = start_id; i <= end_id; i++)
{
auto __frame = imdecode(_video_frames_string[i], CV_LOAD_IMAGE_COLOR);
@ -200,7 +199,7 @@ QString VideoDevice::build_video(int id)
msleep(frame_fps);
qDebug() << " write "<< filename <<". frame id = " << i;
qDebug() << " write " << filename << ". frame id = " << i;
}
writer.release();
@ -226,7 +225,7 @@ QString VideoDevice::build_video(int id)
void VideoDevice::test(void)
{
ObjectTrackEventResult pObjectTrackEventResult = {0};
ObjectTrackEventResult pObjectTrackEventResult = { 0 };
pObjectTrackEventResult.nFrameId = video_frames_string.lastKey();
pObjectTrackEventResult.nEventType = EVENT_PCW;
pObjectTrackEventResult.nObjectNumber = 1;
@ -257,7 +256,7 @@ QString VideoDevice::snap(Mat frame)
QString VideoDevice::snap(vector<uint8_t> buffer)
{
QByteArray byteArray = QByteArray::fromRawData((const char *)buffer.data(), buffer.size());
QByteArray byteArray = QByteArray::fromRawData((const char*)buffer.data(), buffer.size());
return QString(byteArray.toBase64());
}
@ -338,7 +337,7 @@ void VideoDevice::run()
}
}
int VideoDevice::MvGetFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo)
int VideoDevice::MvGetFrameBlkInfo(VideoFrameDataInfo* pImageDataInfo)
{
Q_UNUSED(pImageDataInfo);
@ -346,14 +345,14 @@ int VideoDevice::MvGetFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo)
if (pImageDataInfo == NULL)
return -1;
pImageDataInfo->pu8VirAddr = (unsigned char *)calloc(pImageDataInfo->u32Width * pImageDataInfo->u32Height * 3, sizeof(unsigned char));
pImageDataInfo->pu8VirAddr = (unsigned char*)calloc(pImageDataInfo->u32Width * pImageDataInfo->u32Height * 3, sizeof(unsigned char));
if (pImageDataInfo->pu8VirAddr == NULL)
return -1;
#endif
return 0;
}
int VideoDevice::MvReleaseFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo)
int VideoDevice::MvReleaseFrameBlkInfo(VideoFrameDataInfo* pImageDataInfo)
{
Q_UNUSED(pImageDataInfo);
@ -370,7 +369,7 @@ int VideoDevice::MvReleaseFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo)
return 0;
}
int VideoDevice::MvConvertImage(VideoFrameDataInfo *pSrcImageDataInfo, VideoFrameDataInfo *pDstImageDataInfo)
int VideoDevice::MvConvertImage(VideoFrameDataInfo* pSrcImageDataInfo, VideoFrameDataInfo* pDstImageDataInfo)
{
Q_UNUSED(pSrcImageDataInfo);
Q_UNUSED(pDstImageDataInfo);

View File

@ -45,9 +45,9 @@ protected:
void run() override;
private:
int MvGetFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo);
int MvReleaseFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo);
int MvConvertImage(VideoFrameDataInfo *pSrcImageDataInfo, VideoFrameDataInfo *pDstImageDataInfo);
int MvGetFrameBlkInfo(VideoFrameDataInfo* pImageDataInfo);
int MvReleaseFrameBlkInfo(VideoFrameDataInfo* pImageDataInfo);
int MvConvertImage(VideoFrameDataInfo* pSrcImageDataInfo, VideoFrameDataInfo* pDstImageDataInfo);
private:
int type;