diff --git a/CMakeLists.txt b/CMakeLists.txt index 77c5e07..51a901d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt::Core Qt::Widgets) target_compile_options( ${PROJECT_NAME} PRIVATE $<$:-Wno-quoted-include-in-framework-header -Wno-comma>) -set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +#set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") set_target_properties( ${PROJECT_NAME} PROPERTIES AUTOMOC ON diff --git a/config-utils.cpp b/config-utils.cpp index efd39b4..29421fd 100644 --- a/config-utils.cpp +++ b/config-utils.cpp @@ -54,16 +54,17 @@ 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); - + QPainter painter(&pixmap); QFont font = painter.font(); font.setPixelSize(32); painter.setFont(font); painter.drawText(pixmap.rect(), Qt::AlignCenter, emoji); - + return QIcon(pixmap); } @@ -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 diff --git a/multistream.cpp b/multistream.cpp index 077c439..2afab9b 100644 --- a/multistream.cpp +++ b/multistream.cpp @@ -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")), diff --git a/output-dialog.cpp b/output-dialog.cpp index 8020092..0e01135 100644 --- a/output-dialog.cpp +++ b/output-dialog.cpp @@ -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 @@ -157,19 +178,15 @@ QLineEdit *OutputDialog::generateOutputKeyField(QPushButton *confirmButton, bool if (edit) { // edit mode, set field value from output value field->setText(outputKey); } - + // Immediately hide 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