One, obs_module introduction
obs-studio is developed based on modules. Each function is abstracted into an independent module and then encapsulated into a dynamic library. When obs-studio starts, it will
Traverse the dynamic library path, load all dynamic libraries to form a linked list, and call different plug-in functions based on different types when calling.
These module plug-ins must also be loaded when packaging the live streaming SDK by yourself.
The following is an analysis of the entire loading and calling process.
The obs_module structure is defined as follows:
/* modules */
struct obs_module {
char *mod_name;
const char *file;
char *bin_path;
char *data_path;
void *module;
bool loaded;
//加载模块时会首先调用这个load函数指针
//每个模块(插件plugin)都需要实现这个函数指针,即每个插件的obs_module_load函数
bool (*load)(void);
void (*unload)(void);
void (*post_load)(void);
void (*set_locale)(const char *locale);
void (*free_locale)(void);
uint32_t (*ver)(void);
void (*set_pointer)(obs_module_t *module);
const char *(*name)(void);
const char *(*description)(void);
const char *(*author)(void);
struct obs_module *next;//指向下一个模块
};
Two, module loading process
Under the specified path: Find the plug-in---"Initialize the function pointer of the plug-in---"Load the plug-in and adjust