pulse-server: module does not depend on client

We don't need to pass the client to the module create and load
functions, they can work without a client.

The only place the client is used is to access the properties to make a
new connection to pipewire. This is also however not a good idea, we
should simply use the defaults used by the context or else a client
could set strange properties like remote.name etc for these internal
connections.

Also removing the dependency of the client will make it possible to load
modules from the startup script or other modules later.
This commit is contained in:
Wim Taymans 2022-12-06 18:26:29 +01:00
parent 80cb1d2566
commit 865d41b986
27 changed files with 40 additions and 48 deletions

View file

@ -29,7 +29,6 @@
#include <spa/param/audio/raw.h>
#include <spa/utils/hook.h>
#include "client.h"
#include "internal.h"
struct module;
@ -41,7 +40,7 @@ struct module_info {
unsigned int load_once:1;
int (*prepare) (struct module *module);
int (*load) (struct client *client, struct module *module);
int (*load) (struct module *module);
int (*unload) (struct module *module);
const struct spa_dict *properties;
@ -78,9 +77,9 @@ 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)
struct module *module_create(struct client *client, const char *name, const char *args);
struct module *module_create(struct impl *impl, const char *name, const char *args);
void module_free(struct module *module);
int module_load(struct client *client, struct module *module);
int module_load(struct module *module);
int module_unload(struct module *module);
void module_schedule_unload(struct module *module);