From 99d10c2607fe942447b5939c1e0a6be4819c887d Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Sat, 12 Dec 2020 13:13:01 -0600 Subject: [PATCH] libobs: Add function to get module lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a function find module library. Co-authored-by: Stéphane Lepin --- docs/sphinx/reference-modules.rst | 9 +++++++++ libobs/obs-module.c | 5 +++++ libobs/obs.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/docs/sphinx/reference-modules.rst b/docs/sphinx/reference-modules.rst index f3ccddd46..9dc19bfb5 100644 --- a/docs/sphinx/reference-modules.rst +++ b/docs/sphinx/reference-modules.rst @@ -308,3 +308,12 @@ plugin modules. :param module: The module associated with the path :param file: The file to get a path to :return: Path string, or NULL if not found. Use bfree to free string + +--------------------- + +.. function:: void *obs_get_module_lib(obs_module_t *module) + + Returns library file of specified module. + + :param module: The module where to find library file. + :return: Pointer to module library. diff --git a/libobs/obs-module.c b/libobs/obs-module.c index e64224ae0..e1df71759 100644 --- a/libobs/obs-module.c +++ b/libobs/obs-module.c @@ -223,6 +223,11 @@ obs_module_t *obs_get_module(const char *name) return NULL; } +void *obs_get_module_lib(obs_module_t *module) +{ + return module ? module->module : NULL; +} + char *obs_find_module_file(obs_module_t *module, const char *file) { struct dstr output = {0}; diff --git a/libobs/obs.h b/libobs/obs.h index 6ad9712f3..29db567d4 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -429,6 +429,9 @@ EXPORT bool obs_init_module(obs_module_t *module); /** Returns a module based upon its name, or NULL if not found */ EXPORT obs_module_t *obs_get_module(const char *name); +/** Gets library of module */ +EXPORT void *obs_get_module_lib(obs_module_t *module); + /** Returns locale text from a specific module */ EXPORT bool obs_module_get_locale_string(const obs_module_t *mod, const char *lookup_string,