New twitch ingests

This commit is contained in:
Exeldro 2024-11-01 15:00:39 +01:00
parent 0b805a52ae
commit bc36e4eff2
No known key found for this signature in database
GPG Key ID: 97269A83FC715751
4 changed files with 39 additions and 17 deletions

View File

@ -36,7 +36,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt::Core Qt::Widgets)
target_compile_options(
${PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
-Wno-comma>)
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
#set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_target_properties(
${PROJECT_NAME}
PROPERTIES AUTOMOC ON

View File

@ -54,7 +54,8 @@ QToolButton *ConfigUtils::generateMenuButton(QString title, QIcon icon)
}
// Generate QIcon from emoji
QIcon ConfigUtils::generateEmojiQIcon(QString emoji) {
QIcon ConfigUtils::generateEmojiQIcon(QString emoji)
{
QPixmap pixmap(32, 32);
pixmap.fill(Qt::transparent);
@ -78,7 +79,8 @@ void ConfigUtils::updateButtonStyles(QPushButton *defaultButton, QPushButton *cu
QIcon ConfigUtils::getPlatformIconFromEndpoint(QString endpoint)
{
if (endpoint.contains(QString::fromUtf8(".contribute.live-video.net")) ||
if (endpoint.contains(QString::fromUtf8("ingest.global-contribute.live-video.net")) ||
endpoint.contains(QString::fromUtf8(".contribute.live-video.net")) ||
endpoint.contains(QString::fromUtf8(".twitch.tv"))) { // twitch
return QIcon(":/aitum/media/twitch.png");
} else if (endpoint.contains(QString::fromUtf8(".youtube.com"))) { // youtube

View File

@ -400,7 +400,8 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
}
auto service = obs_frontend_get_streaming_service();
auto url = QString::fromUtf8(obs_service_get_connect_info(service, OBS_SERVICE_CONNECT_INFO_SERVER_URL));
auto url = QString::fromUtf8(service ? obs_service_get_connect_info(service, OBS_SERVICE_CONNECT_INFO_SERVER_URL)
: "");
if (url != mainPlatformUrl) {
mainPlatformUrl = url;
mainPlatformIconLabel->setPixmap(ConfigUtils::getPlatformIconFromEndpoint(url).pixmap(30, 30));
@ -701,7 +702,8 @@ void MultistreamDock::LoadOutput(obs_data_t *output_data, bool vertical)
streamButton->setChecked(false);
} else {
bool stop = true;
bool warnBeforeStreamStop = config_get_bool(get_user_config(), "BasicWindow", "WarnBeforeStoppingStream");
bool warnBeforeStreamStop =
config_get_bool(get_user_config(), "BasicWindow", "WarnBeforeStoppingStream");
if (warnBeforeStreamStop && isVisible()) {
auto button = QMessageBox::question(
this, QString::fromUtf8(obs_frontend_get_locale_string("ConfirmStop.Title")),

View File

@ -114,6 +114,27 @@ QComboBox *OutputDialog::generateOutputServerCombo(std::string service, QPushBut
combo->setMinimumHeight(30);
combo->setStyleSheet("padding: 4px 8px;");
if (service == "Twitch") {
auto twitch_cache = obs_module_get_config_path(obs_get_module("rtmp-services"), "twitch_ingests.json");
if (twitch_cache) {
auto json = obs_data_create_from_json_file(twitch_cache);
bfree(twitch_cache);
combo->addItem(QString::fromUtf8("Default"), QString::fromUtf8("rtmp://live.twitch.tv/app"));
auto ingests = obs_data_get_array(json, "ingests");
obs_data_array_enum(
ingests,
[](obs_data_t *ingest_data, void *param) {
auto c = (QComboBox *)param;
auto url = QString::fromUtf8(obs_data_get_string(ingest_data, "url_template"));
url.replace(QString::fromUtf8("/{stream_key}"), QString::fromUtf8(""));
c->addItem(QString::fromUtf8(obs_data_get_string(ingest_data, "name")), url);
},
combo);
obs_data_array_release(ingests);
obs_data_release(json);
}
}
auto rawOptions = getService(service);
// turn raw options into actual selectable options
@ -162,14 +183,10 @@ QLineEdit *OutputDialog::generateOutputKeyField(QPushButton *confirmButton, bool
field->setEchoMode(StreamKeyInput::EchoMode::Password);
// On focus, show field
connect(field, &StreamKeyInput::focusGained, [this, field] {
field->setEchoMode(StreamKeyInput::EchoMode::Normal);
});
connect(field, &StreamKeyInput::focusGained, [this, field] { field->setEchoMode(StreamKeyInput::EchoMode::Normal); });
// On blur, hide field
connect(field, &StreamKeyInput::focusLost, [this, field] {
field->setEchoMode(StreamKeyInput::EchoMode::Password);
});
connect(field, &StreamKeyInput::focusLost, [this, field] { field->setEchoMode(StreamKeyInput::EchoMode::Password); });
connect(field, &QLineEdit::textEdited, [this, field, confirmButton] {
outputKey = field->text();
@ -339,7 +356,8 @@ OutputDialog::OutputDialog(QDialog *parent, QString name, QString server, QStrin
auto layout = new QVBoxLayout();
// Add the appropriate page to the layout based upon the server url
if (outputServer.contains(QString::fromUtf8(".contribute.live-video.net")) ||
if (outputServer.contains(QString::fromUtf8("ingest.global-contribute.live-video.net")) ||
outputServer.contains(QString::fromUtf8(".contribute.live-video.net")) ||
outputServer.contains(QString::fromUtf8(".twitch.tv"))) { // twitch
layout->addWidget(WizardInfoTwitch(true));
} else if (outputServer.contains(QString::fromUtf8(".youtube.com"))) { // youtube