Browse Source

Add API functions to get information about modules

jp9000 11 years ago
parent
commit
e87ed914f8
2 changed files with 32 additions and 0 deletions
  1. 20 0
      libobs/obs-module.c
  2. 12 0
      libobs/obs.h

+ 20 - 0
libobs/obs-module.c

@@ -106,6 +106,26 @@ bool obs_init_module(obs_module_t module)
 	return module->loaded;
 	return module->loaded;
 }
 }
 
 
+const char *obs_get_module_file_name(obs_module_t module)
+{
+	return module ? module->file : NULL;
+}
+
+const char *obs_get_module_name(obs_module_t module)
+{
+	return (module && module->name) ? module->name() : NULL;
+}
+
+const char *obs_get_module_author(obs_module_t module)
+{
+	return (module && module->author) ? module->author() : NULL;
+}
+
+const char *obs_get_module_description(obs_module_t module)
+{
+	return (module && module->description) ? module->description() : NULL;
+}
+
 char *obs_find_module_file(obs_module_t module, const char *file)
 char *obs_find_module_file(obs_module_t module, const char *file)
 {
 {
 	struct dstr output = {0};
 	struct dstr output = {0};

+ 12 - 0
libobs/obs.h

@@ -289,6 +289,18 @@ EXPORT int obs_open_module(obs_module_t *module, const char *path,
  */
  */
 EXPORT bool obs_init_module(obs_module_t module);
 EXPORT bool obs_init_module(obs_module_t module);
 
 
+/** Returns the module file name */
+EXPORT const char *obs_get_module_file_name(obs_module_t module);
+
+/** Returns the module full name */
+EXPORT const char *obs_get_module_name(obs_module_t module);
+
+/** Returns the module author(s) */
+EXPORT const char *obs_get_module_author(obs_module_t module);
+
+/** Returns the module description */
+EXPORT const char *obs_get_module_description(obs_module_t module);
+
 /**
 /**
  * Adds a module search path to be used with obs_find_modules.  If the search
  * Adds a module search path to be used with obs_find_modules.  If the search
  * path strings contain %module%, that text will be replaced with the module
  * path strings contain %module%, that text will be replaced with the module