UI: Hide network features if a non-RTMP service is set

Reimplementation of bc80d0c and f2e6122, because they have to be
reverted by 0b9a8aa.
master
tytan652 2022-07-19 07:44:12 +02:00 committed by Jim
parent 57c9844f15
commit fc7af80f84
5 changed files with 57 additions and 7 deletions

View File

@ -1090,6 +1090,7 @@ Basic.Settings.Advanced.StreamDelay.Duration="Duration"
Basic.Settings.Advanced.StreamDelay.Preserve="Preserve cutoff point (increase delay) when reconnecting" Basic.Settings.Advanced.StreamDelay.Preserve="Preserve cutoff point (increase delay) when reconnecting"
Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimated Memory Usage: %1 MB" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimated Memory Usage: %1 MB"
Basic.Settings.Advanced.Network="Network" Basic.Settings.Advanced.Network="Network"
Basic.Settings.Advanced.Network.Disabled="The currently selected streaming protocol does not support changing network settings."
Basic.Settings.Advanced.Network.BindToIP="Bind to IP" Basic.Settings.Advanced.Network.BindToIP="Bind to IP"
Basic.Settings.Advanced.Network.EnableNewSocketLoop="Enable network optimizations" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Enable network optimizations"
Basic.Settings.Advanced.Network.EnableLowLatencyMode="Enable TCP pacing" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Enable TCP pacing"

View File

@ -5572,8 +5572,15 @@
<property name="topMargin"> <property name="topMargin">
<number>2</number> <number>2</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="1">
<widget class="QLabel" name="label_27"> <widget class="QLabel" name="advNetworkDisabled">
<property name="text">
<string>Basic.Settings.Advanced.Network.Disabled</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="bindToIPLabel">
<property name="text"> <property name="text">
<string>Basic.Settings.Advanced.Network.BindToIP</string> <string>Basic.Settings.Advanced.Network.BindToIP</string>
</property> </property>
@ -5582,17 +5589,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="bindToIP"/> <widget class="QComboBox" name="bindToIP"/>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="enableNewSocketLoop"> <widget class="QCheckBox" name="enableNewSocketLoop">
<property name="text"> <property name="text">
<string>Basic.Settings.Advanced.Network.EnableNewSocketLoop</string> <string>Basic.Settings.Advanced.Network.EnableNewSocketLoop</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QCheckBox" name="enableLowLatencyMode"> <widget class="QCheckBox" name="enableLowLatencyMode">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -5602,7 +5609,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<spacer name="horizontalSpacer_7"> <spacer name="horizontalSpacer_7">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -5615,7 +5622,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="dynBitrate"> <widget class="QCheckBox" name="dynBitrate">
<property name="toolTip"> <property name="toolTip">
<string>Basic.Settings.Output.DynamicBitrate.TT</string> <string>Basic.Settings.Output.DynamicBitrate.TT</string>

View File

@ -96,6 +96,11 @@ void OBSBasicSettings::InitStreamPage()
SLOT(UpdateResFPSLimits())); SLOT(UpdateResFPSLimits()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this, connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateMoreInfoLink())); SLOT(UpdateMoreInfoLink()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateAdvNetworkGroup()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)), this,
SLOT(UpdateAdvNetworkGroup()));
} }
void OBSBasicSettings::LoadStream1Settings() void OBSBasicSettings::LoadStream1Settings()
@ -1155,3 +1160,20 @@ void OBSBasicSettings::UpdateResFPSLimits()
lastIgnoreRecommended = (int)ignoreRecommended; lastIgnoreRecommended = (int)ignoreRecommended;
lastServiceIdx = idx; lastServiceIdx = idx;
} }
bool OBSBasicSettings::IsServiceOutputHasNetworkFeatures()
{
if (IsCustomService())
return ui->customServer->text().startsWith("rtmp");
OBSServiceAutoRelease service = SpawnTempService();
const char *output = obs_service_get_output_type(service);
if (!output)
return true;
if (strcmp(output, "rtmp_output") == 0)
return true;
return false;
}

View File

@ -939,6 +939,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
SLOT(UseStreamKeyAdvClicked())); SLOT(UseStreamKeyAdvClicked()));
UpdateAudioWarnings(); UpdateAudioWarnings();
UpdateAdvNetworkGroup();
} }
OBSBasicSettings::~OBSBasicSettings() OBSBasicSettings::~OBSBasicSettings()
@ -5472,3 +5473,18 @@ void OBSBasicSettings::RecreateOutputResolutionWidget()
ui->outputResolution->lineEdit()->setValidator( ui->outputResolution->lineEdit()->setValidator(
ui->baseResolution->lineEdit()->validator()); ui->baseResolution->lineEdit()->validator());
} }
void OBSBasicSettings::UpdateAdvNetworkGroup()
{
bool enabled = IsServiceOutputHasNetworkFeatures();
ui->advNetworkDisabled->setVisible(!enabled);
ui->bindToIPLabel->setVisible(enabled);
ui->bindToIP->setVisible(enabled);
ui->dynBitrate->setVisible(enabled);
#ifdef _WIN32
ui->enableNewSocketLoop->setVisible(enabled);
ui->enableLowLatencyMode->setVisible(enabled);
#endif
}

View File

@ -346,6 +346,8 @@ private:
OBSService GetStream1Service(); OBSService GetStream1Service();
bool IsServiceOutputHasNetworkFeatures();
private slots: private slots:
void on_theme_activated(int idx); void on_theme_activated(int idx);
@ -395,6 +397,8 @@ private slots:
void UpdateStreamDelayEstimate(); void UpdateStreamDelayEstimate();
void UpdateAdvNetworkGroup();
void UpdateAutomaticReplayBufferCheckboxes(); void UpdateAutomaticReplayBufferCheckboxes();
void AdvOutSplitFileChanged(); void AdvOutSplitFileChanged();