Use mapper to make object id

Reuse object ids by using a mapper
Simpify the uri struct a little.
This commit is contained in:
Wim Taymans 2016-11-21 16:29:15 +01:00
parent f42268b9a5
commit e7cae649aa
14 changed files with 61 additions and 64 deletions

View file

@ -227,7 +227,7 @@ on_global_added (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_added);
if (global->type == impl->core->registry.uri.node) {
if (global->type == impl->core->uri.node) {
PinosNode *node = global->object;
on_node_added (impl, node);
}
@ -240,7 +240,7 @@ on_global_removed (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_removed);
if (global->type == impl->core->registry.uri.node) {
if (global->type == impl->core->uri.node) {
PinosNode *node = global->object;
on_node_removed (impl, node);
}
@ -275,7 +275,7 @@ module_new (PinosCore *core,
pinos_signal_add (&core->port_unlinked, &impl->port_unlinked, on_link_port_unlinked);
pinos_signal_add (&core->link_state_changed, &impl->link_state_changed, on_link_state_changed);
impl->uri.module = spa_id_map_get_id (core->registry.map, MODULE_URI);
impl->uri.module = spa_id_map_get_id (core->uri.map, MODULE_URI);
impl->global = pinos_core_add_global (core,
impl->uri.module,

View file

@ -302,7 +302,7 @@ handle_create_node (PinosDaemon1 *interface,
goto object_failed;
pinos_client_add_resource (client,
this->core->registry.uri.node,
this->core->uri.node,
node,
(PinosDestroy) pinos_node_destroy);
@ -403,7 +403,7 @@ handle_create_client_node (PinosDaemon1 *interface,
goto no_socket;
pinos_client_add_resource (client,
this->core->registry.uri.client_node,
this->core->uri.client_node,
node,
(PinosDestroy) pinos_client_node_destroy);
@ -493,7 +493,7 @@ on_global_added (PinosListener *listener,
PinosProtocolDBus *this = &impl->this;
PinosObjectSkeleton *skel;
if (global->type == this->core->registry.uri.client) {
if (global->type == this->core->uri.client) {
PinosClient1 *iface;
PinosClient *client = global->object;
PinosProperties *props = client->properties;
@ -515,7 +515,7 @@ on_global_added (PinosListener *listener,
false,
(PinosDestroy) client_destroy);
} else if (global->type == this->core->registry.uri.node) {
} else if (global->type == this->core->uri.node) {
PinosNode1 *iface;
PinosNode *node = global->object;
PinosProperties *props = node->properties;
@ -582,7 +582,7 @@ on_global_added (PinosListener *listener,
name_lost_handler,
proto,
NULL);
} else if (global->type == this->core->registry.uri.link) {
} else if (global->type == this->core->uri.link) {
PinosLink1 *iface;
PinosLink *link = global->object;
PinosProtocolDBusObject *obj;
@ -657,7 +657,7 @@ pinos_protocol_dbus_new (PinosCore *core,
impl->server_manager = g_dbus_object_manager_server_new (PINOS_DBUS_OBJECT_PREFIX);
impl->uri.protocol_dbus = spa_id_map_get_id (core->registry.map, PINOS_PROTOCOL_DBUS_URI);
impl->uri.protocol_dbus = spa_id_map_get_id (core->uri.map, PINOS_PROTOCOL_DBUS_URI);
this->global = pinos_core_add_global (core,
impl->uri.protocol_dbus,

View file

@ -127,7 +127,7 @@ on_global_added (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_added);
if (global->type == impl->core->registry.uri.node) {
if (global->type == impl->core->uri.node) {
PinosNode *node = global->object;
NodeInfo *info;
@ -146,7 +146,7 @@ on_global_removed (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_removed);
if (global->type == impl->core->registry.uri.node) {
if (global->type == impl->core->uri.node) {
PinosNode *node = global->object;
NodeInfo *info;
@ -187,7 +187,7 @@ module_new (PinosCore *core,
pinos_signal_add (&core->node_state_request, &impl->node_state_request, on_node_state_request);
pinos_signal_add (&core->node_state_changed, &impl->node_state_changed, on_node_state_changed);
impl->uri.module = spa_id_map_get_id (core->registry.map, MODULE_URI);
impl->uri.module = spa_id_map_get_id (core->uri.map, MODULE_URI);
impl->global = pinos_core_add_global (core,
impl->uri.module,

View file

@ -73,11 +73,11 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
pinos_log_error ("can't make factory instance: %d", res);
return;
}
if ((res = spa_handle_get_interface (handle, impl->core->registry.uri.spa_node, &node_iface)) < 0) {
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_node, &node_iface)) < 0) {
pinos_log_error ("can't get NODE interface: %d", res);
return;
}
if ((res = spa_handle_get_interface (handle, impl->core->registry.uri.spa_clock, &clock_iface)) < 0) {
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_clock, &clock_iface)) < 0) {
pinos_log_info ("no CLOCK interface: %d", res);
}
@ -210,7 +210,7 @@ pinos_spa_monitor_load (PinosCore *core,
goto init_failed;
}
if ((res = spa_handle_get_interface (handle,
core->registry.uri.spa_monitor,
core->uri.spa_monitor,
&iface)) < 0) {
free (handle);
pinos_log_error ("can't get MONITOR interface: %d", res);

View file

@ -79,7 +79,7 @@ pinos_spa_node_load (PinosCore *core,
goto init_failed;
}
if ((res = spa_handle_get_interface (handle,
core->registry.uri.spa_node,
core->uri.spa_node,
&iface)) < 0) {
pinos_log_error ("can't get interface %d", res);
goto interface_failed;
@ -87,7 +87,7 @@ pinos_spa_node_load (PinosCore *core,
spa_node = iface;
if ((res = spa_handle_get_interface (handle,
core->registry.uri.spa_clock,
core->uri.spa_clock,
&iface)) < 0) {
iface = NULL;
}