2024-02-01 18:28:27 +08:00
|
|
|
|
#ifndef MAIN_H
|
|
|
|
|
#define MAIN_H
|
|
|
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
|
|
|
|
#include "MvObjectEventDetect.h"
|
|
|
|
|
|
|
|
|
|
#include "HxDisk.h"
|
|
|
|
|
#include "HxTask.h"
|
|
|
|
|
#include "HxJson.h"
|
|
|
|
|
#include "HxThread.h"
|
|
|
|
|
// #include "HxReadMe.h"
|
|
|
|
|
#include "HxBroadcast.h"
|
|
|
|
|
|
|
|
|
|
#if USE_ALGORITHM
|
|
|
|
|
#include "im2d.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#include "libavcodec/avcodec.h"
|
|
|
|
|
#include "libavformat/avformat.h"
|
|
|
|
|
#include "libavutil/pixfmt.h"
|
|
|
|
|
#include "libavutil/imgutils.h"
|
|
|
|
|
#include "libswscale/swscale.h"
|
|
|
|
|
#include "libswresample/swresample.h"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CHANNEL_MAX 6
|
|
|
|
|
#define BROADCAST_PORT 5001
|
|
|
|
|
|
|
|
|
|
/* 写日志 */
|
|
|
|
|
#define WRITE_LOG(type, index, message, data) HxBroadcast::publish_json(4, {{"timestamp", QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")}, \
|
|
|
|
|
{"type", type}, \
|
|
|
|
|
{"index", index}, \
|
|
|
|
|
{"message", message}, \
|
|
|
|
|
{"data", data}})
|
|
|
|
|
/* 写入系统日志 */
|
|
|
|
|
#define WRITE_SYSTEM_LOG(message, data) WRITE_LOG(0, -1, message, data);
|
|
|
|
|
|
|
|
|
|
typedef struct __HxVideoFrame
|
|
|
|
|
{
|
|
|
|
|
QDateTime time;
|
|
|
|
|
|
|
|
|
|
AVPacket* packet;
|
|
|
|
|
|
|
|
|
|
__HxVideoFrame() {}
|
|
|
|
|
|
|
|
|
|
__HxVideoFrame(QDateTime time, AVPacket* packet)
|
|
|
|
|
{
|
|
|
|
|
this->time = time;
|
|
|
|
|
this->packet = av_packet_clone(packet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__HxVideoFrame copy() { return __HxVideoFrame(this->time, this->packet); }
|
|
|
|
|
|
|
|
|
|
void free()
|
|
|
|
|
{
|
|
|
|
|
if (packet)
|
|
|
|
|
{
|
|
|
|
|
av_packet_unref(packet);
|
|
|
|
|
av_packet_free(&packet);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} HxVideoFrame;
|
|
|
|
|
|
|
|
|
|
extern CarInfoInput car_info;
|
|
|
|
|
extern EventWarnParamConfig warm_param_config;
|
|
|
|
|
|
|
|
|
|
#endif // MAIN_H
|