mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-21 12:49:40 +08:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user