1.调通所有与服务器HTTP连接的接口 2.更新图语License从服务器查询和U盘获取后上报,前板可直接使用产测工具写入License 3.优化接收到前板的H264解码后出现视频卡的问题 4.更新从前板取图后旋转 5.增加ffmpeg解码的视频分辨率获取

This commit is contained in:
2024-08-29 11:49:55 +08:00
parent 07ab6b9608
commit e0c1e37191
21 changed files with 456 additions and 1882 deletions

View File

@@ -37,11 +37,11 @@ void FFmpegDecoder::initialize()
avformat_network_init();
}
void FFmpegDecoder::decodeFile(const QString& filePath, QLabel* videoLabel)
void FFmpegDecoder::decodeFile(const QString& filePath, QLabel* videoDisplayLabel)
{
QMutexLocker locker(&mutex);
this->filePath = filePath;
this->videoLabel = videoLabel;
this->videoLabel = videoDisplayLabel;
if (!isRunning()) {
qDebug() << "Starting decoder thread";
start(NormalPriority);
@@ -69,6 +69,13 @@ void FFmpegDecoder::run()
QLabel* currentVideoLabel = videoLabel;
QSize labelSize = currentVideoLabel->size();
mutex.unlock();
if (labelSize.width() <= 0 || labelSize.height() <= 0) {
// 自动调整 QLabel 大小
labelSize = QSize(800, 600); // 例如设置为默认大小
currentVideoLabel->setFixedSize(labelSize);
qDebug() << "Adjusting video label size to: Width =" << labelSize.width() << ", Height =" << labelSize.height();
}
qDebug() << "Video label size: Width =" << labelSize.width() << ", Height =" << labelSize.height();
if (!file.open(QIODevice::ReadOnly)) {
@@ -107,6 +114,8 @@ void FFmpegDecoder::run()
break;
}
qDebug() << "H264 video resolution: Width =" << frame->width << ", Height =" << frame->height;
QImage img = avFrameToQImage(frame);
QImage scaledImage = img.scaled(labelSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
currentVideoLabel->setPixmap(QPixmap::fromImage(scaledImage));
@@ -184,7 +193,7 @@ bool FFmpegDecoder::initializeFFmpeg(const QString& filePath)
return false;
}
frame = av_frame_alloc();
frame = av_frame_alloc();
packet = av_packet_alloc();
return true;

View File

@@ -12,6 +12,9 @@
#include <QMutex>
#include <QFile>
#include <QWaitCondition>
#include <cstdint>
#include <vector>
#include "RingBuffer.h"
extern "C" {