mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-30 13:14:16 -04:00
pulse-server: actually print properties of module
When inspecting the loaded modules, actually list the properties that were used when loading the module instead of the informational generic ones from the info. Pulsaudio also does not list the Usage properties when listing modules.
This commit is contained in:
parent
9bcbd7b586
commit
d97a9bf44b
4 changed files with 41 additions and 22 deletions
|
|
@ -293,27 +293,9 @@ static int core_object_message_handler(struct client *client, struct pw_manager_
|
|||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_AUTHOR)))
|
||||
fprintf(response, "Author: %s\n", s);
|
||||
if (i->valid_args) {
|
||||
const struct module_args *a;
|
||||
fprintf(response, "Usage:");
|
||||
for (a = i->valid_args; a->key; a++) {
|
||||
fprintf(response, " %s=<%s", a->key, a->type);
|
||||
if (a->def)
|
||||
fprintf(response, ", default %s", a->def);
|
||||
fprintf(response, ", %s", a->description);
|
||||
if (a->vals) {
|
||||
const char **v;
|
||||
fprintf(response, " [");
|
||||
for (v = a->vals; *v; v++)
|
||||
fprintf(response, "%s%s", v == a->vals ? "" : "|", *v);
|
||||
fprintf(response, "]");
|
||||
}
|
||||
if (a->flags & MODULE_ARG_MANDATORY)
|
||||
fprintf(response, " (mandatory)");
|
||||
if (a->flags & MODULE_ARG_ENOTIMPL)
|
||||
fprintf(response, " (not implemented)");
|
||||
fprintf(response, ">");
|
||||
}
|
||||
fprintf(response, "\n");
|
||||
char *usage = module_info_usage(i);
|
||||
fprintf(response, "Usage: %s\n", usage);
|
||||
free(usage);
|
||||
}
|
||||
fprintf(response, "Load Once: %s\n", i->load_once ? "Yes": "No");
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_DEPRECATED)))
|
||||
|
|
|
|||
|
|
@ -376,6 +376,8 @@ struct module *module_create(struct impl *impl, const char *name, const char *ar
|
|||
errno = -res;
|
||||
goto error_free;
|
||||
}
|
||||
if (info->properties)
|
||||
pw_properties_update(module->props, info->properties);
|
||||
|
||||
if ((res = module->info->prepare(module)) < 0) {
|
||||
errno = -res;
|
||||
|
|
@ -414,3 +416,37 @@ struct module *module_lookup(struct impl *impl, uint32_t index, const char *name
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *module_info_usage(const struct module_info *i)
|
||||
{
|
||||
const struct module_args *a;
|
||||
FILE *f;
|
||||
size_t size;
|
||||
char *res;
|
||||
|
||||
f = open_memstream(&res, &size);
|
||||
if (f == NULL)
|
||||
return NULL;
|
||||
|
||||
for (a = i->valid_args; a->key; a++) {
|
||||
fprintf(f, "%s=<%s", a->key, a->type);
|
||||
if (a->def)
|
||||
fprintf(f, ", default %s", a->def);
|
||||
fprintf(f, ", %s", a->description);
|
||||
if (a->vals) {
|
||||
const char **v;
|
||||
fprintf(f, " [");
|
||||
for (v = a->vals; *v; v++)
|
||||
fprintf(f, "%s%s", v == a->vals ? "" : "|", *v);
|
||||
fprintf(f, "]");
|
||||
}
|
||||
if (a->flags & MODULE_ARG_MANDATORY)
|
||||
fprintf(f, " (mandatory)");
|
||||
if (a->flags & MODULE_ARG_ENOTIMPL)
|
||||
fprintf(f, " (not implemented)");
|
||||
fprintf(f, ">");
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ struct module {
|
|||
|
||||
const struct module_info *module_info_next(struct impl *impl, const struct module_info *info);
|
||||
const struct module_info *module_info_find(struct impl *impl, const char *name);
|
||||
char *module_info_usage(const struct module_info *info);
|
||||
|
||||
struct module *module_create(struct impl *impl, const char *name, const char *args);
|
||||
void module_free(struct module *module);
|
||||
|
|
|
|||
|
|
@ -3567,7 +3567,7 @@ static int fill_ext_module_info(struct client *client, struct message *m,
|
|||
}
|
||||
if (client->version >= 15) {
|
||||
message_put(m,
|
||||
TAG_PROPLIST, module->info->properties,
|
||||
TAG_PROPLIST, module->props,
|
||||
TAG_INVALID);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue