mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: pass the client to message handlers
Instead of passing the pw_manager object, pass the client object to the message handler. The client's manager can still be accessed via `client->manager`. Furthermore, message handlers now have access to `client->impl`.
This commit is contained in:
parent
4e69507b18
commit
e8f17814ba
3 changed files with 7 additions and 5 deletions
|
|
@ -16,6 +16,7 @@ extern "C" {
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
struct client;
|
||||||
struct pw_manager_object;
|
struct pw_manager_object;
|
||||||
|
|
||||||
struct pw_manager_events {
|
struct pw_manager_events {
|
||||||
|
|
@ -70,7 +71,7 @@ struct pw_manager_object {
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
struct pw_proxy *proxy;
|
struct pw_proxy *proxy;
|
||||||
char *message_object_path;
|
char *message_object_path;
|
||||||
int (*message_handler)(struct pw_manager *m, struct pw_manager_object *o,
|
int (*message_handler)(struct client *client, struct pw_manager_object *o,
|
||||||
const char *message, const char *params, FILE *response);
|
const char *message, const char *params, FILE *response);
|
||||||
|
|
||||||
void *info;
|
void *info;
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,13 @@
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
#include "client.h"
|
||||||
#include "collect.h"
|
#include "collect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
#include "message-handler.h"
|
#include "message-handler.h"
|
||||||
|
|
||||||
static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, FILE *response)
|
static int bluez_card_object_message_handler(struct client *client, struct pw_manager_object *o, const char *message, const char *params, FILE *response)
|
||||||
{
|
{
|
||||||
struct transport_codec_info codecs[64];
|
struct transport_codec_info codecs[64];
|
||||||
uint32_t n_codecs, active;
|
uint32_t n_codecs, active;
|
||||||
|
|
@ -86,7 +87,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int core_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, FILE *response)
|
static int core_object_message_handler(struct client *client, struct pw_manager_object *o, const char *message, const char *params, FILE *response)
|
||||||
{
|
{
|
||||||
pw_log_debug(": core %p object message:'%s' params:'%s'", o, message, params);
|
pw_log_debug(": core %p object message:'%s' params:'%s'", o, message, params);
|
||||||
|
|
||||||
|
|
@ -94,7 +95,7 @@ static int core_object_message_handler(struct pw_manager *m, struct pw_manager_o
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
fputc('[', response);
|
fputc('[', response);
|
||||||
spa_list_for_each(o, &m->object_list, link) {
|
spa_list_for_each(o, &client->manager->object_list, link) {
|
||||||
if (o->message_object_path) {
|
if (o->message_object_path) {
|
||||||
fprintf(response, "%s{\"name\":\"%s\",\"description\":\"%s\"}",
|
fprintf(response, "%s{\"name\":\"%s\",\"description\":\"%s\"}",
|
||||||
first ? "" : ",",
|
first ? "" : ",",
|
||||||
|
|
|
||||||
|
|
@ -5141,7 +5141,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3
|
||||||
if (response == NULL)
|
if (response == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
res = o->message_handler(manager, o, message, params, response);
|
res = o->message_handler(client, o, message, params, response);
|
||||||
|
|
||||||
if (fclose(response))
|
if (fclose(response))
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue