fix: 修改推流地址生成交互逻辑

video_old
cbwu 4 months ago
parent f499648215
commit 5ff339f86a

@ -14,7 +14,7 @@ QMAKE_PROJECT_DEPTH = 0
# QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
#程序版本
VERSION = 1.0.2.1
VERSION = 1.0.2.2
#程序版本
QMAKE_TARGET_COMPANY = "HTSDFP"

@ -50,8 +50,10 @@ void GDDCSet::initParam() {
ui->comboBox_streamSource->addItem("载荷端");
ui->comboBox_streamSource->setCurrentIndex(0);
ui->comboBox_pushURL->addItem(QStringLiteral("-1"));
ui->comboBox_pushURL->addItem(QStringLiteral("-1"));
// 应急厅指挥平台----->push.uavideo.cn
ui->comboBox_pushURL->addItem(QStringLiteral("应急厅指挥平台"));
// 应急厅铁塔平台----->182.92.130.23
ui->comboBox_pushURL->addItem(QStringLiteral("应急厅铁塔平台"));
ui->radioButton_NetCtrlUDP->setChecked(true);
ui->radioButton_NetCtrlTCP->setChecked(false);
@ -223,7 +225,24 @@ void GDDCSet::saveDataToLocalIni() {
// inBuf,
// strSysIniName);
m_pushURL = ui->comboBox_pushURL->currentText();
int uavID = ui->uavIDSpinBox->value();
if (ui->radioButton->isChecked()) {
m_pushURL = ui->comboBox_pushURL->currentText();
} else {
if (ui->comboBox_pushURL->currentIndex() == 0) {
auto iter = mapPushURL_yjzh.find(uavID);
if (iter != mapPushURL_yjzh.end()) {
m_pushURL = iter->second;
}
} else if (ui->comboBox_pushURL->currentIndex() == 1) {
auto iter = mapPushURL_yjtt.find(uavID);
if (iter != mapPushURL_yjtt.end()) {
m_pushURL = iter->second;
}
}
}
qDebug() << "推流地址:" << m_pushURL;
// m_pushURL = ui->comboBox_pushURL->currentText();
ba = m_pushURL.toLocal8Bit();
inBuf = ba.data();
::WritePrivateProfileStringA("光电吊舱-推流", "推流URL", inBuf,
@ -296,14 +315,28 @@ void GDDCSet::on_uavIDSpinBox_valueChanged(int arg1) {
if ("地面端" == streamSource) {
QString pushURL =
generatePushURL(uavID, QString::fromStdString(iter->second));
mapPushURL_yjzh[uavID] = pushURL; // 应急厅指挥平台
qDebug() << pushURL;
QString pushURL2 =
generatePushURL2(uavID, QString::fromStdString(iter->second));
ui->comboBox_pushURL->setItemText(0, pushURL);
ui->comboBox_pushURL->setItemText(1, pushURL2);
mapPushURL_yjtt[uavID] = pushURL2; // 应急厅铁塔平台
qDebug() << pushURL2;
// ui->comboBox_pushURL->setItemText(0, pushURL);
// ui->comboBox_pushURL->setItemText(1, pushURL2);
} else {
QString pullURL =
generatePullURL(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
if (!ui->radioButton->isChecked()) {
if (ui->comboBox_pushURL->currentIndex() == 0) {
QString pullURL =
generatePullURL(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
} else if (ui->comboBox_pushURL->currentIndex() == 1) {
QString pullURL =
generatePullURL2(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
}
}
}
} else {
}
@ -319,9 +352,30 @@ void GDDCSet::on_comboBox_streamSource_currentIndexChanged(int index) {
int uavID = ui->uavIDSpinBox->value();
auto iter = g_mapAppName.find(uavID);
if (iter != g_mapAppName.end()) {
QString pullURL =
generatePullURL(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
// QString pullURL =
// generatePullURL(uavID, QString::fromStdString(iter->second));
// ui->comboBox_playURL1->setItemText(0, pullURL);
if (!ui->radioButton->isChecked()) {
if (ui->comboBox_pushURL->currentIndex() == 0) {
QString pullURL =
generatePullURL(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
} else if (ui->comboBox_pushURL->currentIndex() == 1) {
QString pullURL =
generatePullURL2(uavID, QString::fromStdString(iter->second));
ui->comboBox_playURL1->setItemText(0, pullURL);
}
}
}
}
}
void GDDCSet::on_radioButton_clicked() {
if (ui->radioButton->isChecked()) {
ui->comboBox_pushURL->setEditable(true);
ui->uavIDSpinBox->setEnabled(false);
} else {
ui->comboBox_pushURL->setEditable(false);
ui->uavIDSpinBox->setEnabled(true);
}
}

@ -6,8 +6,8 @@
#include <QByteArray>
#include <QDir>
#include <QWidget>
#include <map>
#include <windows.h>
namespace Ui {
class GDDCSet;
}
@ -22,6 +22,9 @@ public:
private:
Ui::GDDCSet *ui;
std::map<int, QString> mapPushURL_yjzh;
std::map<int, QString> mapPushURL_yjtt;
public:
void initUDPSocket(); // 初始化UDPSocket
void initWindow(); // 初始化窗口
@ -64,6 +67,7 @@ private slots:
// void on_comboBox_streamType_currentIndexChanged(int index);
void on_uavIDSpinBox_valueChanged(int arg1);
void on_comboBox_streamSource_currentIndexChanged(int index);
void on_radioButton_clicked();
};
#endif // GDDCSET_H

@ -247,10 +247,29 @@
<rect>
<x>80</x>
<y>100</y>
<width>421</width>
<width>321</width>
<height>23</height>
</rect>
</property>
<property name="editable">
<bool>false</bool>
</property>
</widget>
<widget class="QRadioButton" name="radioButton">
<property name="geometry">
<rect>
<x>410</x>
<y>100</y>
<width>101</width>
<height>25</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>自定义推流</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">

@ -2,7 +2,7 @@
global::global() {}
QString g_SoftwareVersion = "版本号V1.0.2.1_20241106";
QString g_SoftwareVersion = "版本号V1.0.2.2_20241111";
QColor g_themeColor(51, 51, 51);
QString g_PushBtnStyle = /**正常情况下样式**/
@ -176,9 +176,9 @@ QString calculateMD5(const QString &str) {
* @param expireTime: 1h
* @return
*/
QString generatePushURL(int uavID, QString appName, QString uavName,
int clientID, QString pushDomain, long expireTime,
QString pushKey) {
QString generatePushURL(int uavID, QString appName, QString pushKey,
QString uavName, int clientID, QString pushDomain,
long expireTime) {
QString clientName = "";
if (0 == clientID) {
clientName = "gcs"; // 地面端
@ -215,9 +215,9 @@ std::map<int, std::string> g_mapAppName;
* @param pullKey: Key
* @return
*/
QString generatePullURL(int uavID, QString appName, QString uavName,
int clientID, QString pullDomain, long expireTime,
QString pullKey) {
QString generatePullURL(int uavID, QString appName, QString pullKey,
QString uavName, int clientID, QString pullDomain,
long expireTime) {
QString rtmpUrl = "";
QString clientName = "";
if (0 == clientID) {
@ -275,3 +275,28 @@ QString generatePushURL2(int uavID, QString appName, QString uavName,
rtmpUrl = "rtmp://" + pushDomain + "/" + appName + "/" + streamName;
return rtmpUrl;
}
/**
* @brief
* @param uavID: ID
* @param appName: app
* @param uavName: 981cs
* @param clientID: ID01
* @param pullDomain:
* @return
*/
QString generatePullURL2(int uavID, QString appName, QString uavName,
int clientID, QString pullDomain) {
QString clientName = "";
if (0 == clientID) {
clientName = "gcs"; // 地面端
} else {
clientName = "uav"; // 载荷端
}
QString streamName =
uavName + "_" + QString::number(uavID) + "_" + clientName;
QString pushURL = "";
pushURL = "rtsp://" + pullDomain + "/" + appName + "/" + streamName;
return pushURL;
}

@ -45,10 +45,10 @@ extern QString calculateMD5(const QString &str);
* @return
*/
extern QString generatePushURL(int uavID, QString appName = "nmyj",
QString pushKey = "ZRjGVcPYGhKib0rdgH",
QString uavName = "981cs", int clientID = 0,
QString pushDomain = "push.uavideo.cn",
long expireTime = 6 * 3600,
QString pushKey = "ZRjGVcPYGhKib0rdgH");
long expireTime = 6 * 3600);
/**
* @brief
@ -75,10 +75,23 @@ extern QString generatePushURL2(int uavID, QString appName = "nmyj",
* @return
*/
extern QString generatePullURL(int uavID, QString appName = "nmyj",
QString pullKey = "HDaMVkLnIcr0mGhV8d",
QString uavName = "981cs", int clientID = 0,
QString pullDomain = "play.uavideo.cn",
long expireTime = 6 * 3600,
QString pullKey = "HDaMVkLnIcr0mGhV8d");
long expireTime = 6 * 3600);
/**
* @brief
* @param uavID: ID
* @param appName: app
* @param uavName: 981cs
* @param clientID: ID01
* @param pullDomain:
* @return
*/
extern QString generatePullURL2(int uavID, QString appName = "nmyj",
QString uavName = "981cs", int clientID = 0,
QString pullDomain = "182.92.130.23");
extern std::map<int, std::string> g_mapAppName;

@ -191,6 +191,17 @@ QRadioButton{
font-family:"微软雅黑";
font-size:10pt;
}
QRadioButton::indicator {
width: 12px;
height: 12px;
border-radius: 7px; /* 让其看起来更圆 */
border: 1px solid #5A5A5A; /* 边框颜色 */
}
/* 如果没有合适的图片,可以使用伪元素模拟 */
QRadioButton::indicator:checked::enabled {
background-color: rgb(27,217,40);
image: none; /* 移除图片,使用纯色 */
}
/***************************QFrame***********************/
QFrame#frameGDDCPage
{

Loading…
Cancel
Save