libobs: Add post-load module callback

This allows the ability for certain types of modules (particularly
scripting-related modules) to initialize extra data when all other
modules have loaded.  Because front-ends may wish to have custom
handling for loading modules, the front-end must manually call
obs_post_load_modules after it has completed loading all plug-in
modules.

Closes jp9000/obs-studio#965
This commit is contained in:
SammyJames
2017-07-21 08:27:31 -07:00
committed by jp9000
parent c354551484
commit 4fd66d4d1e
5 changed files with 18 additions and 0 deletions
+8
View File
@@ -48,6 +48,7 @@ static int load_module_exports(struct obs_module *mod, const char *path)
/* optional exports */
mod->unload = os_dlsym(mod->module, "obs_module_unload");
mod->post_load = os_dlsym(mod->module, "obs_module_post_load");
mod->set_locale = os_dlsym(mod->module, "obs_module_set_locale");
mod->free_locale = os_dlsym(mod->module, "obs_module_free_locale");
mod->name = os_dlsym(mod->module, "obs_module_name");
@@ -254,6 +255,13 @@ void obs_load_all_modules(void)
profile_end(obs_load_all_modules_name);
}
void obs_post_load_modules(void)
{
for (obs_module_t *mod = obs->first_module; !!mod; mod = mod->next)
if (mod->post_load)
mod->post_load();
}
static inline void make_data_dir(struct dstr *parsed_data_dir,
const char *data_dir, const char *name)
{