Make interface types a string

This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
This commit is contained in:
Wim Taymans 2019-12-19 13:15:10 +01:00
parent 9657486a81
commit f391353c7f
123 changed files with 791 additions and 1251 deletions

View file

@ -54,8 +54,8 @@ struct global {
struct remote_data *rd;
uint32_t id;
uint32_t permissions;
uint32_t type;
uint32_t version;
char *type;
struct pw_proxy *proxy;
bool info_pending;
struct pw_properties *properties;
@ -287,18 +287,15 @@ static int print_global(void *obj, void *data)
{
struct global *global = obj;
const char *filter = data;
const char *type_name = NULL;
if (global == NULL)
return 0;
type_name = spa_debug_type_find_name(pw_type_info(), global->type);
if (filter && !strstr(type_name, filter))
if (filter && !strstr(global->type, filter))
return 0;
fprintf(stdout, "\tid %d, type %s/%d\n", global->id,
type_name,
global->version);
global->type, global->version);
if (global->properties)
print_properties(&global->properties->dict, ' ', false);
@ -306,7 +303,7 @@ static int print_global(void *obj, void *data)
}
static void registry_event_global(void *data, uint32_t id,
uint32_t permissions, uint32_t type, uint32_t version,
uint32_t permissions, const char *type, uint32_t version,
const struct spa_dict *props)
{
struct remote_data *rd = data;
@ -317,7 +314,7 @@ static void registry_event_global(void *data, uint32_t id,
global->rd = rd;
global->id = id;
global->permissions = permissions;
global->type = type;
global->type = strdup(type);
global->version = version;
global->properties = props ? pw_properties_new_dict(props) : NULL;
@ -340,6 +337,7 @@ static int destroy_global(void *obj, void *data)
pw_map_remove(&global->rd->globals, global->id);
if (global->properties)
pw_properties_free(global->properties);
free(global->type);
free(global);
return 0;
}
@ -528,9 +526,7 @@ static void info_global(struct proxy_data *pd)
fprintf(stdout, "\tpermissions: %c%c%c\n", global->permissions & PW_PERM_R ? 'r' : '-',
global->permissions & PW_PERM_W ? 'w' : '-',
global->permissions & PW_PERM_X ? 'x' : '-');
fprintf(stdout, "\ttype: %s/%d\n",
spa_debug_type_find_name(pw_type_info(), global->type),
pd->global->version);
fprintf(stdout, "\ttype: %s/%d\n", global->type, global->version);
}
static void info_core(struct proxy_data *pd)
@ -596,8 +592,7 @@ static void info_factory(struct proxy_data *pd)
info_global(pd);
fprintf(stdout, "\tname: \"%s\"\n", info->name);
fprintf(stdout, "\tobject-type: %s/%d\n",
spa_debug_type_find_name(pw_type_info(), info->type), info->version);
fprintf(stdout, "\tobject-type: %s/%d\n", info->type, info->version);
print_properties(info->props, MARK_CHANGE(PW_FACTORY_CHANGE_MASK_PROPS), true);
info->change_mask = 0;
}
@ -1089,75 +1084,63 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
struct proxy_data *pd;
struct pw_proxy *proxy;
switch (global->type) {
case PW_TYPE_INTERFACE_Core:
if (strcmp(global->type, PW_TYPE_INTERFACE_Core) == 0) {
events = &core_events;
client_version = PW_VERSION_CORE;
destroy = (pw_destroy_t) pw_core_info_free;
info_func = info_core;
break;
case PW_TYPE_INTERFACE_Module:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Module) == 0) {
events = &module_events;
client_version = PW_VERSION_MODULE;
destroy = (pw_destroy_t) pw_module_info_free;
info_func = info_module;
break;
case PW_TYPE_INTERFACE_Device:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Device) == 0) {
events = &device_events;
client_version = PW_VERSION_DEVICE;
destroy = (pw_destroy_t) pw_device_info_free;
info_func = info_device;
break;
case PW_TYPE_INTERFACE_Node:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Node) == 0) {
events = &node_events;
client_version = PW_VERSION_NODE;
destroy = (pw_destroy_t) pw_node_info_free;
info_func = info_node;
break;
case PW_TYPE_INTERFACE_Port:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Port) == 0) {
events = &port_events;
client_version = PW_VERSION_PORT;
destroy = (pw_destroy_t) pw_port_info_free;
info_func = info_port;
break;
case PW_TYPE_INTERFACE_Factory:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Factory) == 0) {
events = &factory_events;
client_version = PW_VERSION_FACTORY;
destroy = (pw_destroy_t) pw_factory_info_free;
info_func = info_factory;
break;
case PW_TYPE_INTERFACE_Client:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Client) == 0) {
events = &client_events;
client_version = PW_VERSION_CLIENT;
destroy = (pw_destroy_t) pw_client_info_free;
info_func = info_client;
break;
case PW_TYPE_INTERFACE_Link:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Link) == 0) {
events = &link_events;
client_version = PW_VERSION_LINK;
destroy = (pw_destroy_t) pw_link_info_free;
info_func = info_link;
break;
case PW_TYPE_INTERFACE_Session:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Session) == 0) {
events = &session_events;
client_version = PW_VERSION_SESSION;
destroy = (pw_destroy_t) session_info_free;
info_func = info_session;
break;
case PW_TYPE_INTERFACE_Endpoint:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
events = &endpoint_events;
client_version = PW_VERSION_ENDPOINT;
destroy = (pw_destroy_t) endpoint_info_free;
info_func = info_endpoint;
break;
case PW_TYPE_INTERFACE_EndpointStream:
} else if (strcmp(global->type, PW_TYPE_INTERFACE_EndpointStream) == 0) {
events = &endpoint_stream_events;
client_version = PW_VERSION_ENDPOINT_STREAM;
destroy = (pw_destroy_t) endpoint_stream_info_free;
info_func = info_endpoint_stream;
break;
default:
asprintf(error, "unsupported type %s", spa_debug_type_find_name(pw_type_info(), global->type));
} else {
asprintf(error, "unsupported type %s", global->type);
return false;
}
@ -1410,7 +1393,7 @@ static bool do_export_node(struct data *data, const char *cmd, char *args, char
asprintf(error, "object %d does not exist", atoi(a[0]));
return false;
}
if (pw_global_get_type(global) != PW_TYPE_INTERFACE_Node) {
if (!pw_global_is_type(global, PW_TYPE_INTERFACE_Node)) {
asprintf(error, "object %d is not a node", atoi(a[0]));
return false;
}
@ -1454,25 +1437,21 @@ static bool do_enum_params(struct data *data, const char *cmd, char *args, char
return false;
}
switch (global->type) {
case PW_TYPE_INTERFACE_Node:
if (strcmp(global->type, PW_TYPE_INTERFACE_Node) == 0)
pw_node_enum_params((struct pw_node*)global->proxy, 0,
param_id, 0, 0, NULL);
break;
case PW_TYPE_INTERFACE_Port:
else if (strcmp(global->type, PW_TYPE_INTERFACE_Port) == 0)
pw_port_enum_params((struct pw_port*)global->proxy, 0,
param_id, 0, 0, NULL);
break;
case PW_TYPE_INTERFACE_Device:
else if (strcmp(global->type, PW_TYPE_INTERFACE_Device) == 0)
pw_device_enum_params((struct pw_device*)global->proxy, 0,
param_id, 0, 0, NULL);
break;
case PW_TYPE_INTERFACE_Endpoint:
else if (strcmp(global->type, PW_TYPE_INTERFACE_Endpoint) == 0)
pw_endpoint_enum_params((struct pw_endpoint*)global->proxy, 0,
param_id, 0, 0, NULL);
break;
default:
asprintf(error, "enum-params not implemented on object %d", atoi(a[0]));
else {
asprintf(error, "enum-params not implemented on object %d type:%s",
atoi(a[0]), global->type);
return false;
}
return true;
@ -1499,7 +1478,7 @@ static bool do_permissions(struct data *data, const char *cmd, char *args, char
asprintf(error, "%s: unknown global %d", cmd, id);
return false;
}
if (global->type != PW_TYPE_INTERFACE_Client) {
if (strcmp(global->type, PW_TYPE_INTERFACE_Client) != 0) {
asprintf(error, "object %d is not a client", atoi(a[0]));
return false;
}
@ -1537,7 +1516,7 @@ static bool do_get_permissions(struct data *data, const char *cmd, char *args, c
asprintf(error, "%s: unknown global %d", cmd, id);
return false;
}
if (global->type != PW_TYPE_INTERFACE_Client) {
if (strcmp(global->type, PW_TYPE_INTERFACE_Client) != 0) {
asprintf(error, "object %d is not a client", atoi(a[0]));
return false;
}

View file

@ -66,6 +66,13 @@ struct global {
struct pw_proxy *proxy;
uint32_t id;
#define INTERFACE_Port 0
#define INTERFACE_Node 1
#define INTERFACE_Link 2
#define INTERFACE_Client 3
#define INTERFACE_Device 4
#define INTERFACE_Module 5
#define INTERFACE_Factory 6
uint32_t type;
struct pw_properties *props;
void *info;
@ -175,7 +182,7 @@ static void draw_port(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Port);
spa_assert(g->type == INTERFACE_Port);
struct pw_port_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -202,7 +209,7 @@ static void draw_node(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Node);
spa_assert(g->type == INTERFACE_Node);
struct pw_node_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -242,7 +249,7 @@ static void draw_node(struct global *g)
spa_list_for_each(p, &g->data->globals, link) {
if (p == NULL || p->info == NULL)
continue;
if (p->type != PW_TYPE_INTERFACE_Port)
if (p->type != INTERFACE_Port)
continue;
prop_node_id = pw_properties_get(p->props, PW_KEY_NODE_ID);
if (!prop_node_id || (uint32_t)atoi(prop_node_id) != g->id)
@ -271,7 +278,7 @@ static void draw_link(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Link);
spa_assert(g->type == INTERFACE_Link);
struct pw_link_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -299,7 +306,7 @@ static void draw_client(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Client);
spa_assert(g->type == INTERFACE_Client);
struct pw_client_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -321,7 +328,7 @@ static void draw_device(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Device);
spa_assert(g->type == INTERFACE_Device);
struct pw_device_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -354,7 +361,7 @@ static void draw_factory(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Factory);
spa_assert(g->type == INTERFACE_Factory);
struct pw_factory_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -380,7 +387,7 @@ static void draw_module(struct global *g)
{
spa_assert(g != NULL);
spa_assert(g->info != NULL);
spa_assert(g->type == PW_TYPE_INTERFACE_Module);
spa_assert(g->type == INTERFACE_Module);
struct pw_module_info *info = g->info;
char **dot_str = &g->data->dot_str;
@ -403,7 +410,7 @@ static bool is_node_id_link_referenced(uint32_t id, struct spa_list *globals)
spa_list_for_each(g, globals, link) {
if (g == NULL || g->info == NULL)
continue;
if (g->type != PW_TYPE_INTERFACE_Link)
if (g->type != INTERFACE_Link)
continue;
info = g->info;
if (info->input_node_id == id || info->output_node_id == id)
@ -420,7 +427,7 @@ static bool is_module_id_factory_referenced(uint32_t id, struct spa_list *global
spa_list_for_each(g, globals, link) {
if (g == NULL || g->info == NULL)
continue;
if (g->type != PW_TYPE_INTERFACE_Factory)
if (g->type != INTERFACE_Factory)
continue;
info = g->info;
module_id_str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID);
@ -433,9 +440,9 @@ static bool is_module_id_factory_referenced(uint32_t id, struct spa_list *global
static bool is_global_referenced(struct global *g)
{
switch (g->type) {
case PW_TYPE_INTERFACE_Node:
case INTERFACE_Node:
return is_node_id_link_referenced(g->id, &g->data->globals);
case PW_TYPE_INTERFACE_Module:
case INTERFACE_Module:
return is_module_id_factory_referenced(g->id, &g->data->globals);
default:
break;
@ -459,16 +466,16 @@ static int draw_graph(struct data *d, const char *path)
continue;
/* always skip ports since they are drawn by the nodes */
if (g->type == PW_TYPE_INTERFACE_Port)
if (g->type == INTERFACE_Port)
continue;
/* skip clients, devices, factories and modules if all option is disabled */
if (!d->show_all) {
switch (g->type) {
case PW_TYPE_INTERFACE_Client:
case PW_TYPE_INTERFACE_Device:
case PW_TYPE_INTERFACE_Factory:
case PW_TYPE_INTERFACE_Module:
case INTERFACE_Client:
case INTERFACE_Device:
case INTERFACE_Factory:
case INTERFACE_Module:
continue;
default:
break;
@ -597,73 +604,81 @@ static const struct pw_proxy_events proxy_events = {
};
static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
uint32_t type, uint32_t version,
const char *type, uint32_t version,
const struct spa_dict *props)
{
struct data *d = data;
struct pw_proxy *proxy;
uint32_t client_version;
uint32_t object_type;
const void *events;
pw_destroy_t info_destroy;
info_update_t info_update;
draw_t draw;
struct global *g;
switch (type) {
case PW_TYPE_INTERFACE_Port:
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
events = &port_events;
info_destroy = (pw_destroy_t)pw_port_info_free;
info_update = (info_update_t)pw_port_info_update;
draw = draw_port;
client_version = PW_VERSION_PORT;
break;
case PW_TYPE_INTERFACE_Node:
object_type = INTERFACE_Port;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
events = &node_events;
info_destroy = (pw_destroy_t)pw_node_info_free;
info_update = (info_update_t)pw_node_info_update;
draw = draw_node;
client_version = PW_VERSION_NODE;
break;
case PW_TYPE_INTERFACE_Link:
object_type = INTERFACE_Node;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Link) == 0) {
events = &link_events;
info_destroy = (pw_destroy_t)pw_link_info_free;
info_update = (info_update_t)pw_link_info_update;
draw = draw_link;
client_version = PW_VERSION_LINK;
break;
case PW_TYPE_INTERFACE_Client:
object_type = INTERFACE_Link;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0) {
events = &client_events;
info_destroy = (pw_destroy_t)pw_client_info_free;
info_update = (info_update_t)pw_client_info_update;
draw = draw_client;
client_version = PW_VERSION_CLIENT;
break;
case PW_TYPE_INTERFACE_Device:
object_type = INTERFACE_Client;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Device) == 0) {
events = &device_events;
info_destroy = (pw_destroy_t)pw_device_info_free;
info_update = (info_update_t)pw_device_info_update;
draw = draw_device;
client_version = PW_VERSION_DEVICE;
break;
case PW_TYPE_INTERFACE_Factory:
object_type = INTERFACE_Device;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
events = &factory_events;
info_destroy = (pw_destroy_t)pw_factory_info_free;
info_update = (info_update_t)pw_factory_info_update;
draw = draw_factory;
client_version = PW_VERSION_FACTORY;
break;
case PW_TYPE_INTERFACE_Module:
object_type = INTERFACE_Factory;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Module) == 0) {
events = &module_events;
info_destroy = (pw_destroy_t)pw_module_info_free;
info_update = (info_update_t)pw_module_info_update;
draw = draw_module;
client_version = PW_VERSION_MODULE;
break;
case PW_TYPE_INTERFACE_Core:
object_type = INTERFACE_Module;
}
else if (strcmp(type, PW_TYPE_INTERFACE_Core) == 0) {
/* sync to notify we are done with globals */
pw_core_sync(d->core, 0, 0);
return;
default:
}
else {
return;
}
@ -679,7 +694,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
g->proxy = proxy;
g->id = id;
g->type = type;
g->type = object_type;
g->props = props ? pw_properties_new_dict(props) : NULL;
g->info = NULL;

View file

@ -63,7 +63,7 @@ struct proxy_data {
uint32_t id;
uint32_t permissions;
uint32_t version;
uint32_t type;
char *type;
void *info;
pw_destroy_t destroy;
struct spa_hook proxy_listener;
@ -187,7 +187,7 @@ static void on_core_info(void *data, const struct pw_core_info *info)
{
bool print_all = true, print_mark = true;
printf("\ttype: %s\n", spa_debug_type_find_name(pw_type_info(), PW_TYPE_INTERFACE_Core));
printf("\ttype: %s\n", PW_TYPE_INTERFACE_Core);
printf("\tcookie: %u\n", info->cookie);
printf("\tuser-name: \"%s\"\n", info->user_name);
printf("\thost-name: \"%s\"\n", info->host_name);
@ -219,8 +219,7 @@ static void module_event_info(void *object, const struct pw_module_info *info)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
printf("\tname: \"%s\"\n", info->name);
printf("\tfilename: \"%s\"\n", info->filename);
printf("\targs: \"%s\"\n", info->args);
@ -254,8 +253,7 @@ static void print_node(struct proxy_data *data)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
if (print_all) {
print_params(data, MARK_CHANGE(PW_NODE_CHANGE_MASK_PARAMS));
printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(PW_NODE_CHANGE_MASK_INPUT_PORTS),
@ -322,8 +320,7 @@ static void print_port(struct proxy_data *data)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
printf("\tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
if (print_all) {
@ -383,11 +380,10 @@ static void factory_event_info(void *object, const struct pw_factory_info *info)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
printf("\tname: \"%s\"\n", info->name);
printf("\tobject-type: %s/%d\n", spa_debug_type_find_name(pw_type_info(), info->type), info->version);
printf("\tobject-type: %s/%d\n", info->type, info->version);
if (print_all) {
print_properties(info->props, MARK_CHANGE(PW_FACTORY_CHANGE_MASK_PROPS));
}
@ -419,8 +415,7 @@ static void client_event_info(void *object, const struct pw_client_info *info)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
if (print_all) {
print_properties(info->props, MARK_CHANGE(PW_CLIENT_CHANGE_MASK_PROPS));
@ -453,8 +448,7 @@ static void link_event_info(void *object, const struct pw_link_info *info)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
printf("\toutput-node-id: %u\n", info->output_node_id);
printf("\toutput-port-id: %u\n", info->output_port_id);
@ -501,8 +495,7 @@ static void print_device(struct proxy_data *data)
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
data->permissions & PW_PERM_W ? 'w' : '-',
data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
printf("\ttype: %s (version %d)\n", data->type, data->version);
if (print_all) {
print_params(data, MARK_CHANGE(PW_DEVICE_CHANGE_MASK_PARAMS));
@ -556,6 +549,7 @@ destroy_proxy (void *data)
if (pd->destroy)
pd->destroy(pd->info);
pd->info = NULL;
free(pd->type);
}
static const struct pw_proxy_events proxy_events = {
@ -564,7 +558,7 @@ static const struct pw_proxy_events proxy_events = {
};
static void registry_event_global(void *data, uint32_t id,
uint32_t permissions, uint32_t type, uint32_t version,
uint32_t permissions, const char *type, uint32_t version,
const struct spa_dict *props)
{
struct data *d = data;
@ -575,52 +569,44 @@ static void registry_event_global(void *data, uint32_t id,
pw_destroy_t destroy;
print_func_t print_func = NULL;
switch (type) {
case PW_TYPE_INTERFACE_Node:
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
events = &node_events;
client_version = PW_VERSION_NODE;
destroy = (pw_destroy_t) pw_node_info_free;
print_func = print_node;
break;
case PW_TYPE_INTERFACE_Port:
} else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
events = &port_events;
client_version = PW_VERSION_PORT;
destroy = (pw_destroy_t) pw_port_info_free;
print_func = print_port;
break;
case PW_TYPE_INTERFACE_Module:
} else if (strcmp(type, PW_TYPE_INTERFACE_Module) == 0) {
events = &module_events;
client_version = PW_VERSION_MODULE;
destroy = (pw_destroy_t) pw_module_info_free;
break;
case PW_TYPE_INTERFACE_Device:
} else if (strcmp(type, PW_TYPE_INTERFACE_Device) == 0) {
events = &device_events;
client_version = PW_VERSION_DEVICE;
destroy = (pw_destroy_t) pw_device_info_free;
print_func = print_device;
break;
case PW_TYPE_INTERFACE_Factory:
} else if (strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
events = &factory_events;
client_version = PW_VERSION_FACTORY;
destroy = (pw_destroy_t) pw_factory_info_free;
break;
case PW_TYPE_INTERFACE_Client:
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0) {
events = &client_events;
client_version = PW_VERSION_CLIENT;
destroy = (pw_destroy_t) pw_client_info_free;
break;
case PW_TYPE_INTERFACE_Link:
} else if (strcmp(type, PW_TYPE_INTERFACE_Link) == 0) {
events = &link_events;
client_version = PW_VERSION_LINK;
destroy = (pw_destroy_t) pw_link_info_free;
break;
default:
} else {
printf("added:\n");
printf("\tid: %u\n", id);
printf("\tpermissions: %c%c%c\n", permissions & PW_PERM_R ? 'r' : '-',
permissions & PW_PERM_W ? 'w' : '-',
permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n", spa_debug_type_find_name(pw_type_info(), type), version);
printf("\ttype: %s (version %d)\n", type, version);
print_properties(props, ' ');
return;
}
@ -638,7 +624,7 @@ static void registry_event_global(void *data, uint32_t id,
pd->id = id;
pd->permissions = permissions;
pd->version = version;
pd->type = type;
pd->type = strdup(type);
pd->destroy = destroy;
pd->pending_seq = 0;
pd->print_func = print_func;