diff --git a/.gitignore b/.gitignore index 27bfd52..2288379 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ HxServer/.vs HxServer/HxServer/bin HxServer/HxServer/obj HxVideoCaptor/debug -HxVideoCaptor/release \ No newline at end of file +HxVideoCaptor/release +*.pro.user.* \ No newline at end of file diff --git a/HxVideoCaptor/HxRecordCleanup.cpp b/HxVideoCaptor/HxRecordCleanup.cpp index ce12217..8026568 100644 --- a/HxVideoCaptor/HxRecordCleanup.cpp +++ b/HxVideoCaptor/HxRecordCleanup.cpp @@ -9,9 +9,9 @@ int drive_threshold; /* 录像保留时间 */ 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; @@ -77,7 +77,6 @@ void HxRecordCleanup::process(void) } } - /* 保留期限若超过时强制删除 */ if (is_cleanup_enabled) { int needCleanNum = 0; diff --git a/HxVideoCaptor/main.cpp b/HxVideoCaptor/main.cpp index d898d95..17b5a14 100644 --- a/HxVideoCaptor/main.cpp +++ b/HxVideoCaptor/main.cpp @@ -27,9 +27,14 @@ int main(int argc, char* argv[]) { /* 判断是否为第一次启动, 没有获取到过设置信息, 需要定时查询 */ if (is_startup) + { + /* 向服务程序发送 设置请求 */ HxBroadcast::publish_json(1); - /* 发送心跳数据 */ + HxTrace::debug_write_line("application", "无法获取到设置信息,请检查server程序状态"); + } + + /* 向服务程序发送 心跳数据 */ HxBroadcast::publish_json(0, { {"name", "HxNvr"}, {"version", "1.00"} }); }, 5000, QUuid::createUuid()); diff --git a/HxVideoCaptor/main.h b/HxVideoCaptor/main.h index 93a3365..641191e 100644 --- a/HxVideoCaptor/main.h +++ b/HxVideoCaptor/main.h @@ -24,30 +24,24 @@ extern "C" #define CHANNEL_MAX 16 #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); - +/* 写入视频日志 */ #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}, \ {"start_time", record.start_time.toString("yyyy-MM-dd HH:mm:ss")}, \ {"end_time", record.end_time.toString("yyyy-MM-dd HH:mm:ss")}, \ {"duration", record.duration}, \ {"name", record.name}, \ {"path", record.path}}) - -typedef enum -{ - Null, /* 无状态 */ - Recording, /* 录像中 */ - Recorded, /* 录像完成 */ -} RecordStatus; +typedef enum { Null, Recording, Recorded, } RecordStatus; typedef struct __HxVideoRecord { @@ -76,16 +70,16 @@ typedef struct __HxVideoRecord this->end_time = QDateTime(); this->duration = 0; this->name = QString("[%1][%2][%3][%4][Scheduled].avi") - .arg(code) - .arg(channel + 1, 2, 10, QChar('0')) - .arg(startTime.toString("yyyyMMdd"), - startTime.toString("HHmmsszzz")); + .arg(code) + .arg(channel + 1, 2, 10, QChar('0')) + .arg(startTime.toString("yyyyMMdd"), + startTime.toString("HHmmsszzz")); this->path = QString("%1HVNVR_RECORD/%2/%3/") #ifdef Q_OS_WIN32 - .arg(rootPath) + .arg(rootPath) #else - .arg(rootPath + "/") + .arg(rootPath + "/") #endif .arg(this->start_time.toString("yyyyMMdd")) .arg(this->channel + 1, 2, 10, QChar('0')); @@ -108,11 +102,11 @@ typedef struct __HxVideoFrame { QDateTime time; - AVPacket *packet; + AVPacket* packet; __HxVideoFrame() {} - __HxVideoFrame(QDateTime time, AVPacket *packet) + __HxVideoFrame(QDateTime time, AVPacket* packet) { this->time = time; this->packet = av_packet_clone(packet);