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:
pkv
2024-02-27 01:29:40 +01:00
committed by Ryan Foster
parent ef19644e5e
commit 5bd22afe41
3 changed files with 36 additions and 22 deletions

View File

@@ -2057,16 +2057,6 @@ static inline QString makeFormatToolTip()
return html;
}
#define RTMP_PROTOCOL "rtmp"
#define SRT_PROTOCOL "srt"
#define RIST_PROTOCOL "rist"
inline bool 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::LoadAdvOutputStreamingSettings()
{
const char *rescaleRes =
@@ -2118,21 +2108,10 @@ void OBSBasicSettings::LoadAdvOutputStreamingSettings()
ui->advOutMultiTrack5->setChecked(audioMixes & (1 << 4));
ui->advOutMultiTrack6->setChecked(audioMixes & (1 << 5));
bool is_multitrack_output = false;
obs_service_t *service_obj = main->GetService();
const char *protocol = nullptr;
protocol = obs_service_get_protocol(service_obj);
if (protocol) {
is_multitrack_output = allowsMultiTrack(protocol);
}
if (is_multitrack_output) {
ui->advStreamTrackWidget->setCurrentWidget(
ui->streamMultiTracks);
} else {
ui->advStreamTrackWidget->setCurrentWidget(
ui->streamSingleTracks);
}
SwapMultiTrack(protocol);
}
OBSPropertiesView *