mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: calculate event mask from facility and type
Make `client_queue_subscribe_event()` take the facility and type separately, and calculate the mask itself, so that the caller does not need to be concerned with that.
This commit is contained in:
parent
e3a7035e8f
commit
27b76ae686
6 changed files with 115 additions and 65 deletions
|
|
@ -153,21 +153,6 @@ static inline int err_to_res(int err)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
enum {
|
||||
SUBSCRIPTION_MASK_NULL = 0x0000U,
|
||||
SUBSCRIPTION_MASK_SINK = 0x0001U,
|
||||
SUBSCRIPTION_MASK_SOURCE = 0x0002U,
|
||||
SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
|
||||
SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
|
||||
SUBSCRIPTION_MASK_MODULE = 0x0010U,
|
||||
SUBSCRIPTION_MASK_CLIENT = 0x0020U,
|
||||
SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
|
||||
SUBSCRIPTION_MASK_SERVER = 0x0080U,
|
||||
SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
|
||||
SUBSCRIPTION_MASK_CARD = 0x0200U,
|
||||
SUBSCRIPTION_MASK_ALL = 0x02ffU
|
||||
};
|
||||
|
||||
enum {
|
||||
SUBSCRIPTION_EVENT_SINK = 0x0000U,
|
||||
SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
|
||||
|
|
@ -177,7 +162,7 @@ enum {
|
|||
SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
|
||||
SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
|
||||
SUBSCRIPTION_EVENT_SERVER = 0x0007U,
|
||||
SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
|
||||
// SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
|
||||
SUBSCRIPTION_EVENT_CARD = 0x0009U,
|
||||
SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
|
||||
|
||||
|
|
@ -187,6 +172,31 @@ enum {
|
|||
SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
|
||||
};
|
||||
|
||||
enum {
|
||||
SUBSCRIPTION_MASK_NULL = 0,
|
||||
SUBSCRIPTION_MASK_SINK = 1u << SUBSCRIPTION_EVENT_SINK,
|
||||
SUBSCRIPTION_MASK_SOURCE = 1u << SUBSCRIPTION_EVENT_SOURCE,
|
||||
SUBSCRIPTION_MASK_SINK_INPUT = 1u << SUBSCRIPTION_EVENT_SINK_INPUT,
|
||||
SUBSCRIPTION_MASK_SOURCE_OUTPUT = 1u << SUBSCRIPTION_EVENT_SOURCE_OUTPUT,
|
||||
SUBSCRIPTION_MASK_MODULE = 1u << SUBSCRIPTION_EVENT_MODULE,
|
||||
SUBSCRIPTION_MASK_CLIENT = 1u << SUBSCRIPTION_EVENT_CLIENT,
|
||||
SUBSCRIPTION_MASK_SAMPLE_CACHE = 1u << SUBSCRIPTION_EVENT_SAMPLE_CACHE,
|
||||
SUBSCRIPTION_MASK_SERVER = 1u << SUBSCRIPTION_EVENT_SERVER,
|
||||
// SUBSCRIPTION_MASK_AUTOLOAD = 1u << SUBSCRIPTION_EVENT_AUTOLOAD,
|
||||
SUBSCRIPTION_MASK_CARD = 1u << SUBSCRIPTION_EVENT_CARD,
|
||||
SUBSCRIPTION_MASK_ALL =
|
||||
SUBSCRIPTION_MASK_SINK
|
||||
| SUBSCRIPTION_MASK_SOURCE
|
||||
| SUBSCRIPTION_MASK_SINK_INPUT
|
||||
| SUBSCRIPTION_MASK_SOURCE_OUTPUT
|
||||
| SUBSCRIPTION_MASK_MODULE
|
||||
| SUBSCRIPTION_MASK_CLIENT
|
||||
| SUBSCRIPTION_MASK_SAMPLE_CACHE
|
||||
| SUBSCRIPTION_MASK_SERVER
|
||||
// | SUBSCRIPTION_MASK_AUTOLOAD
|
||||
| SUBSCRIPTION_MASK_CARD
|
||||
};
|
||||
|
||||
enum {
|
||||
STATE_INVALID = -1,
|
||||
STATE_RUNNING = 0,
|
||||
|
|
@ -236,6 +246,41 @@ enum {
|
|||
SOURCE_FLAT_VOLUME = 0x0080U,
|
||||
};
|
||||
|
||||
static inline const char *subscription_event_type_to_string(uint32_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case SUBSCRIPTION_EVENT_NEW:
|
||||
return "new";
|
||||
case SUBSCRIPTION_EVENT_CHANGE:
|
||||
return "change";
|
||||
case SUBSCRIPTION_EVENT_REMOVE:
|
||||
return "remove";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline const char *subscription_event_facility_to_string(uint32_t facility)
|
||||
{
|
||||
static const char * const strings[] = {
|
||||
[SUBSCRIPTION_EVENT_SINK] = "sink",
|
||||
[SUBSCRIPTION_EVENT_SOURCE] = "source",
|
||||
[SUBSCRIPTION_EVENT_SINK_INPUT] = "sink-input",
|
||||
[SUBSCRIPTION_EVENT_SOURCE_OUTPUT] = "source-output",
|
||||
[SUBSCRIPTION_EVENT_MODULE] = "module",
|
||||
[SUBSCRIPTION_EVENT_CLIENT] = "client",
|
||||
[SUBSCRIPTION_EVENT_SAMPLE_CACHE] = "sample-cache",
|
||||
[SUBSCRIPTION_EVENT_SERVER] = "server",
|
||||
// [SUBSCRIPTION_EVENT_AUTOLOAD] = "autoload",
|
||||
[SUBSCRIPTION_EVENT_CARD] = "card",
|
||||
};
|
||||
|
||||
if (facility >= SPA_N_ELEMENTS(strings))
|
||||
return NULL;
|
||||
|
||||
return strings[facility];
|
||||
}
|
||||
|
||||
static const char * const port_types[] = {
|
||||
"unknown",
|
||||
"aux",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue