mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
UI: Add custom server support for Twitch
This commit is contained in:
parent
432a2a8e9c
commit
976b200254
|
@ -957,6 +957,8 @@ Basic.Settings.Stream.Recommended.MaxVideoBitrate="Maximum Video Bitrate: %1 kbp
|
||||||
Basic.Settings.Stream.Recommended.MaxAudioBitrate="Maximum Audio Bitrate: %1 kbps"
|
Basic.Settings.Stream.Recommended.MaxAudioBitrate="Maximum Audio Bitrate: %1 kbps"
|
||||||
Basic.Settings.Stream.Recommended.MaxResolution="Maximum Resolution: %1"
|
Basic.Settings.Stream.Recommended.MaxResolution="Maximum Resolution: %1"
|
||||||
Basic.Settings.Stream.Recommended.MaxFPS="Maximum FPS: %1"
|
Basic.Settings.Stream.Recommended.MaxFPS="Maximum FPS: %1"
|
||||||
|
Basic.Settings.Stream.SpecifyCustomServer="Specify Custom Server..."
|
||||||
|
Basic.Settings.Stream.ServiceCustomServer="Custom Server"
|
||||||
|
|
||||||
# basic mode 'output' settings
|
# basic mode 'output' settings
|
||||||
Basic.Settings.Output="Output"
|
Basic.Settings.Output="Output"
|
||||||
|
|
|
@ -1271,6 +1271,19 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="serviceCustomServerLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Basic.Settings.Stream.ServiceCustomServer</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>serviceCustomServer</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="serviceCustomServer"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="streamKeyLabel">
|
<widget class="QLabel" name="streamKeyLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.AutoConfig.StreamPage.StreamKey</string>
|
<string>Basic.AutoConfig.StreamPage.StreamKey</string>
|
||||||
|
@ -1283,7 +1296,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QFrame" name="streamKeyWidget">
|
<widget class="QFrame" name="streamKeyWidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -1334,7 +1347,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<spacer name="horizontalSpacer_18">
|
<spacer name="horizontalSpacer_18">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -1347,7 +1360,7 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="5" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
|
@ -1390,21 +1403,21 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QCheckBox" name="bandwidthTestEnable">
|
<widget class="QCheckBox" name="bandwidthTestEnable">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.BandwidthTestMode</string>
|
<string>Basic.Settings.Stream.BandwidthTestMode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QCheckBox" name="useAuth">
|
<widget class="QCheckBox" name="useAuth">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.Custom.UseAuthentication</string>
|
<string>Basic.Settings.Stream.Custom.UseAuthentication</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="authUsernameLabel">
|
<widget class="QLabel" name="authUsernameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.Custom.Username</string>
|
<string>Basic.Settings.Stream.Custom.Username</string>
|
||||||
|
@ -1414,10 +1427,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QLineEdit" name="authUsername"/>
|
<widget class="QLineEdit" name="authUsername"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="authPwLabel">
|
<widget class="QLabel" name="authPwLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.Custom.Password</string>
|
<string>Basic.Settings.Stream.Custom.Password</string>
|
||||||
|
@ -1427,7 +1440,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QFrame" name="authPwWidget">
|
<widget class="QFrame" name="authPwWidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_25">
|
<layout class="QHBoxLayout" name="horizontalLayout_25">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -1459,10 +1472,10 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QComboBox" name="twitchAddonDropdown"/>
|
<widget class="QComboBox" name="twitchAddonDropdown"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="twitchAddonLabel">
|
<widget class="QLabel" name="twitchAddonLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.TTVAddon</string>
|
<string>Basic.Settings.Stream.TTVAddon</string>
|
||||||
|
@ -1472,14 +1485,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="12" column="1">
|
||||||
<widget class="QCheckBox" name="ignoreRecommended">
|
<widget class="QCheckBox" name="ignoreRecommended">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.Settings.Stream.IgnoreRecommended</string>
|
<string>Basic.Settings.Stream.IgnoreRecommended</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QLabel" name="enforceSettingsLabel">
|
<widget class="QLabel" name="enforceSettingsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -1492,7 +1505,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_28">
|
<layout class="QHBoxLayout" name="horizontalLayout_28">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="useStreamKeyAdv">
|
<widget class="QPushButton" name="useStreamKeyAdv">
|
||||||
|
@ -1516,14 +1529,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="connectedAccountLabel">
|
<widget class="QLabel" name="connectedAccountLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Basic.AutoConfig.StreamPage.ConnectedAccount</string>
|
<string>Basic.AutoConfig.StreamPage.ConnectedAccount</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="connectAccount2">
|
<widget class="QPushButton" name="connectAccount2">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
#include "window-basic-settings.hpp"
|
#include "window-basic-settings.hpp"
|
||||||
#include "obs-frontend-api.h"
|
#include "obs-frontend-api.h"
|
||||||
|
@ -20,6 +21,13 @@
|
||||||
#include "youtube-api-wrappers.hpp"
|
#include "youtube-api-wrappers.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const QUuid &CustomServerUUID()
|
||||||
|
{
|
||||||
|
static const QUuid uuid = QUuid::fromString(
|
||||||
|
QT_UTF8("{241da255-70f2-4bbb-bef7-509695bf8e65}"));
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
struct QCef;
|
struct QCef;
|
||||||
struct QCefCookieManager;
|
struct QCefCookieManager;
|
||||||
|
|
||||||
|
@ -108,6 +116,8 @@ void OBSBasicSettings::LoadStream1Settings()
|
||||||
const char *service = obs_data_get_string(settings, "service");
|
const char *service = obs_data_get_string(settings, "service");
|
||||||
const char *server = obs_data_get_string(settings, "server");
|
const char *server = obs_data_get_string(settings, "server");
|
||||||
const char *key = obs_data_get_string(settings, "key");
|
const char *key = obs_data_get_string(settings, "key");
|
||||||
|
bool use_custom_server =
|
||||||
|
obs_data_get_bool(settings, "using_custom_server");
|
||||||
protocol = QT_UTF8(obs_service_get_protocol(service_obj));
|
protocol = QT_UTF8(obs_service_get_protocol(service_obj));
|
||||||
const char *bearer_token =
|
const char *bearer_token =
|
||||||
obs_data_get_string(settings, "bearer_token");
|
obs_data_get_string(settings, "bearer_token");
|
||||||
|
@ -148,7 +158,13 @@ void OBSBasicSettings::LoadStream1Settings()
|
||||||
UpdateServerList();
|
UpdateServerList();
|
||||||
|
|
||||||
if (is_rtmp_common) {
|
if (is_rtmp_common) {
|
||||||
int idx = ui->server->findData(server);
|
int idx = -1;
|
||||||
|
if (use_custom_server) {
|
||||||
|
idx = ui->server->findData(CustomServerUUID());
|
||||||
|
} else {
|
||||||
|
idx = ui->server->findData(QString::fromUtf8(server));
|
||||||
|
}
|
||||||
|
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
if (server && *server)
|
if (server && *server)
|
||||||
ui->server->insertItem(0, server, server);
|
ui->server->insertItem(0, server, server);
|
||||||
|
@ -157,6 +173,9 @@ void OBSBasicSettings::LoadStream1Settings()
|
||||||
ui->server->setCurrentIndex(idx);
|
ui->server->setCurrentIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (use_custom_server)
|
||||||
|
ui->serviceCustomServer->setText(server);
|
||||||
|
|
||||||
if (is_whip)
|
if (is_whip)
|
||||||
ui->key->setText(bearer_token);
|
ui->key->setText(bearer_token);
|
||||||
else
|
else
|
||||||
|
@ -223,9 +242,19 @@ void OBSBasicSettings::SaveStream1Settings()
|
||||||
obs_data_set_string(settings, "service",
|
obs_data_set_string(settings, "service",
|
||||||
QT_TO_UTF8(ui->service->currentText()));
|
QT_TO_UTF8(ui->service->currentText()));
|
||||||
obs_data_set_string(settings, "protocol", QT_TO_UTF8(protocol));
|
obs_data_set_string(settings, "protocol", QT_TO_UTF8(protocol));
|
||||||
obs_data_set_string(
|
if (ui->server->currentData() == CustomServerUUID()) {
|
||||||
settings, "server",
|
obs_data_set_bool(settings, "using_custom_server",
|
||||||
QT_TO_UTF8(ui->server->currentData().toString()));
|
true);
|
||||||
|
|
||||||
|
obs_data_set_string(
|
||||||
|
settings, "server",
|
||||||
|
QT_TO_UTF8(ui->serviceCustomServer->text()));
|
||||||
|
} else {
|
||||||
|
obs_data_set_string(
|
||||||
|
settings, "server",
|
||||||
|
QT_TO_UTF8(
|
||||||
|
ui->server->currentData().toString()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
obs_data_set_string(
|
obs_data_set_string(
|
||||||
settings, "server",
|
settings, "server",
|
||||||
|
@ -675,6 +704,12 @@ void OBSBasicSettings::UpdateServerList()
|
||||||
ui->server->addItem(name, server);
|
ui->server->addItem(name, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (serviceName == "Twitch") {
|
||||||
|
ui->server->addItem(
|
||||||
|
QTStr("Basic.Settings.Stream.SpecifyCustomServer"),
|
||||||
|
CustomServerUUID());
|
||||||
|
}
|
||||||
|
|
||||||
obs_properties_destroy(props);
|
obs_properties_destroy(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,6 +922,19 @@ void OBSBasicSettings::on_useAuth_toggled()
|
||||||
ui->authPwWidget->setVisible(use_auth);
|
ui->authPwWidget->setVisible(use_auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OBSBasicSettings::IsCustomServer()
|
||||||
|
{
|
||||||
|
return ui->server->currentData() == QVariant{CustomServerUUID()};
|
||||||
|
}
|
||||||
|
|
||||||
|
void OBSBasicSettings::on_server_currentIndexChanged(int /*index*/)
|
||||||
|
{
|
||||||
|
auto server_is_custom = IsCustomServer();
|
||||||
|
|
||||||
|
ui->serviceCustomServerLabel->setVisible(server_is_custom);
|
||||||
|
ui->serviceCustomServer->setVisible(server_is_custom);
|
||||||
|
}
|
||||||
|
|
||||||
void OBSBasicSettings::UpdateVodTrackSetting()
|
void OBSBasicSettings::UpdateVodTrackSetting()
|
||||||
{
|
{
|
||||||
bool enableForCustomServer = config_get_bool(
|
bool enableForCustomServer = config_get_bool(
|
||||||
|
|
|
@ -411,6 +411,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||||
HookWidget(ui->service, COMBO_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->service, COMBO_CHANGED, STREAM1_CHANGED);
|
||||||
HookWidget(ui->server, COMBO_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->server, COMBO_CHANGED, STREAM1_CHANGED);
|
||||||
HookWidget(ui->customServer, EDIT_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->customServer, EDIT_CHANGED, STREAM1_CHANGED);
|
||||||
|
HookWidget(ui->serviceCustomServer, EDIT_CHANGED, STREAM1_CHANGED);
|
||||||
HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
|
||||||
HookWidget(ui->bandwidthTestEnable, CHECK_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->bandwidthTestEnable, CHECK_CHANGED, STREAM1_CHANGED);
|
||||||
HookWidget(ui->twitchAddonDropdown, COMBO_CHANGED, STREAM1_CHANGED);
|
HookWidget(ui->twitchAddonDropdown, COMBO_CHANGED, STREAM1_CHANGED);
|
||||||
|
|
|
@ -296,6 +296,8 @@ private:
|
||||||
/* Appearance */
|
/* Appearance */
|
||||||
void InitAppearancePage();
|
void InitAppearancePage();
|
||||||
|
|
||||||
|
bool IsCustomServer();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void RecreateOutputResolutionWidget();
|
void RecreateOutputResolutionWidget();
|
||||||
bool UpdateResFPSLimits();
|
bool UpdateResFPSLimits();
|
||||||
|
@ -306,6 +308,7 @@ private slots:
|
||||||
void on_disconnectAccount_clicked();
|
void on_disconnectAccount_clicked();
|
||||||
void on_useStreamKey_clicked();
|
void on_useStreamKey_clicked();
|
||||||
void on_useAuth_toggled();
|
void on_useAuth_toggled();
|
||||||
|
void on_server_currentIndexChanged(int index);
|
||||||
|
|
||||||
void on_hotkeyFilterReset_clicked();
|
void on_hotkeyFilterReset_clicked();
|
||||||
void on_hotkeyFilterSearch_textChanged(const QString text);
|
void on_hotkeyFilterSearch_textChanged(const QString text);
|
||||||
|
|
Loading…
Reference in a new issue