本文整理汇总了C++中OBSBasic::Config方法的典型用法代码示例。如果您正苦于以下问题:C++ OBSBasic::Config方法的具体用法?C++ OBSBasic::Config怎么用?C++ OBSBasic::Config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBSBasic
的用法示例。
在下文中一共展示了OBSBasic::Config方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveInternal
void OAuth::SaveInternal()
{
OBSBasic *main = OBSBasic::Get();
config_set_string(main->Config(), service(), "RefreshToken",
refresh_token.c_str());
config_set_string(main->Config(), service(), "Token", token.c_str());
config_set_uint(main->Config(), service(), "ExpireTime", expire_time);
config_set_int(main->Config(), service(), "ScopeVer", currentScopeVer);
}
示例2: SaveInternal
void MixerAuth::SaveInternal()
{
OBSBasic *main = OBSBasic::Get();
config_set_string(main->Config(), service(), "Name", name.c_str());
config_set_string(main->Config(), service(), "Id", id.c_str());
if (uiLoaded) {
config_set_string(main->Config(), service(), "DockState",
main->saveState().toBase64().constData());
}
OAuthStreamKey::SaveInternal();
}
示例3: LoadInternal
bool OAuth::LoadInternal()
{
OBSBasic *main = OBSBasic::Get();
refresh_token = get_config_str(main, service(), "RefreshToken");
token = get_config_str(main, service(), "Token");
expire_time = config_get_uint(main->Config(), service(), "ExpireTime");
currentScopeVer = (int)config_get_int(main->Config(), service(),
"ScopeVer");
return implicit
? !token.empty()
: !refresh_token.empty();
}
示例4: SaveSettings
void AutoConfig::SaveSettings()
{
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
if (recordingEncoder != Encoder::Stream)
config_set_string(main->Config(), "SimpleOutput", "RecEncoder",
GetEncoderId(recordingEncoder));
const char *quality = recordingQuality == Quality::High
? "Small"
: "Stream";
config_set_string(main->Config(), "Output", "Mode", "Simple");
config_set_string(main->Config(), "SimpleOutput", "RecQuality", quality);
config_set_int(main->Config(), "Video", "BaseCX", baseResolutionCX);
config_set_int(main->Config(), "Video", "BaseCY", baseResolutionCY);
config_set_int(main->Config(), "Video", "OutputCX", idealResolutionCX);
config_set_int(main->Config(), "Video", "OutputCY", idealResolutionCY);
if (fpsType != FPSType::UseCurrent) {
config_set_uint(main->Config(), "Video", "FPSType", 0);
config_set_string(main->Config(), "Video", "FPSCommon",
std::to_string(idealFPSNum).c_str());
}
main->ResetVideo();
main->ResetOutputs();
config_save_safe(main->Config(), "tmp", nullptr);
}
示例5: SaveStreamSettings
void AutoConfig::SaveStreamSettings()
{
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
/* ---------------------------------- */
/* save service */
const char *service_id = customServer
? "rtmp_custom"
: "rtmp_common";
obs_service_t *oldService = main->GetService();
OBSData hotkeyData = obs_hotkeys_save_service(oldService);
obs_data_release(hotkeyData);
OBSData settings = obs_data_create();
obs_data_release(settings);
if (!customServer)
obs_data_set_string(settings, "service", serviceName.c_str());
obs_data_set_string(settings, "server", server.c_str());
obs_data_set_string(settings, "key", key.c_str());
OBSService newService = obs_service_create(service_id,
"default_service", settings, hotkeyData);
obs_service_release(newService);
if (!newService)
return;
main->SetService(newService);
main->SaveService();
main->auth = streamPage->auth;
if (!!main->auth)
main->auth->LoadUI();
/* ---------------------------------- */
/* save stream settings */
config_set_int(main->Config(), "SimpleOutput", "VBitrate",
idealBitrate);
config_set_string(main->Config(), "SimpleOutput", "StreamEncoder",
GetEncoderId(streamingEncoder));
config_remove_value(main->Config(), "SimpleOutput", "UseAdvanced");
}
示例6: LoadUI
void MixerAuth::LoadUI()
{
if (!cef)
return;
if (uiLoaded)
return;
if (!GetChannelInfo())
return;
OBSBasic::InitBrowserPanelSafeBlock();
OBSBasic *main = OBSBasic::Get();
std::string url;
url += "https://mixer.com/embed/chat/";
url += id;
QSize size = main->frameSize();
QPoint pos = main->pos();
chat.reset(new MixerChat());
chat->setObjectName("mixerChat");
chat->resize(300, 600);
chat->setMinimumSize(200, 300);
chat->setWindowTitle(QTStr("Auth.Chat"));
chat->setAllowedAreas(Qt::AllDockWidgetAreas);
QCefWidget *browser = cef->create_widget(nullptr, url, panel_cookies);
chat->setWidget(browser);
main->addDockWidget(Qt::RightDockWidgetArea, chat.data());
chatMenu.reset(main->AddDockWidget(chat.data()));
/* ----------------------------------- */
chat->setFloating(true);
chat->move(pos.x() + size.width() - chat->width() - 50, pos.y() + 50);
if (firstLoad) {
chat->setVisible(true);
} else {
const char *dockStateStr = config_get_string(main->Config(),
service(), "DockState");
QByteArray dockState =
QByteArray::fromBase64(QByteArray(dockStateStr));
main->restoreState(dockState);
}
uiLoaded = true;
}
示例7: source
OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
: source(source_)
{
QHBoxLayout *hlayout;
signal_handler_t *handler = obs_source_get_signal_handler(source);
const char *sourceName = obs_source_get_name(source);
float vol = obs_source_get_volume(source);
uint32_t flags = obs_source_get_flags(source);
uint32_t mixers = obs_source_get_audio_mixers(source);
forceMonoContainer = new QWidget();
mixerContainer = new QWidget();
balanceContainer = new QWidget();
labelL = new QLabel();
labelR = new QLabel();
nameLabel = new QLabel();
volume = new QDoubleSpinBox();
forceMono = new QCheckBox();
balance = new BalanceSlider();
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
monitoringType = new QComboBox();
#endif
syncOffset = new QSpinBox();
mixer1 = new QCheckBox();
mixer2 = new QCheckBox();
mixer3 = new QCheckBox();
mixer4 = new QCheckBox();
mixer5 = new QCheckBox();
mixer6 = new QCheckBox();
volChangedSignal.Connect(handler, "volume", OBSSourceVolumeChanged,
this);
syncOffsetSignal.Connect(handler, "audio_sync", OBSSourceSyncChanged,
this);
flagsSignal.Connect(handler, "update_flags", OBSSourceFlagsChanged,
this);
mixersSignal.Connect(handler, "audio_mixers", OBSSourceMixersChanged,
this);
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
forceMonoContainer->setLayout(hlayout);
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
mixerContainer->setLayout(hlayout);
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
balanceContainer->setLayout(hlayout);
balanceContainer->setMinimumWidth(100);
labelL->setText("L");
labelR->setText("R");
nameLabel->setMinimumWidth(170);
nameLabel->setText(QT_UTF8(sourceName));
nameLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
volume->setMinimum(MIN_DB - 0.1);
volume->setMaximum(MAX_DB);
volume->setSingleStep(0.1);
volume->setDecimals(1);
volume->setSuffix(" dB");
volume->setValue(obs_mul_to_db(vol));
if (volume->value() < MIN_DB)
volume->setSpecialValueText("-inf dB");
forceMono->setChecked((flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0);
forceMonoContainer->layout()->addWidget(forceMono);
forceMonoContainer->layout()->setAlignment(forceMono,
Qt::AlignHCenter | Qt::AlignVCenter);
balance->setOrientation(Qt::Horizontal);
balance->setMinimum(0);
balance->setMaximum(100);
balance->setTickPosition(QSlider::TicksAbove);
balance->setTickInterval(50);
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
const char *speakers = config_get_string(main->Config(), "Audio",
"ChannelSetup");
if (strcmp(speakers, "Mono") == 0)
balance->setEnabled(false);
else
balance->setEnabled(true);
float bal = obs_source_get_balance_value(source) * 100.0f;
balance->setValue((int)bal);
int64_t cur_sync = obs_source_get_sync_offset(source);
syncOffset->setMinimum(-950);
syncOffset->setMaximum(20000);
syncOffset->setValue(int(cur_sync / NSEC_PER_MSEC));
int idx;
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
//.........这里部分代码省略.........
示例8: QWizard
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));
//.........这里部分代码省略.........