pulse-server: client: add 'disconnect' event

Have the clients emit a 'disconnect' event when they are
being disconnected.
This commit is contained in:
Barnabás Pőcze 2021-11-13 14:14:19 +01:00 committed by Wim Taymans
parent 2d4febaba1
commit 043934655a
2 changed files with 22 additions and 0 deletions

View file

@ -100,6 +100,15 @@ struct client {
struct pw_manager_object *prev_default_sink;
struct pw_manager_object *prev_default_source;
struct spa_hook_list listener_list;
};
struct client_events {
#define VERSION_CLIENT_EVENTS 0
uint32_t version;
void (*disconnect) (void *data);
};
struct client *client_new(struct server *server);
@ -116,4 +125,10 @@ static inline void client_unref(struct client *client)
client_free(client);
}
static inline void client_add_listener(struct client *client, struct spa_hook *listener,
const struct client_events *events, void *data)
{
spa_hook_list_append(&client->listener_list, listener, events, data);
}
#endif /* PULSER_SERVER_CLIENT_H */