mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-22 13:18:34 -05:00
UI: Correctly toggle audio multi-track buttons
This toggles audio multi track display in Output settings when: 1. When there is a signal that a stream service is changed to a non custom one. Indeed multi-track audio is only available with Custom service and only with SRT or RIST protocols. 2. When a Custom service is picked, and SRT or RIST are detected in the server URL. 3. When Stream settings are saved when one hits Apply. This is in addition to the toggling done when loading Stream Settings. Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -180,6 +180,28 @@ void OBSBasicSettings::LoadStream1Settings()
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
#define SRT_PROTOCOL "srt"
|
||||
#define RIST_PROTOCOL "rist"
|
||||
|
||||
bool OBSBasicSettings::AllowsMultiTrack(const char *protocol)
|
||||
{
|
||||
return astrcmpi_n(protocol, SRT_PROTOCOL, strlen(SRT_PROTOCOL)) == 0 ||
|
||||
astrcmpi_n(protocol, RIST_PROTOCOL, strlen(RIST_PROTOCOL)) == 0;
|
||||
}
|
||||
|
||||
void OBSBasicSettings::SwapMultiTrack(const char *protocol)
|
||||
{
|
||||
if (protocol) {
|
||||
if (AllowsMultiTrack(protocol)) {
|
||||
ui->advStreamTrackWidget->setCurrentWidget(
|
||||
ui->streamMultiTracks);
|
||||
} else {
|
||||
ui->advStreamTrackWidget->setCurrentWidget(
|
||||
ui->streamSingleTracks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasicSettings::SaveStream1Settings()
|
||||
{
|
||||
bool customServer = IsCustomService();
|
||||
@@ -264,6 +286,7 @@ void OBSBasicSettings::SaveStream1Settings()
|
||||
}
|
||||
|
||||
SaveCheckBox(ui->ignoreRecommended, "Stream1", "IgnoreRecommended");
|
||||
SwapMultiTrack(QT_TO_UTF8(protocol));
|
||||
}
|
||||
|
||||
void OBSBasicSettings::UpdateMoreInfoLink()
|
||||
@@ -509,6 +532,13 @@ void OBSBasicSettings::on_service_currentIndexChanged(int idx)
|
||||
if (idx == 0)
|
||||
lastCustomServer = ui->customServer->text();
|
||||
}
|
||||
|
||||
if (!IsCustomService()) {
|
||||
ui->advStreamTrackWidget->setCurrentWidget(
|
||||
ui->streamSingleTracks);
|
||||
} else {
|
||||
SwapMultiTrack(QT_TO_UTF8(protocol));
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasicSettings::on_customServer_textChanged(const QString &)
|
||||
@@ -520,6 +550,8 @@ void OBSBasicSettings::on_customServer_textChanged(const QString &)
|
||||
|
||||
if (ServiceSupportsCodecCheck())
|
||||
lastCustomServer = ui->customServer->text();
|
||||
|
||||
SwapMultiTrack(QT_TO_UTF8(protocol));
|
||||
}
|
||||
|
||||
void OBSBasicSettings::ServiceChanged(bool resetFields)
|
||||
|
||||
Reference in New Issue
Block a user