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();
    }
    };

    本博客所有内容均为原创,转载请说明出处。欢迎音视频多媒体领域的朋友来人来函交流心得。
  • 相关阅读:
    Debian/Kali下Subversion的配置
    Linux下解压Windows中的压缩包乱码解决办法
    JavaSocket全双工通信 问题 待解决
    MYSQL学习笔记
    Java Socket 全双工通信
    Kali2017安装后的那些事
    nginx的一次安装与配置
    解决1130 Host 'localhost' is not allowed to connect to this MySQL server
    SimpleDateFormat 和 LocalDate、LocalTime 以及时间大小比较简单示例
    java 线程池 ExeutorService
  • 原文地址:https://www.cnblogs.com/liuxt/p/6070709.html
Copyright © 2011-2022 走看看