添加日志及注释说明

This commit is contained in:
hehaoyang 2024-01-22 18:25:42 +08:00
parent 90ca02f79e
commit 1661bf7ddf
4 changed files with 23 additions and 24 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ HxServer/HxServer/bin
HxServer/HxServer/obj HxServer/HxServer/obj
HxVideoCaptor/debug HxVideoCaptor/debug
HxVideoCaptor/release HxVideoCaptor/release
*.pro.user.*

View File

@ -9,9 +9,9 @@ int drive_threshold;
/* 录像保留时间 */ /* 录像保留时间 */
int recording_reserver_time; int recording_reserver_time;
/* 磁盘空间若不足时自动覆盖 */ /* 磁盘空间若不足时自动覆盖 */
bool is_cleanup_enabled; bool is_cleanup_enabled = false;
/* 保留期限若超过时强制删除 */ /* 保留期限若超过时强制删除 */
bool is_cleanup_forced_for_reserve_time; bool is_cleanup_forced_for_reserve_time = false;
/* 存储硬盘 */ /* 存储硬盘 */
QStringList disks; QStringList disks;
@ -77,7 +77,6 @@ void HxRecordCleanup::process(void)
} }
} }
/* 保留期限若超过时强制删除 */
if (is_cleanup_enabled) if (is_cleanup_enabled)
{ {
int needCleanNum = 0; int needCleanNum = 0;

View File

@ -27,9 +27,14 @@ int main(int argc, char* argv[])
{ {
/* 判断是否为第一次启动, 没有获取到过设置信息, 需要定时查询 */ /* 判断是否为第一次启动, 没有获取到过设置信息, 需要定时查询 */
if (is_startup) if (is_startup)
{
/* 向服务程序发送 设置请求 */
HxBroadcast::publish_json(1); HxBroadcast::publish_json(1);
/* 发送心跳数据 */ HxTrace::debug_write_line("application", "无法获取到设置信息请检查server程序状态");
}
/* 向服务程序发送 心跳数据 */
HxBroadcast::publish_json(0, { {"name", "HxNvr"}, {"version", "1.00"} }); HxBroadcast::publish_json(0, { {"name", "HxNvr"}, {"version", "1.00"} });
}, 5000, QUuid::createUuid()); }, 5000, QUuid::createUuid());

View File

@ -24,30 +24,24 @@ extern "C"
#define CHANNEL_MAX 16 #define CHANNEL_MAX 16
#define BROADCAST_PORT 5001 #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")}, \ #define WRITE_LOG(type, index, message, data) HxBroadcast::publish_json(4, {{"timestamp", QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")}, \
{"type", type}, \ {"type", type}, \
{"index", index}, \ {"index", index}, \
{"message", message}, \ {"message", message}, \
{"data", data}}) {"data", data}})
/* 写入系统日志 */
#define WRITE_SYSTEM_LOG(message, data) WRITE_LOG(0, -1, message, data); #define WRITE_SYSTEM_LOG(message, data) WRITE_LOG(0, -1, message, data);
/* 写入视频日志 */
#define WRITE_VIDEO_LOG(channel, message, data) WRITE_LOG(2, channel, message, data); #define WRITE_VIDEO_LOG(channel, message, data) WRITE_LOG(2, channel, message, data);
/* 更新录像日志 */
#define REPLACE_RECORD_LOG(record) HxBroadcast::publish_json(6, {{"channel", record.channel}, \ #define REPLACE_RECORD_LOG(record) HxBroadcast::publish_json(6, {{"channel", record.channel}, \
{"start_time", record.start_time.toString("yyyy-MM-dd HH:mm:ss")}, \ {"start_time", record.start_time.toString("yyyy-MM-dd HH:mm:ss")}, \
{"end_time", record.end_time.toString("yyyy-MM-dd HH:mm:ss")}, \ {"end_time", record.end_time.toString("yyyy-MM-dd HH:mm:ss")}, \
{"duration", record.duration}, \ {"duration", record.duration}, \
{"name", record.name}, \ {"name", record.name}, \
{"path", record.path}}) {"path", record.path}})
typedef enum { Null, Recording, Recorded, } RecordStatus;
typedef enum
{
Null, /* 无状态 */
Recording, /* 录像中 */
Recorded, /* 录像完成 */
} RecordStatus;
typedef struct __HxVideoRecord typedef struct __HxVideoRecord
{ {
@ -108,11 +102,11 @@ typedef struct __HxVideoFrame
{ {
QDateTime time; QDateTime time;
AVPacket *packet; AVPacket* packet;
__HxVideoFrame() {} __HxVideoFrame() {}
__HxVideoFrame(QDateTime time, AVPacket *packet) __HxVideoFrame(QDateTime time, AVPacket* packet)
{ {
this->time = time; this->time = time;
this->packet = av_packet_clone(packet); this->packet = av_packet_clone(packet);