mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
type: restore type info for pipewire types
This commit is contained in:
parent
6bb90ed88e
commit
7e8fac2272
9 changed files with 32 additions and 10 deletions
|
|
@ -68,7 +68,7 @@ static void registry_bind(void *object, uint32_t id,
|
|||
goto wrong_interface;
|
||||
|
||||
pw_log_debug("global %p: bind global id %d, iface %s to %d", global, id,
|
||||
spa_debug_type_find_name(NULL, type), new_id);
|
||||
spa_debug_type_find_name(pw_type_info(), type), new_id);
|
||||
|
||||
if (pw_global_bind(global, client, permissions, version, new_id) < 0)
|
||||
goto exit;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ int pw_factory_register(struct pw_factory *factory,
|
|||
|
||||
pw_properties_set(properties, "factory.name", factory->info.name);
|
||||
pw_properties_setf(properties, "factory.type.name", "%s",
|
||||
spa_debug_type_find_name(NULL, factory->info.type));
|
||||
spa_debug_type_find_name(pw_type_info(), factory->info.type));
|
||||
pw_properties_setf(properties, "factory.type.version", "%d", factory->info.version);
|
||||
|
||||
spa_list_append(&core->factory_list, &factory->link);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ pw_global_new(struct pw_core *core,
|
|||
spa_hook_list_init(&this->listener_list);
|
||||
|
||||
pw_log_debug("global %p: new %s %d", this,
|
||||
spa_debug_type_find_name(NULL, this->type),
|
||||
spa_debug_type_find_name(pw_type_info(), this->type),
|
||||
this->id);
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -594,3 +594,22 @@ const char* pw_get_library_version(void)
|
|||
{
|
||||
return pw_get_headers_version();
|
||||
}
|
||||
|
||||
static const struct spa_type_info type_info[] = {
|
||||
{ PW_TYPE_INTERFACE_Core, PW_TYPE_INTERFACE_BASE "Core", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Registry, PW_TYPE_INTERFACE_BASE "Registry", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Node, PW_TYPE_INTERFACE_BASE "Node", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Port, PW_TYPE_INTERFACE_BASE "Port", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Factory, PW_TYPE_INTERFACE_BASE "Factory", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Link, PW_TYPE_INTERFACE_BASE "Link", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Client, PW_TYPE_INTERFACE_BASE "Client", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_Module, PW_TYPE_INTERFACE_BASE "Module", SPA_TYPE_Pointer, },
|
||||
{ PW_TYPE_INTERFACE_ClientNode, PW_TYPE_INTERFACE_BASE "ClientNode", SPA_TYPE_Pointer, },
|
||||
{ SPA_ID_INVALID, "spa_types", SPA_ID_INVALID, spa_types },
|
||||
{ 0, NULL, },
|
||||
};
|
||||
|
||||
const struct spa_type_info * pw_type_info(void)
|
||||
{
|
||||
return type_info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <spa/graph/graph.h>
|
||||
#include <spa/utils/type-info.h>
|
||||
|
||||
struct pw_command;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol,
|
|||
spa_list_append(&protocol->marshal_list, &impl->link);
|
||||
|
||||
pw_log_debug("Add marshal %d/%s:%d to protocol %s", marshal->type,
|
||||
spa_debug_type_find_name(NULL, marshal->type), marshal->version,
|
||||
spa_debug_type_find_name(pw_type_info(), marshal->type), marshal->version,
|
||||
protocol->name);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ enum {
|
|||
#define PW_TYPE__Interface PW_TYPE_BASE "Interface"
|
||||
#define PW_TYPE_INTERFACE_BASE PW_TYPE__Interface ":"
|
||||
|
||||
const struct spa_type_info * pw_type_info(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ static int print_global(void *obj, void *data)
|
|||
return 0;
|
||||
|
||||
fprintf(stdout, "\tid %d, parent %d, type %s/%d\n", global->id, global->parent_id,
|
||||
spa_debug_type_find_name(NULL, global->type),
|
||||
spa_debug_type_find_name(pw_type_info(), global->type),
|
||||
global->version);
|
||||
if (global->properties)
|
||||
print_properties(&global->properties->dict, ' ', false);
|
||||
|
|
@ -503,7 +503,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(NULL, global->type), pd->global->version);
|
||||
fprintf(stdout, "\ttype: %s/%d\n", spa_debug_type_find_name(pw_type_info(), global->type), pd->global->version);
|
||||
}
|
||||
|
||||
static void info_core(struct proxy_data *pd)
|
||||
|
|
@ -568,7 +568,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(NULL, info->type), info->version);
|
||||
fprintf(stdout, "\tobject-type: %s/%d\n", spa_debug_type_find_name(pw_type_info(), info->type), info->version);
|
||||
print_properties(info->props, MARK_CHANGE(0), true);
|
||||
info->change_mask = 0;
|
||||
}
|
||||
|
|
@ -856,7 +856,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
info_func = info_link;
|
||||
break;
|
||||
default:
|
||||
asprintf(error, "unsupported type %s", spa_debug_type_find_name(NULL, global->type));
|
||||
asprintf(error, "unsupported type %s", spa_debug_type_find_name(pw_type_info(), global->type));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ static void factory_event_info(void *object, struct pw_factory_info *info)
|
|||
data->permissions & PW_PERM_X ? 'x' : '-');
|
||||
printf("\ttype: %s (version %d)\n", PW_TYPE_INTERFACE__Factory, data->version);
|
||||
printf("\tname: \"%s\"\n", info->name);
|
||||
printf("\tobject-type: %s/%d\n", spa_debug_type_find_name(NULL, info->type), info->version);
|
||||
printf("\tobject-type: %s/%d\n", spa_debug_type_find_name(pw_type_info(), info->type), info->version);
|
||||
if (print_all) {
|
||||
print_properties(info->props, MARK_CHANGE(0));
|
||||
}
|
||||
|
|
@ -517,7 +517,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_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(NULL, type), version);
|
||||
printf("\ttype: %s (version %d)\n", spa_debug_type_find_name(pw_type_info(), type), version);
|
||||
print_properties(props, ' ');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue