zoukankan      html  css  js  c++  java
  • OBS源码解析(3)OBSApp类介绍

    OBSApp类有以下功能:

    1.负责配置文件管理

    2.版本信息管理

    3.主界面OBSBasic对象管理

    4.obs模块初始化

    class OBSApp : public QApplication {
    Q_OBJECT

    private:
    std::string locale;
    std::string theme;
    ConfigFile globalConfig;
    TextLookup textLookup;
    OBSContext obsContext;
    QPointer<OBSMainWindow> mainWindow;
    profiler_name_store_t *profilerNameStore = nullptr;

    os_inhibit_t *sleepInhibitor = nullptr;
    int sleepInhibitRefs = 0;

    std::deque<obs_frontend_translate_ui_cb> translatorHooks;

    bool InitGlobalConfig();
    bool InitGlobalConfigDefaults();
    bool InitLocale();
    bool InitTheme();

    public:
    OBSApp(int &argc, char **argv, profiler_name_store_t *store);
    ~OBSApp();

    void AppInit();
    bool OBSInit();

    inline QMainWindow *GetMainWindow() const {return mainWindow.data();}

    inline config_t *GlobalConfig() const {return globalConfig;}

    inline const char *GetLocale() const
    {
    return locale.c_str();
    }

    inline const char *GetTheme() const {return theme.c_str();}
    bool SetTheme(std::string name, std::string path = "");

    inline lookup_t *GetTextLookup() const {return textLookup;}

    inline const char *GetString(const char *lookupVal) const
    {
    return textLookup.GetString(lookupVal);
    }

    bool TranslateString(const char *lookupVal, const char **out) const;

    profiler_name_store_t *GetProfilerNameStore() const
    {
    return profilerNameStore;
    }

    const char *GetLastLog() const;
    const char *GetCurrentLog() const;

    std::string GetVersionString() const;

    const char *InputAudioSource() const;
    const char *OutputAudioSource() const;

    const char *GetRenderModule() const;

    inline void IncrementSleepInhibition()
    {
    if (!sleepInhibitor) return;
    if (sleepInhibitRefs++ == 0)
    os_inhibit_sleep_set_active(sleepInhibitor, true);
    }

    inline void DecrementSleepInhibition()
    {
    if (!sleepInhibitor) return;
    if (sleepInhibitRefs == 0) return;
    if (--sleepInhibitRefs == 0)
    os_inhibit_sleep_set_active(sleepInhibitor, false);
    }

    inline void PushUITranslation(obs_frontend_translate_ui_cb cb)
    {
    translatorHooks.emplace_front(cb);
    }

    inline void PopUITranslation()
    {
    translatorHooks.pop_front();
    }
    };

    本博客所有内容均为原创,转载请说明出处。欢迎音视频多媒体领域的朋友来人来函交流心得。
  • 相关阅读:
    PostgreSQL事务特性之嵌套事务
    __attribute__((format(printf, a, b)))
    N个数依次入栈,出栈顺序有多少种?
    操作系统页面置换算法(opt,lru,fifo,clock)实现
    codeforces Round #320 (Div. 2) C. A Problem about Polyline(数学) D. "Or" Game(暴力,数学)
    基于X86平台的PC机通过网络发送一个int(32位)整数的字节顺序
    c/c++多线程模拟系统资源分配(并通过银行家算法避免死锁产生)
    Windows下使用Dev-C++开发基于pthread.h的多线程程序
    斐波那契的四种求法
    红黑树的插入
  • 原文地址:https://www.cnblogs.com/liuxt/p/6070709.html
Copyright © 2011-2022 走看看