obs_properties_t obs_encoder_properties(obs_encoder_t encoder) { if (encoder && encoder->info.properties) { obs_properties_t props; props = encoder->info.properties(); obs_properties_apply_settings(props, encoder->context.settings); return props; } return NULL; }
obs_properties_t *obs_encoder_properties(const obs_encoder_t *encoder) { if (encoder && encoder->info.get_properties) { obs_properties_t *props; props = encoder->info.get_properties(encoder->context.data); obs_properties_apply_settings(props, encoder->context.settings); return props; } return NULL; }
obs_properties_t obs_output_properties(obs_output_t output) { if (output && output->info.properties) { obs_properties_t props; props = output->info.properties(); obs_properties_apply_settings(props, output->context.settings); return props; } return NULL; }
obs_properties_t *obs_output_properties(const obs_output_t *output) { if (output && output->info.get_properties) { obs_properties_t *props; props = output->info.get_properties(output->context.data); obs_properties_apply_settings(props, output->context.settings); return props; } return NULL; }
obs_properties_t obs_source_properties(obs_source_t source, const char *locale) { if (source && source->info.properties) { obs_properties_t props; props = source->info.properties(locale); obs_properties_apply_settings(props, source->context.settings); return props; } return NULL; }
obs_properties_t *obs_service_properties(const obs_service_t *service) { if (service && service->info.get_properties) { obs_properties_t *props; props = service->info.get_properties(service->context.data); obs_properties_apply_settings(props, service->context.settings); return props; } return NULL; }
obs_properties_t obs_get_output_properties(const char *id) { const struct obs_output_info *info = find_output(id); if (info && info->properties) { obs_data_t defaults = get_defaults(info); obs_properties_t properties; properties = info->properties(); obs_properties_apply_settings(properties, defaults); obs_data_release(defaults); return properties; } return NULL; }
obs_properties_t *obs_get_encoder_properties(const char *id) { const struct obs_encoder_info *ei = find_encoder(id); if (ei && ei->get_properties) { obs_data_t *defaults = get_defaults(ei); obs_properties_t *properties; properties = ei->get_properties(NULL); obs_properties_apply_settings(properties, defaults); obs_data_release(defaults); return properties; } return NULL; }
obs_properties_t *obs_get_service_properties(const char *id) { const struct obs_service_info *info = find_service(id); if (info && info->get_properties) { obs_data_t *defaults = get_defaults(info); obs_properties_t *properties; properties = info->get_properties(NULL); obs_properties_apply_settings(properties, defaults); obs_data_release(defaults); return properties; } return NULL; }
obs_properties_t obs_get_encoder_properties(const char *id, const char *locale) { const struct obs_encoder_info *ei = get_encoder_info(id); if (ei && ei->properties) { obs_data_t defaults = get_defaults(ei); obs_properties_t properties; properties = ei->properties(locale); obs_properties_apply_settings(properties, defaults); obs_data_release(defaults); return properties; } return NULL; }
obs_properties_t obs_get_source_properties(enum obs_source_type type, const char *id, const char *locale) { const struct obs_source_info *info = get_source_info(type, id); if (info && info->properties) { obs_data_t defaults = get_defaults(info); obs_properties_t properties; properties = info->properties(locale); obs_properties_apply_settings(properties, defaults); obs_data_release(defaults); return properties; } return NULL; }
void ScriptsTool::ReloadScript(const char *path) { for (OBSScript &script : scriptData->scripts) { const char *script_path = obs_script_get_path(script); if (strcmp(script_path, path) == 0) { obs_script_reload(script); OBSData settings = obs_data_create(); obs_data_release(settings); obs_properties_t *prop = obs_script_get_properties(script); obs_properties_apply_settings(prop, settings); break; } } }
AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent) { EnableThreadedMessageBoxes(true); calldata_t cd = {0}; calldata_set_int(&cd, "seconds", 5); proc_handler_t *ph = obs_get_proc_handler(); proc_handler_call(ph, "twitch_ingests_refresh", &cd); calldata_free(&cd); OBSBasic *main = reinterpret_cast<OBSBasic*>(parent); main->EnableOutputs(false); installEventFilter(CreateShortcutFilter()); std::string serviceType; GetServiceInfo(serviceType, serviceName, server, key); #ifdef _WIN32 setWizardStyle(QWizard::ModernStyle); #endif streamPage = new AutoConfigStreamPage(); setPage(StartPage, new AutoConfigStartPage()); setPage(VideoPage, new AutoConfigVideoPage()); setPage(StreamPage, streamPage); setPage(TestPage, new AutoConfigTestPage()); setWindowTitle(QTStr("Basic.AutoConfig")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); obs_video_info ovi; obs_get_video_info(&ovi); baseResolutionCX = ovi.base_width; baseResolutionCY = ovi.base_height; /* ----------------------------------------- */ /* check to see if Twitch's "auto" available */ OBSData twitchSettings = obs_data_create(); obs_data_release(twitchSettings); obs_data_set_string(twitchSettings, "service", "Twitch"); obs_properties_t *props = obs_get_service_properties("rtmp_common"); obs_properties_apply_settings(props, twitchSettings); obs_property_t *p = obs_properties_get(props, "server"); const char *first = obs_property_list_item_string(p, 0); twitchAuto = strcmp(first, "auto") == 0; obs_properties_destroy(props); /* ----------------------------------------- */ /* load service/servers */ customServer = serviceType == "rtmp_custom"; QComboBox *serviceList = streamPage->ui->service; if (!serviceName.empty()) { serviceList->blockSignals(true); int count = serviceList->count(); bool found = false; for (int i = 0; i < count; i++) { QString name = serviceList->itemText(i); if (name == serviceName.c_str()) { serviceList->setCurrentIndex(i); found = true; break; } } if (!found) { serviceList->insertItem(0, serviceName.c_str()); serviceList->setCurrentIndex(0); } serviceList->blockSignals(false); } streamPage->UpdateServerList(); streamPage->UpdateKeyLink(); streamPage->lastService.clear(); if (!customServer) { QComboBox *serverList = streamPage->ui->server; int idx = serverList->findData(QString(server.c_str())); if (idx == -1) idx = 0; serverList->setCurrentIndex(idx); } else { streamPage->ui->customServer->setText(server.c_str()); int idx = streamPage->ui->service->findData( QVariant((int)ListOpt::Custom)); streamPage->ui->service->setCurrentIndex(idx); } if (!key.empty()) streamPage->ui->key->setText(key.c_str()); int bitrate = config_get_int(main->Config(), "SimpleOutput", "VBitrate"); streamPage->ui->bitrate->setValue(bitrate); streamPage->ServiceChanged(); TestHardwareEncoding(); if (!hardwareEncodingAvailable) { delete streamPage->ui->preferHardware; streamPage->ui->preferHardware = nullptr; } else { /* Newer generations of NVENC have a high enough quality to * bitrate ratio that if NVENC is available, it makes sense to * just always prefer hardware encoding by default */ bool preferHardware = nvencAvailable || os_get_physical_cores() <= 4; streamPage->ui->preferHardware->setChecked(preferHardware); } setOptions(0); setButtonText(QWizard::FinishButton, QTStr("Basic.AutoConfig.ApplySettings")); setButtonText(QWizard::BackButton, QTStr("Back")); setButtonText(QWizard::NextButton, QTStr("Next")); setButtonText(QWizard::CancelButton, QTStr("Cancel")); }
void ScriptsTool::on_addScripts_clicked() { const char **formats = obs_scripting_supported_formats(); const char **cur_format = formats; QString extensions; QString filter; while (*cur_format) { if (!extensions.isEmpty()) extensions += QStringLiteral(" "); extensions += QStringLiteral("*."); extensions += *cur_format; cur_format++; } if (!extensions.isEmpty()) { filter += obs_module_text("FileFilter.ScriptFiles"); filter += QStringLiteral(" ("); filter += extensions; filter += QStringLiteral(")"); } if (filter.isEmpty()) return; static std::string lastBrowsedDir; if (lastBrowsedDir.empty()) { BPtr<char> baseScriptPath = obs_module_file("scripts"); lastBrowsedDir = baseScriptPath; } QFileDialog dlg(this, obs_module_text("AddScripts")); dlg.setFileMode(QFileDialog::ExistingFiles); dlg.setDirectory(QDir(lastBrowsedDir.c_str())); dlg.setNameFilter(filter); dlg.exec(); QStringList files = dlg.selectedFiles(); if (!files.count()) return; lastBrowsedDir = dlg.directory().path().toUtf8().constData(); for (const QString &file : files) { QByteArray pathBytes = file.toUtf8(); const char *path = pathBytes.constData(); if (scriptData->ScriptOpened(path)) { continue; } obs_script_t *script = obs_script_create(path, NULL); if (script) { const char *script_file = obs_script_get_file(script); scriptData->scripts.emplace_back(script); QListWidgetItem *item = new QListWidgetItem(script_file); item->setData(Qt::UserRole, QString(file)); ui->scripts->addItem(item); OBSData settings = obs_data_create(); obs_data_release(settings); obs_properties_t *prop = obs_script_get_properties(script); obs_properties_apply_settings(prop, settings); } } }