pulse-server: split out message-handler

Part of !776.
This commit is contained in:
Barnabás Pőcze 2021-06-19 00:38:56 +02:00
parent c9f5deb81d
commit e966b1d6f2
4 changed files with 29 additions and 6 deletions

View file

@ -141,6 +141,7 @@ pipewire_module_protocol_pulse_sources = [
'module-protocol-pulse/manager.c', 'module-protocol-pulse/manager.c',
'module-protocol-pulse/media-roles.c', 'module-protocol-pulse/media-roles.c',
'module-protocol-pulse/message.c', 'module-protocol-pulse/message.c',
'module-protocol-pulse/message-handler.c',
'module-protocol-pulse/module.c', 'module-protocol-pulse/module.c',
'module-protocol-pulse/operation.c', 'module-protocol-pulse/operation.c',
'module-protocol-pulse/pending-sample.c', 'module-protocol-pulse/pending-sample.c',

View file

@ -1,11 +1,27 @@
#define NAME "pulse-server"
#include <stdint.h>
#include <regex.h>
#include <spa/param/props.h>
#include <spa/pod/builder.h>
#include <spa/pod/pod.h>
#include <spa/utils/defs.h>
#include <spa/utils/string.h> #include <spa/utils/string.h>
#include <pipewire/pipewire.h>
#include "collect.h"
#include "manager.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, char **response) static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, char **response)
{ {
struct transport_codec_info codecs[64]; struct transport_codec_info codecs[64];
uint32_t n_codecs, active; uint32_t n_codecs, active;
pw_log_debug(NAME "bluez-card %p object message:'%s' params:'%s'", o, message, params); pw_log_debug(NAME ": bluez-card %p object message:'%s' params:'%s'", o, message, params);
n_codecs = collect_transport_codec_info(o, codecs, SPA_N_ELEMENTS(codecs), &active); n_codecs = collect_transport_codec_info(o, codecs, SPA_N_ELEMENTS(codecs), &active);
@ -79,7 +95,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
static int core_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, char **response) static int core_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, char **response)
{ {
pw_log_debug(NAME "core %p object message:'%s' params:'%s'", o, message, params); pw_log_debug(NAME ": core %p object message:'%s' params:'%s'", o, message, params);
if (spa_streq(message, "list-handlers")) { if (spa_streq(message, "list-handlers")) {
FILE *r; FILE *r;
@ -101,7 +117,7 @@ static int core_object_message_handler(struct pw_manager *m, struct pw_manager_o
return -ENOSYS; return -ENOSYS;
} }
static void register_object_message_handlers(struct pw_manager_object *o) void register_object_message_handlers(struct pw_manager_object *o)
{ {
const char *str; const char *str;

View file

@ -0,0 +1,8 @@
#ifndef PULSE_SERVER_MESSAGE_HANDLER_H
#define PULSE_SERVER_MESSAGE_HANDLER_H
struct pw_manager_object;
void register_object_message_handlers(struct pw_manager_object *o);
#endif /* PULSE_SERVER_MESSAGE_HANDLER_H */

View file

@ -34,7 +34,6 @@
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <fcntl.h> #include <fcntl.h>
#include <regex.h>
#include <pipewire/log.h> #include <pipewire/log.h>
@ -67,6 +66,7 @@
#include "format.h" #include "format.h"
#include "internal.h" #include "internal.h"
#include "message.h" #include "message.h"
#include "message-handler.h"
#include "module.h" #include "module.h"
#include "operation.h" #include "operation.h"
#include "pending-sample.h" #include "pending-sample.h"
@ -101,8 +101,6 @@ struct latency_offset_data {
unsigned int initialized:1; unsigned int initialized:1;
}; };
#include "message-handler.c"
static struct sample *find_sample(struct impl *impl, uint32_t idx, const char *name) static struct sample *find_sample(struct impl *impl, uint32_t idx, const char *name)
{ {
union pw_map_item *item; union pw_map_item *item;