1.更新MDNS广播的服务类型命名规范,防止出现多设备打开找不到MDNS的广播的问题 2.更新区分前后板的TAG

This commit is contained in:
2024-09-02 10:22:41 +08:00
parent e0c1e37191
commit 09c5843358
22 changed files with 501 additions and 304 deletions

View File

@@ -27,11 +27,14 @@ DataHandler::DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLab
ffmpegDecoder->initialize(); // 初始化解码器
clearAllRecvData();
initializeMsgIdToCmdMap();
qDebug() << "DataHandler created";
}
DataHandler::~DataHandler()
{
qDebug() << "---1--- DataHandler destroyed";
if (ffmpegDecoder) {
ffmpegDecoder->stopFFmpegDecoder();
ffmpegDecoder->requestInterruption();
ffmpegDecoder->wait(); // 等待解码器线程完成
delete ffmpegDecoder;
@@ -39,6 +42,14 @@ DataHandler::~DataHandler()
}
delete buffer;
buffer = nullptr;
qDebug() << "---2--- DataHandler destroyed";
}
void DataHandler::handleOpenFocusWindow(int itemIndex)
{
if (ffmpegDecoder) {
ffmpegDecoder->processVideo(itemIndex); // 调用 FFmpegDecoder 的处理函数
}
}
QByteArray DataHandler::hexStringToByteArray(const QString& hexString)
@@ -50,16 +61,17 @@ QByteArray DataHandler::hexStringToByteArray(const QString& hexString)
return byteArray;
}
const QString filePath_1 = "add1.h264";
const QString filePath_1 = "/add1.h264";
// 显示视频的函数
void DataHandler::showVideo(const QString& client, const QByteArray& valData)
{
static QFile file(filePath_1);
QString h264filePath = QDir::currentPath() + filePath_1;
static QFile file(h264filePath);
if (!file.isOpen()) {
if (QFile::exists(filePath_1)) {
QFile::remove(filePath_1);
if (QFile::exists(h264filePath)) {
QFile::remove(h264filePath);
}
if (!file.open(QIODevice::Append | QIODevice::WriteOnly)) {
qWarning() << "无法打开H264文件:" << file.errorString();
@@ -74,7 +86,7 @@ void DataHandler::showVideo(const QString& client, const QByteArray& valData)
if (!start_run) {
start_run = 1;
ffmpegDecoder->decodeFile(filePath_1, videoLabel);
ffmpegDecoder->decodeFile(h264filePath, videoLabel);
}
//ffmpegDecoder->decodeFile(filePath_1, videoLabel);
}

View File

@@ -46,7 +46,7 @@ public slots:
void handleData(const QString& client, const QByteArray& data, int msg_id, int currentRecvItemIndex,
int currentRecvFuncItemIndex, const QString& itemData, const QString& funcItemData,
const QJsonArray& jsonArray, int itemJsonIndex);
void handleOpenFocusWindow(int itemIndex);
signals:
void statusUpdated(const QString& clientAddress, int currentItemIndex, int currentFuncItemIndex,
bool success, const QString& currentItemLabel, const QString& currentFuncItemLabel,