summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PROTOCOL8
-rw-r--r--src/pulse/introspect.c7
-rw-r--r--src/pulse/introspect.h1
-rw-r--r--src/pulse/proplist.h4
-rw-r--r--src/pulsecore/cli-command.c1
-rw-r--r--src/pulsecore/cli-text.c6
-rw-r--r--src/pulsecore/module.c24
-rw-r--r--src/pulsecore/module.h5
-rw-r--r--src/pulsecore/protocol-native.c14
9 files changed, 61 insertions, 9 deletions
diff --git a/PROTOCOL b/PROTOCOL
index 37f289a5..8c5937b3 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -154,7 +154,6 @@ PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR at the end:
early_requests (bool)
-
### v15, implemented by >= 0.9.15
PA_COMMAND_CREATE_PLAYBACK_STREAM
@@ -163,4 +162,9 @@ PA_COMMAND_CREATE_PLAYBACK_STREAM
PA_COMMAND_CREATE_PLAYBACK_STREAM, PA_COMMAND_CREATE_RECORD_STREAM:
- bool dont_inhibit_auto_suspend ate the end
+ bool dont_inhibit_auto_suspend at the end
+
+PA_COMMAND_GET_MODULE_INFO_LIST
+
+ remove bool auto_unload
+ add proplist at the end
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index bdc50e29..e7fa6d76 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -480,13 +480,16 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
while (!pa_tagstruct_eof(t)) {
pa_module_info i;
pa_bool_t auto_unload = FALSE;
+
memset(&i, 0, sizeof(i));
+ i.proplist = pa_proplist_new();
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_gets(t, &i.argument) < 0 ||
pa_tagstruct_getu32(t, &i.n_used) < 0 ||
- pa_tagstruct_get_boolean(t, &auto_unload) < 0) {
+ (o->context->version < 15 && pa_tagstruct_get_boolean(t, &auto_unload) < 0) ||
+ (o->context->version >= 15 && pa_tagstruct_get_proplist(t, i.proplist) < 0)) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -497,6 +500,8 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
pa_module_info_cb_t cb = (pa_module_info_cb_t) o->callback;
cb(o->context, &i, 0, o->userdata);
}
+
+ pa_proplist_free(i.proplist);
}
}
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index ae9bd5bc..428826e6 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -333,6 +333,7 @@ typedef struct pa_module_info {
/** \cond fulldocs */
int auto_unload; /**< \deprecated Non-zero if this is an autoloaded module */
/** \endcond */
+ pa_proplist *proplist; /**< Property list \since 0.9.15 */
} pa_module_info;
/** Callback prototype for pa_context_get_module_info() and firends*/
diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h
index 8f44df27..529871f8 100644
--- a/src/pulse/proplist.h
+++ b/src/pulse/proplist.h
@@ -128,6 +128,10 @@ PA_C_DECL_BEGIN
#define PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE "device.buffering.fragment_size"
#define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name"
#define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description"
+#define PA_PROP_MODULE_AUTHOR "module.author"
+#define PA_PROP_MODULE_DESCRIPTION "module.description"
+#define PA_PROP_MODULE_USAGE "module.usage"
+#define PA_PROP_MODULE_VERSION "module.version"
/** A property list object. Basically a dictionary with UTF-8 strings
* as keys and arbitrary data as values. \since 0.9.11 */
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 8f5d9bdd..f810579e 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -51,6 +51,7 @@
#include <pulsecore/shared.h>
#include <pulsecore/core-util.h>
#include <pulsecore/core-error.h>
+#include <pulsecore/modinfo.h>
#include "cli-command.h"
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 5c3d3af6..cbd36e2a 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -54,6 +54,8 @@ char *pa_module_list_to_string(pa_core *c) {
pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
+ char *t;
+
pa_strbuf_printf(s, " index: %u\n"
"\tname: <%s>\n"
"\targument: <%s>\n"
@@ -64,6 +66,10 @@ char *pa_module_list_to_string(pa_core *c) {
pa_strempty(m->argument),
pa_module_get_n_used(m),
pa_yes_no(m->load_once));
+
+ t = pa_proplist_to_string_sep(m->proplist, "\n\t\t");
+ pa_strbuf_printf(s, "\tproperties:\n\t\t%s\n", t);
+ pa_xfree(t);
}
return pa_strbuf_tostring_free(s);
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 0a8c8f57..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);
diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
index 5c49bd2d..6ab43dcf 100644
--- a/src/pulsecore/module.h
+++ b/src/pulsecore/module.h
@@ -27,8 +27,9 @@
typedef struct pa_module pa_module;
+#include <pulse/proplist.h>
+
#include <pulsecore/core.h>
-#include <pulsecore/modinfo.h>
struct pa_module {
pa_core *core;
@@ -45,6 +46,8 @@ struct pa_module {
pa_bool_t load_once:1;
pa_bool_t unload_requested:1;
+
+ pa_proplist *proplist;
};
pa_module* pa_module_load(pa_core *c, const char *name, const char*argument);
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 54122679..eb555050 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2728,10 +2728,9 @@ static void client_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_c
if (c->version >= 13)
pa_tagstruct_put_proplist(t, client->proplist);
-
}
-static void module_fill_tagstruct(pa_tagstruct *t, pa_module *module) {
+static void module_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_module *module) {
pa_assert(t);
pa_assert(module);
@@ -2739,7 +2738,12 @@ static void module_fill_tagstruct(pa_tagstruct *t, pa_module *module) {
pa_tagstruct_puts(t, module->name);
pa_tagstruct_puts(t, module->argument);
pa_tagstruct_putu32(t, (uint32_t) pa_module_get_n_used(module));
- pa_tagstruct_put_boolean(t, FALSE); /* autoload is obsolete */
+
+ if (c->version < 15)
+ pa_tagstruct_put_boolean(t, FALSE); /* autoload is obsolete */
+
+ if (c->version >= 15)
+ pa_tagstruct_put_proplist(t, module->proplist);
}
static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sink_input *s) {
@@ -2891,7 +2895,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
else if (client)
client_fill_tagstruct(c, reply, client);
else if (module)
- module_fill_tagstruct(reply, module);
+ module_fill_tagstruct(c, reply, module);
else if (si)
sink_input_fill_tagstruct(c, reply, si);
else if (so)
@@ -2946,7 +2950,7 @@ static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t t
else if (command == PA_COMMAND_GET_CLIENT_INFO_LIST)
client_fill_tagstruct(c, reply, p);
else if (command == PA_COMMAND_GET_MODULE_INFO_LIST)
- module_fill_tagstruct(reply, p);
+ module_fill_tagstruct(c, reply, p);
else if (command == PA_COMMAND_GET_SINK_INPUT_INFO_LIST)
sink_input_fill_tagstruct(c, reply, p);
else if (command == PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST)