|
|
@@ -29,6 +29,7 @@ extern QCefCookieManager *panel_cookies;
|
|
|
enum class ListOpt : int {
|
|
|
ShowAll = 1,
|
|
|
Custom,
|
|
|
+ WHIP,
|
|
|
};
|
|
|
|
|
|
enum class Section : int {
|
|
|
@@ -41,6 +42,11 @@ inline bool OBSBasicSettings::IsCustomService() const
|
|
|
return ui->service->currentData().toInt() == (int)ListOpt::Custom;
|
|
|
}
|
|
|
|
|
|
+inline bool OBSBasicSettings::IsWHIP() const
|
|
|
+{
|
|
|
+ return ui->service->currentData().toInt() == (int)ListOpt::WHIP;
|
|
|
+}
|
|
|
+
|
|
|
void OBSBasicSettings::InitStreamPage()
|
|
|
{
|
|
|
ui->connectAccount2->setVisible(false);
|
|
|
@@ -91,6 +97,9 @@ void OBSBasicSettings::LoadStream1Settings()
|
|
|
|
|
|
obs_service_t *service_obj = main->GetService();
|
|
|
const char *type = obs_service_get_type(service_obj);
|
|
|
+ bool is_rtmp_custom = (strcmp(type, "rtmp_custom") == 0);
|
|
|
+ bool is_rtmp_common = (strcmp(type, "rtmp_common") == 0);
|
|
|
+ bool is_whip = (strcmp(type, "whip_custom") == 0);
|
|
|
|
|
|
loading = true;
|
|
|
|
|
|
@@ -100,10 +109,14 @@ void OBSBasicSettings::LoadStream1Settings()
|
|
|
const char *server = obs_data_get_string(settings, "server");
|
|
|
const char *key = obs_data_get_string(settings, "key");
|
|
|
protocol = QT_UTF8(obs_service_get_protocol(service_obj));
|
|
|
+ const char *bearer_token =
|
|
|
+ obs_data_get_string(settings, "bearer_token");
|
|
|
|
|
|
- if (strcmp(type, "rtmp_custom") == 0) {
|
|
|
- ui->service->setCurrentIndex(0);
|
|
|
+ if (is_rtmp_custom || is_whip)
|
|
|
ui->customServer->setText(server);
|
|
|
+
|
|
|
+ if (is_rtmp_custom) {
|
|
|
+ ui->service->setCurrentIndex(0);
|
|
|
lastServiceIdx = 0;
|
|
|
lastCustomServer = ui->customServer->text();
|
|
|
|
|
|
@@ -157,7 +170,7 @@ void OBSBasicSettings::LoadStream1Settings()
|
|
|
|
|
|
UpdateServerList();
|
|
|
|
|
|
- if (strcmp(type, "rtmp_common") == 0) {
|
|
|
+ if (is_rtmp_common) {
|
|
|
int idx = ui->server->findData(server);
|
|
|
if (idx == -1) {
|
|
|
if (server && *server)
|
|
|
@@ -167,7 +180,10 @@ void OBSBasicSettings::LoadStream1Settings()
|
|
|
ui->server->setCurrentIndex(idx);
|
|
|
}
|
|
|
|
|
|
- ui->key->setText(key);
|
|
|
+ if (is_whip)
|
|
|
+ ui->key->setText(bearer_token);
|
|
|
+ else
|
|
|
+ ui->key->setText(key);
|
|
|
|
|
|
lastService.clear();
|
|
|
ServiceChanged();
|
|
|
@@ -191,14 +207,21 @@ void OBSBasicSettings::LoadStream1Settings()
|
|
|
void OBSBasicSettings::SaveStream1Settings()
|
|
|
{
|
|
|
bool customServer = IsCustomService();
|
|
|
- const char *service_id = customServer ? "rtmp_custom" : "rtmp_common";
|
|
|
+ bool whip = IsWHIP();
|
|
|
+ const char *service_id = "rtmp_common";
|
|
|
+
|
|
|
+ if (customServer) {
|
|
|
+ service_id = "rtmp_custom";
|
|
|
+ } else if (whip) {
|
|
|
+ service_id = "whip_custom";
|
|
|
+ }
|
|
|
|
|
|
obs_service_t *oldService = main->GetService();
|
|
|
OBSDataAutoRelease hotkeyData = obs_hotkeys_save_service(oldService);
|
|
|
|
|
|
OBSDataAutoRelease settings = obs_data_create();
|
|
|
|
|
|
- if (!customServer) {
|
|
|
+ if (!customServer && !whip) {
|
|
|
obs_data_set_string(settings, "service",
|
|
|
QT_TO_UTF8(ui->service->currentText()));
|
|
|
obs_data_set_string(settings, "protocol", QT_TO_UTF8(protocol));
|
|
|
@@ -239,7 +262,12 @@ void OBSBasicSettings::SaveStream1Settings()
|
|
|
obs_data_set_bool(settings, "bwtest", false);
|
|
|
}
|
|
|
|
|
|
- obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
|
|
|
+ if (whip)
|
|
|
+ obs_data_set_string(settings, "bearer_token",
|
|
|
+ QT_TO_UTF8(ui->key->text()));
|
|
|
+ else
|
|
|
+ obs_data_set_string(settings, "key",
|
|
|
+ QT_TO_UTF8(ui->key->text()));
|
|
|
|
|
|
OBSServiceAutoRelease newService = obs_service_create(
|
|
|
service_id, "default_service", settings, hotkeyData);
|
|
|
@@ -262,7 +290,7 @@ void OBSBasicSettings::SaveStream1Settings()
|
|
|
|
|
|
void OBSBasicSettings::UpdateMoreInfoLink()
|
|
|
{
|
|
|
- if (IsCustomService()) {
|
|
|
+ if (IsCustomService() || IsWHIP()) {
|
|
|
ui->moreInfoButton->hide();
|
|
|
return;
|
|
|
}
|
|
|
@@ -312,6 +340,9 @@ void OBSBasicSettings::UpdateKeyLink()
|
|
|
if (serviceName == "Dacast") {
|
|
|
ui->streamKeyLabel->setText(
|
|
|
QTStr("Basic.AutoConfig.StreamPage.EncoderKey"));
|
|
|
+ } else if (IsWHIP()) {
|
|
|
+ ui->streamKeyLabel->setText(
|
|
|
+ QTStr("Basic.AutoConfig.StreamPage.BearerToken"));
|
|
|
} else if (!IsCustomService()) {
|
|
|
ui->streamKeyLabel->setText(
|
|
|
QTStr("Basic.AutoConfig.StreamPage.StreamKey"));
|
|
|
@@ -356,6 +387,8 @@ void OBSBasicSettings::LoadServices(bool showAll)
|
|
|
for (QString &name : names)
|
|
|
ui->service->addItem(name);
|
|
|
|
|
|
+ ui->service->insertItem(0, QTStr("WHIP"), QVariant((int)ListOpt::WHIP));
|
|
|
+
|
|
|
if (!showAll) {
|
|
|
ui->service->addItem(
|
|
|
QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
|
|
|
@@ -484,6 +517,7 @@ void OBSBasicSettings::ServiceChanged()
|
|
|
{
|
|
|
std::string service = QT_TO_UTF8(ui->service->currentText());
|
|
|
bool custom = IsCustomService();
|
|
|
+ bool whip = IsWHIP();
|
|
|
|
|
|
ui->disconnectAccount->setVisible(false);
|
|
|
ui->bandwidthTestEnable->setVisible(false);
|
|
|
@@ -500,7 +534,7 @@ void OBSBasicSettings::ServiceChanged()
|
|
|
ui->authPwLabel->setVisible(custom);
|
|
|
ui->authPwWidget->setVisible(custom);
|
|
|
|
|
|
- if (custom) {
|
|
|
+ if (custom || whip) {
|
|
|
ui->streamkeyPageLayout->insertRow(1, ui->serverLabel,
|
|
|
ui->serverStackedWidget);
|
|
|
|
|
|
@@ -625,11 +659,18 @@ void OBSBasicSettings::on_authPwShow_clicked()
|
|
|
OBSService OBSBasicSettings::SpawnTempService()
|
|
|
{
|
|
|
bool custom = IsCustomService();
|
|
|
- const char *service_id = custom ? "rtmp_custom" : "rtmp_common";
|
|
|
+ bool whip = IsWHIP();
|
|
|
+ const char *service_id = "rtmp_common";
|
|
|
+
|
|
|
+ if (custom) {
|
|
|
+ service_id = "rtmp_custom";
|
|
|
+ } else if (whip) {
|
|
|
+ service_id = "whip_custom";
|
|
|
+ }
|
|
|
|
|
|
OBSDataAutoRelease settings = obs_data_create();
|
|
|
|
|
|
- if (!custom) {
|
|
|
+ if (!custom && !whip) {
|
|
|
obs_data_set_string(settings, "service",
|
|
|
QT_TO_UTF8(ui->service->currentText()));
|
|
|
obs_data_set_string(
|
|
|
@@ -640,7 +681,13 @@ OBSService OBSBasicSettings::SpawnTempService()
|
|
|
settings, "server",
|
|
|
QT_TO_UTF8(ui->customServer->text().trimmed()));
|
|
|
}
|
|
|
- obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
|
|
|
+
|
|
|
+ if (whip)
|
|
|
+ obs_data_set_string(settings, "bearer_token",
|
|
|
+ QT_TO_UTF8(ui->key->text()));
|
|
|
+ else
|
|
|
+ obs_data_set_string(settings, "key",
|
|
|
+ QT_TO_UTF8(ui->key->text()));
|
|
|
|
|
|
OBSServiceAutoRelease newService = obs_service_create(
|
|
|
service_id, "temp_service", settings, nullptr);
|