mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: implement describe-module with core message
Implement the old pacmd describe-module command with a core message: pactl send-message /core pipewire-pulse:describe-module module-echo-cancel
This commit is contained in:
parent
b3ff293263
commit
a3ccbd00b4
4 changed files with 30 additions and 2 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "collect.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "module.h"
|
||||
#include "message-handler.h"
|
||||
|
||||
static int bluez_card_object_message_handler(struct client *client, struct pw_manager_object *o, const char *message, const char *params, FILE *response)
|
||||
|
|
@ -117,6 +118,30 @@ static int core_object_message_handler(struct client *client, struct pw_manager_
|
|||
} else if (spa_streq(message, "pipewire-pulse:log-level")) {
|
||||
int res = pw_log_set_level_string(params);
|
||||
fprintf(response, "%d", res);
|
||||
} else if (spa_streq(message, "pipewire-pulse:describe-module")) {
|
||||
const struct module_info *i = module_info_find(client->impl, params);
|
||||
|
||||
if (i != NULL) {
|
||||
fprintf(response, "Name: %s\n", i->name);
|
||||
if (i->properties == NULL) {
|
||||
fprintf(response, "No module information available\n");
|
||||
} else {
|
||||
const char *s;
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_VERSION)))
|
||||
fprintf(response, "Version: %s\n", s);
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_DESCRIPTION)))
|
||||
fprintf(response, "Description: %s\n", s);
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_AUTHOR)))
|
||||
fprintf(response, "Author: %s\n", s);
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_USAGE)))
|
||||
fprintf(response, "Usage: %s\n", s);
|
||||
fprintf(response, "Load Once: %s\n", i->load_once ? "Yes": "No");
|
||||
if ((s = spa_dict_lookup(i->properties, PW_KEY_MODULE_DEPRECATED)))
|
||||
fprintf(response, "Warning, deprecated: %s\n", s);
|
||||
}
|
||||
} else {
|
||||
fprintf(response, "Failed to open module.\n");
|
||||
}
|
||||
} else {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ void audioinfo_to_properties(struct spa_audio_info_raw *info, struct pw_properti
|
|||
}
|
||||
}
|
||||
|
||||
static const struct module_info *find_module_info(const char *name)
|
||||
const struct module_info *module_info_find(struct impl *impl, const char *name)
|
||||
{
|
||||
extern const struct module_info __start_pw_mod_pulse_modules[];
|
||||
extern const struct module_info __stop_pw_mod_pulse_modules[];
|
||||
|
|
@ -323,7 +323,7 @@ struct module *module_create(struct impl *impl, const char *name, const char *ar
|
|||
struct module *module;
|
||||
int res;
|
||||
|
||||
info = find_module_info(name);
|
||||
info = module_info_find(impl, name);
|
||||
if (info == NULL) {
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ struct module {
|
|||
#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)
|
||||
|
||||
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);
|
||||
void module_free(struct module *module);
|
||||
int module_load(struct module *module);
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ extern "C" {
|
|||
#define PW_KEY_MODULE_USAGE "module.usage" /**< a human readable usage description of
|
||||
* the module's arguments. */
|
||||
#define PW_KEY_MODULE_VERSION "module.version" /**< a version string for the module. */
|
||||
#define PW_KEY_MODULE_DEPRECATED "module.deprecated" /**< the module is deprecated with this message */
|
||||
|
||||
/** Factory properties */
|
||||
#define PW_KEY_FACTORY_ID "factory.id" /**< the factory id */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue