UI: Add VOD track support in advanced output

Adds a VOD track option (specific to Twitch) that allows a user to
specify which audio track to use for their Twitch VODs, which uses a
separate encoder to encode the track. This allows users the ability to
choose what audio goes on their VOD, separately from the live stream.
This commit is contained in:
jp9000 2020-11-01 01:54:27 -08:00
commit 6b81c106d8
7 changed files with 127 additions and 6 deletions

View file

@ -71,6 +71,8 @@ void OBSBasicSettings::InitStreamPage()
SLOT(UpdateServerList()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateKeyLink()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateVodTrackSetting()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)), this,
SLOT(UpdateKeyLink()));
connect(ui->customServer, SIGNAL(editingFinished(const QString &)),
@ -141,6 +143,7 @@ void OBSBasicSettings::LoadStream1Settings()
UpdateKeyLink();
UpdateMoreInfoLink();
UpdateVodTrackSetting();
bool streamActive = obs_frontend_streaming_active();
ui->streamPage->setEnabled(!streamActive);
@ -594,3 +597,56 @@ void OBSBasicSettings::on_useAuth_toggled()
ui->authPwLabel->setVisible(use_auth);
ui->authPwWidget->setVisible(use_auth);
}
void OBSBasicSettings::UpdateVodTrackSetting()
{
bool enableVodTrack = ui->service->currentText() == "Twitch";
bool wasEnabled = !!vodTrackCheckbox;
if (enableVodTrack == wasEnabled)
return;
if (!enableVodTrack) {
delete vodTrackCheckbox;
delete vodTrackContainer;
return;
}
vodTrackCheckbox = new QCheckBox(
QTStr("Basic.Settings.Output.Adv.TwitchVodTrack"));
vodTrackCheckbox->setLayoutDirection(Qt::RightToLeft);
vodTrackContainer = new QWidget();
QHBoxLayout *vodTrackLayout = new QHBoxLayout();
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
vodTrack[i] = new QRadioButton(QString::number(i + 1));
vodTrackLayout->addWidget(vodTrack[i]);
HookWidget(vodTrack[i], SIGNAL(clicked(bool)),
SLOT(OutputsChanged()));
}
HookWidget(vodTrackCheckbox, SIGNAL(clicked(bool)),
SLOT(OutputsChanged()));
vodTrackLayout->addStretch();
vodTrackLayout->setContentsMargins(0, 0, 0, 0);
vodTrackContainer->setLayout(vodTrackLayout);
ui->advOutTopLayout->insertRow(2, vodTrackCheckbox, vodTrackContainer);
bool vodTrackEnabled =
config_get_bool(main->Config(), "AdvOut", "VodTrackEnabled");
vodTrackCheckbox->setChecked(vodTrackEnabled);
vodTrackContainer->setEnabled(vodTrackEnabled);
connect(vodTrackCheckbox, SIGNAL(clicked(bool)), vodTrackContainer,
SLOT(setEnabled(bool)));
int trackIndex =
config_get_int(main->Config(), "AdvOut", "VodTrackIndex");
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
vodTrack[i]->setChecked((i + 1) == trackIndex);
}
}