mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: add a pipewire-pulse:list-modules message
It list all available module names, which you can then describe further. Make a little module_info iterator function for this.
This commit is contained in:
parent
ecac86b0ca
commit
5a894270e6
3 changed files with 25 additions and 6 deletions
|
|
@ -118,6 +118,16 @@ static int core_object_message_handler(struct client *client, struct pw_manager_
|
||||||
} else if (spa_streq(message, "pipewire-pulse:log-level")) {
|
} else if (spa_streq(message, "pipewire-pulse:log-level")) {
|
||||||
int res = pw_log_set_level_string(params);
|
int res = pw_log_set_level_string(params);
|
||||||
fprintf(response, "%d", res);
|
fprintf(response, "%d", res);
|
||||||
|
} else if (spa_streq(message, "pipewire-pulse:list-modules")) {
|
||||||
|
bool first = true;
|
||||||
|
const struct module_info *i = NULL;
|
||||||
|
fputc('[', response);
|
||||||
|
while ((i = module_info_next(client->impl, i)) != NULL) {
|
||||||
|
fprintf(response, "%s{\"name\":\"%s\"}",
|
||||||
|
first ? "" : ",\n", i->name);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
fputc(']', response);
|
||||||
} else if (spa_streq(message, "pipewire-pulse:describe-module")) {
|
} else if (spa_streq(message, "pipewire-pulse:describe-module")) {
|
||||||
const struct module_info *i = module_info_find(client->impl, params);
|
const struct module_info *i = module_info_find(client->impl, params);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,20 +293,28 @@ void audioinfo_to_properties(struct spa_audio_info_raw *info, struct pw_properti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info *module_info_find(struct impl *impl, const char *name)
|
const struct module_info *module_info_next(struct impl *impl, const struct module_info *info)
|
||||||
{
|
{
|
||||||
extern const struct module_info __start_pw_mod_pulse_modules[];
|
extern const struct module_info __start_pw_mod_pulse_modules[];
|
||||||
extern const struct module_info __stop_pw_mod_pulse_modules[];
|
extern const struct module_info __stop_pw_mod_pulse_modules[];
|
||||||
|
|
||||||
const struct module_info *info = __start_pw_mod_pulse_modules;
|
if (info == NULL)
|
||||||
|
info = __start_pw_mod_pulse_modules;
|
||||||
|
else
|
||||||
|
info++;
|
||||||
|
if (info == __stop_pw_mod_pulse_modules)
|
||||||
|
return NULL;
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
for (; info < __stop_pw_mod_pulse_modules; info++) {
|
const struct module_info *module_info_find(struct impl *impl, const char *name)
|
||||||
|
{
|
||||||
|
const struct module_info *info = NULL;
|
||||||
|
|
||||||
|
while ((info = module_info_next(impl, info)) != NULL) {
|
||||||
if (spa_streq(info->name, name))
|
if (spa_streq(info->name, name))
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_assert(info == __stop_pw_mod_pulse_modules);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ struct module {
|
||||||
#define module_emit_loaded(m,r) spa_hook_list_call(&m->listener_list, struct module_events, loaded, 0, r)
|
#define module_emit_loaded(m,r) spa_hook_list_call(&m->listener_list, struct module_events, loaded, 0, r)
|
||||||
#define module_emit_destroy(m) spa_hook_list_call(&(m)->listener_list, struct module_events, destroy, 0)
|
#define module_emit_destroy(m) spa_hook_list_call(&(m)->listener_list, struct module_events, destroy, 0)
|
||||||
|
|
||||||
|
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);
|
const struct module_info *module_info_find(struct impl *impl, const char *name);
|
||||||
|
|
||||||
struct module *module_create(struct impl *impl, const char *name, const char *args);
|
struct module *module_create(struct impl *impl, const char *name, const char *args);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue