summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/module.c')
-rw-r--r--src/pulsecore/module.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index c4dcb478..d470bb0b 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -33,12 +33,14 @@
#include <pulse/timeval.h>
#include <pulse/xmalloc.h>
+#include <pulse/proplist.h>
#include <pulsecore/core-subscribe.h>
#include <pulsecore/log.h>
#include <pulsecore/core-util.h>
#include <pulsecore/macro.h>
#include <pulsecore/ltdl-helper.h>
+#include <pulsecore/modinfo.h>
#include "module.h"
@@ -50,6 +52,7 @@
pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_module *m = NULL;
pa_bool_t (*load_once)(void);
+ pa_modinfo *mi;
pa_assert(c);
pa_assert(name);
@@ -61,6 +64,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
m->name = pa_xstrdup(name);
m->argument = pa_xstrdup(argument);
m->load_once = FALSE;
+ m->proplist = pa_proplist_new();
if (!(m->dl = lt_dlopenext(name))) {
pa_log("Failed to open module \"%s\": %s", name, lt_dlerror());
@@ -111,11 +115,28 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index);
+ if ((mi = pa_modinfo_get_by_handle(m->dl, name))) {
+
+ if (mi->author && !pa_proplist_contains(m->proplist, PA_PROP_MODULE_AUTHOR))
+ pa_proplist_sets(m->proplist, PA_PROP_MODULE_AUTHOR, mi->author);
+
+ if (mi->description && !pa_proplist_contains(m->proplist, PA_PROP_MODULE_DESCRIPTION))
+ pa_proplist_sets(m->proplist, PA_PROP_MODULE_DESCRIPTION, mi->description);
+
+ if (mi->version && !pa_proplist_contains(m->proplist, PA_PROP_MODULE_VERSION))
+ pa_proplist_sets(m->proplist, PA_PROP_MODULE_VERSION, mi->version);
+
+ pa_modinfo_free(mi);
+ }
+
return m;
fail:
if (m) {
+ if (m->proplist)
+ pa_proplist_free(m->proplist);
+
pa_xfree(m->argument);
pa_xfree(m->name);
@@ -137,6 +158,9 @@ static void pa_module_free(pa_module *m) {
if (m->done)
m->done(m);
+ if (m->proplist)
+ pa_proplist_free(m->proplist);
+
lt_dlclose(m->dl);
pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
@@ -234,12 +258,6 @@ void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force
pa_module_unload_request(m, force);
}
-pa_modinfo *pa_module_get_info(pa_module *m) {
- pa_assert(m);
-
- return pa_modinfo_get_by_handle(m->dl, m->name);
-}
-
int pa_module_get_n_used(pa_module*m) {
pa_assert(m);