UI: Profile initialization

This commit is contained in:
Palana
2015-07-11 08:04:12 +02:00
parent 7c5d93b92a
commit 8d3db084e8
2 changed files with 54 additions and 4 deletions

View File

@@ -27,6 +27,7 @@
#include <util/dstr.h>
#include <util/util.hpp>
#include <util/platform.h>
#include <util/profiler.hpp>
#include <graphics/math-defs.h>
#include "obs-app.hpp"
@@ -577,6 +578,8 @@ bool OBSBasic::LoadService()
bool OBSBasic::InitService()
{
ProfileScope("OBSBasic::InitService");
if (LoadService())
return true;
@@ -728,6 +731,8 @@ bool OBSBasic::InitBasicConfigDefaults()
bool OBSBasic::InitBasicConfig()
{
ProfileScope("OBSBasic::InitBasicConfig");
char configPath[512];
int ret = GetProfilePath(configPath, sizeof(configPath), "");
@@ -766,6 +771,8 @@ bool OBSBasic::InitBasicConfig()
void OBSBasic::InitOBSCallbacks()
{
ProfileScope("OBSBasic::InitOBSCallbacks");
signalHandlers.reserve(signalHandlers.size() + 6);
signalHandlers.emplace_back(obs_get_signal_handler(), "source_add",
OBSBasic::SourceAdded, this);
@@ -783,6 +790,8 @@ void OBSBasic::InitOBSCallbacks()
void OBSBasic::InitPrimitives()
{
ProfileScope("OBSBasic::InitPrimitives");
obs_enter_graphics();
gs_render_start(true);
@@ -805,6 +814,8 @@ void OBSBasic::InitPrimitives()
void OBSBasic::ResetOutputs()
{
ProfileScope("OBSBasic::ResetOutputs");
const char *mode = config_get_string(basicConfig, "Output", "Mode");
bool advOut = astrcmpi(mode, "Advanced") == 0;
@@ -823,6 +834,8 @@ void OBSBasic::ResetOutputs()
void OBSBasic::OBSInit()
{
ProfileScope("OBSBasic::OBSInit");
const char *sceneCollection = config_get_string(App()->GlobalConfig(),
"Basic", "SceneCollectionFile");
char savePath[512];
@@ -878,9 +891,12 @@ void OBSBasic::OBSInit()
InitPrimitives();
disableSaving--;
Load(savePath);
disableSaving++;
{
ProfileScope("OBSBasic::Load");
disableSaving--;
Load(savePath);
disableSaving++;
}
TimedCheckForUpdates();
loaded = true;
@@ -921,6 +937,8 @@ void OBSBasic::OBSInit()
void OBSBasic::InitHotkeys()
{
ProfileScope("OBSBasic::InitHotkeys");
struct obs_hotkeys_translations t = {};
t.insert = Str("Hotkeys.Insert");
t.del = Str("Hotkeys.Delete");
@@ -986,6 +1004,8 @@ void OBSBasic::HotkeyTriggered(void *data, obs_hotkey_id id, bool pressed)
void OBSBasic::CreateHotkeys()
{
ProfileScope("OBSBasic::CreateHotkeys");
auto LoadHotkeyData = [&](const char *name) -> OBSData
{
const char *info = config_get_string(basicConfig,
@@ -2001,6 +2021,8 @@ static inline enum video_format GetVideoFormatFromName(const char *name)
int OBSBasic::ResetVideo()
{
ProfileScope("OBSBasic::ResetVideo");
struct obs_video_info ovi;
int ret;
@@ -2052,6 +2074,8 @@ int OBSBasic::ResetVideo()
bool OBSBasic::ResetAudio()
{
ProfileScope("OBSBasic::ResetAudio");
struct obs_audio_info ai;
ai.samples_per_sec = config_get_uint(basicConfig, "Audio",
"SampleRate");