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( target_compile_options(
${PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header ${PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
-Wno-comma>) -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( set_target_properties(
${PROJECT_NAME} ${PROJECT_NAME}
PROPERTIES AUTOMOC ON PROPERTIES AUTOMOC ON

View File

@ -54,16 +54,17 @@ QToolButton *ConfigUtils::generateMenuButton(QString title, QIcon icon)
} }
// Generate QIcon from emoji // Generate QIcon from emoji
QIcon ConfigUtils::generateEmojiQIcon(QString emoji) { QIcon ConfigUtils::generateEmojiQIcon(QString emoji)
{
QPixmap pixmap(32, 32); QPixmap pixmap(32, 32);
pixmap.fill(Qt::transparent); pixmap.fill(Qt::transparent);
QPainter painter(&pixmap); QPainter painter(&pixmap);
QFont font = painter.font(); QFont font = painter.font();
font.setPixelSize(32); font.setPixelSize(32);
painter.setFont(font); painter.setFont(font);
painter.drawText(pixmap.rect(), Qt::AlignCenter, emoji); painter.drawText(pixmap.rect(), Qt::AlignCenter, emoji);
return QIcon(pixmap); return QIcon(pixmap);
} }
@ -78,7 +79,8 @@ void ConfigUtils::updateButtonStyles(QPushButton *defaultButton, QPushButton *cu
QIcon ConfigUtils::getPlatformIconFromEndpoint(QString endpoint) 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 endpoint.contains(QString::fromUtf8(".twitch.tv"))) { // twitch
return QIcon(":/aitum/media/twitch.png"); return QIcon(":/aitum/media/twitch.png");
} else if (endpoint.contains(QString::fromUtf8(".youtube.com"))) { // youtube } 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 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) { if (url != mainPlatformUrl) {
mainPlatformUrl = url; mainPlatformUrl = url;
mainPlatformIconLabel->setPixmap(ConfigUtils::getPlatformIconFromEndpoint(url).pixmap(30, 30)); 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); streamButton->setChecked(false);
} else { } else {
bool stop = true; 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()) { if (warnBeforeStreamStop && isVisible()) {
auto button = QMessageBox::question( auto button = QMessageBox::question(
this, QString::fromUtf8(obs_frontend_get_locale_string("ConfirmStop.Title")), 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->setMinimumHeight(30);
combo->setStyleSheet("padding: 4px 8px;"); 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); auto rawOptions = getService(service);
// turn raw options into actual selectable options // 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 if (edit) { // edit mode, set field value from output value
field->setText(outputKey); field->setText(outputKey);
} }
// Immediately hide // Immediately hide
field->setEchoMode(StreamKeyInput::EchoMode::Password); field->setEchoMode(StreamKeyInput::EchoMode::Password);
// On focus, show field // On focus, show field
connect(field, &StreamKeyInput::focusGained, [this, field] { connect(field, &StreamKeyInput::focusGained, [this, field] { field->setEchoMode(StreamKeyInput::EchoMode::Normal); });
field->setEchoMode(StreamKeyInput::EchoMode::Normal);
});
// On blur, hide field // On blur, hide field
connect(field, &StreamKeyInput::focusLost, [this, field] { connect(field, &StreamKeyInput::focusLost, [this, field] { field->setEchoMode(StreamKeyInput::EchoMode::Password); });
field->setEchoMode(StreamKeyInput::EchoMode::Password);
});
connect(field, &QLineEdit::textEdited, [this, field, confirmButton] { connect(field, &QLineEdit::textEdited, [this, field, confirmButton] {
outputKey = field->text(); outputKey = field->text();
@ -339,7 +356,8 @@ OutputDialog::OutputDialog(QDialog *parent, QString name, QString server, QStrin
auto layout = new QVBoxLayout(); auto layout = new QVBoxLayout();
// Add the appropriate page to the layout based upon the server url // 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 outputServer.contains(QString::fromUtf8(".twitch.tv"))) { // twitch
layout->addWidget(WizardInfoTwitch(true)); layout->addWidget(WizardInfoTwitch(true));
} else if (outputServer.contains(QString::fromUtf8(".youtube.com"))) { // youtube } else if (outputServer.contains(QString::fromUtf8(".youtube.com"))) { // youtube