UI: Add Twitch VOD track to simple output mode
Allows the ability to use the separated Twitch VOD track with simple output mode in addition to advanced output mode.
This commit is contained in:
parent
cac2ff31f4
commit
fc6d53763a
@ -753,6 +753,7 @@ Basic.Settings.Output.Simple.Encoder.Hardware.QSV="Hardware (QSV)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.AMD="Hardware (AMD)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="Hardware (NVENC)"
|
||||
Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 low CPU usage preset, increases file size)"
|
||||
Basic.Settings.Output.Simple.TwitchVodTrack="Twitch VOD Track (Uses Track 2)"
|
||||
Basic.Settings.Output.Warn.EnforceResolutionFPS.Title="Incompatible Resolution/Framerate"
|
||||
Basic.Settings.Output.Warn.EnforceResolutionFPS.Msg="This streaming service does not support your current output resolution and/or framerate. They will be changed to the closest compatible value:\n\n%1\n\nDo you want to continue?"
|
||||
Basic.Settings.Output.Warn.EnforceResolutionFPS.Resolution="Resolution: %1"
|
||||
|
@ -1295,8 +1295,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>601</width>
|
||||
<height>602</height>
|
||||
<width>820</width>
|
||||
<height>677</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@ -1402,7 +1402,7 @@
|
||||
<property name="title">
|
||||
<string>Basic.Settings.Output.Adv.Streaming</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_20">
|
||||
<layout class="QFormLayout" name="simpleStreamingLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
@ -4592,8 +4592,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>818</width>
|
||||
<height>675</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="hotkeyLayout">
|
||||
|
@ -249,10 +249,12 @@ struct SimpleOutput : BasicOutputHandler {
|
||||
OBSEncoder aacStreaming;
|
||||
OBSEncoder h264Streaming;
|
||||
OBSEncoder aacRecording;
|
||||
OBSEncoder aacArchive;
|
||||
OBSEncoder h264Recording;
|
||||
|
||||
string aacRecEncID;
|
||||
string aacStreamEncID;
|
||||
string aacArchiveEncID;
|
||||
|
||||
string videoEncoder;
|
||||
string videoQuality;
|
||||
@ -286,6 +288,8 @@ struct SimpleOutput : BasicOutputHandler {
|
||||
void UpdateRecording();
|
||||
bool ConfigureRecording(bool useReplayBuffer);
|
||||
|
||||
void SetupVodTrack(obs_service_t *service);
|
||||
|
||||
virtual bool SetupStreaming(obs_service_t *service) override;
|
||||
virtual bool StartStreaming(obs_service_t *service) override;
|
||||
virtual bool StartRecording() override;
|
||||
@ -409,6 +413,9 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
|
||||
if (!CreateAACEncoder(aacStreaming, aacStreamEncID, GetAudioBitrate(),
|
||||
"simple_aac", 0))
|
||||
throw "Failed to create aac streaming encoder (simple output)";
|
||||
if (!CreateAACEncoder(aacArchive, aacArchiveEncID, GetAudioBitrate(),
|
||||
"archive_aac", 1))
|
||||
throw "Failed to create aac arhive encoder (simple output)";
|
||||
|
||||
LoadRecordingPreset();
|
||||
|
||||
@ -535,6 +542,7 @@ void SimpleOutput::Update()
|
||||
|
||||
obs_encoder_update(h264Streaming, h264Settings);
|
||||
obs_encoder_update(aacStreaming, aacSettings);
|
||||
obs_encoder_update(aacArchive, aacSettings);
|
||||
|
||||
obs_data_release(h264Settings);
|
||||
obs_data_release(aacSettings);
|
||||
@ -709,6 +717,7 @@ inline void SimpleOutput::SetupOutputs()
|
||||
SimpleOutput::Update();
|
||||
obs_encoder_set_video(h264Streaming, obs_get_video());
|
||||
obs_encoder_set_audio(aacStreaming, obs_get_audio());
|
||||
obs_encoder_set_audio(aacArchive, obs_get_audio());
|
||||
|
||||
if (usingRecordingPreset) {
|
||||
if (ffmpegOutput) {
|
||||
@ -833,6 +842,27 @@ bool SimpleOutput::SetupStreaming(obs_service_t *service)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool ServiceSupportsVodTrack(const char *service);
|
||||
|
||||
void SimpleOutput::SetupVodTrack(obs_service_t *service)
|
||||
{
|
||||
bool advanced =
|
||||
config_get_bool(main->Config(), "SimpleOutput", "UseAdvanced");
|
||||
bool enable = config_get_bool(main->Config(), "SimpleOutput",
|
||||
"VodTrackEnabled");
|
||||
|
||||
obs_data_t *settings = obs_service_get_settings(service);
|
||||
const char *name = obs_data_get_string(settings, "service");
|
||||
|
||||
if (advanced && enable && ServiceSupportsVodTrack(name)) {
|
||||
obs_output_set_audio_encoder(streamOutput, aacArchive, 1);
|
||||
} else {
|
||||
obs_output_set_audio_encoder(streamOutput, nullptr, 1);
|
||||
}
|
||||
|
||||
obs_data_release(settings);
|
||||
}
|
||||
|
||||
bool SimpleOutput::StartStreaming(obs_service_t *service)
|
||||
{
|
||||
bool reconnect = config_get_bool(main->Config(), "Output", "Reconnect");
|
||||
@ -872,6 +902,8 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
|
||||
|
||||
obs_output_set_reconnect_settings(streamOutput, maxRetries, retryDelay);
|
||||
|
||||
SetupVodTrack(service);
|
||||
|
||||
if (obs_output_start(streamOutput)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -628,14 +628,42 @@ void OBSBasicSettings::UpdateVodTrackSetting()
|
||||
if (!enableVodTrack) {
|
||||
delete vodTrackCheckbox;
|
||||
delete vodTrackContainer;
|
||||
delete simpleVodTrack;
|
||||
return;
|
||||
}
|
||||
|
||||
vodTrackCheckbox = new QCheckBox(
|
||||
/* -------------------------------------- */
|
||||
/* simple output mode vod track widgets */
|
||||
|
||||
bool simpleAdv = ui->simpleOutAdvanced->isChecked();
|
||||
bool vodTrackEnabled = config_get_bool(main->Config(), "SimpleOutput",
|
||||
"VodTrackEnabled");
|
||||
|
||||
simpleVodTrack = new QCheckBox(this);
|
||||
simpleVodTrack->setText(
|
||||
QTStr("Basic.Settings.Output.Simple.TwitchVodTrack"));
|
||||
simpleVodTrack->setVisible(simpleAdv);
|
||||
simpleVodTrack->setChecked(vodTrackEnabled);
|
||||
|
||||
int pos;
|
||||
ui->simpleStreamingLayout->getWidgetPosition(ui->simpleOutAdvanced,
|
||||
&pos, nullptr);
|
||||
ui->simpleStreamingLayout->insertRow(pos + 1, nullptr, simpleVodTrack);
|
||||
|
||||
HookWidget(simpleVodTrack, SIGNAL(clicked(bool)),
|
||||
SLOT(OutputsChanged()));
|
||||
connect(ui->simpleOutAdvanced, SIGNAL(toggled(bool)),
|
||||
simpleVodTrack.data(), SLOT(setVisible(bool)));
|
||||
|
||||
/* -------------------------------------- */
|
||||
/* advanced output mode vod track widgets */
|
||||
|
||||
vodTrackCheckbox = new QCheckBox(this);
|
||||
vodTrackCheckbox->setText(
|
||||
QTStr("Basic.Settings.Output.Adv.TwitchVodTrack"));
|
||||
vodTrackCheckbox->setLayoutDirection(Qt::RightToLeft);
|
||||
|
||||
vodTrackContainer = new QWidget();
|
||||
vodTrackContainer = new QWidget(this);
|
||||
QHBoxLayout *vodTrackLayout = new QHBoxLayout();
|
||||
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
|
||||
vodTrack[i] = new QRadioButton(QString::number(i + 1));
|
||||
@ -655,7 +683,7 @@ void OBSBasicSettings::UpdateVodTrackSetting()
|
||||
|
||||
ui->advOutTopLayout->insertRow(2, vodTrackCheckbox, vodTrackContainer);
|
||||
|
||||
bool vodTrackEnabled =
|
||||
vodTrackEnabled =
|
||||
config_get_bool(main->Config(), "AdvOut", "VodTrackEnabled");
|
||||
vodTrackCheckbox->setChecked(vodTrackEnabled);
|
||||
vodTrackContainer->setEnabled(vodTrackEnabled);
|
||||
|
@ -3403,6 +3403,7 @@ void OBSBasicSettings::SaveOutputSettings()
|
||||
SaveEdit(ui->advOutTrack6Name, "AdvOut", "Track6Name");
|
||||
|
||||
if (vodTrackCheckbox) {
|
||||
SaveCheckBox(simpleVodTrack, "SimpleOutput", "VodTrackEnabled");
|
||||
SaveCheckBox(vodTrackCheckbox, "AdvOut", "VodTrackEnabled");
|
||||
SaveTrackIndex(main->Config(), "AdvOut", "VodTrackIndex",
|
||||
vodTrack[0], vodTrack[1], vodTrack[2],
|
||||
|
@ -159,6 +159,8 @@ private:
|
||||
uint32_t outputCX = 0;
|
||||
uint32_t outputCY = 0;
|
||||
|
||||
QPointer<QCheckBox> simpleVodTrack;
|
||||
|
||||
QPointer<QCheckBox> vodTrackCheckbox;
|
||||
QPointer<QWidget> vodTrackContainer;
|
||||
QPointer<QRadioButton> vodTrack[MAX_AUDIO_MIXES];
|
||||
|
Loading…
x
Reference in New Issue
Block a user