port: add port globals

Expose all ports as globals, linking is then done by specifying
the global id of the ports.
Add method to destroy objects. not much security on this one but
yet but it should allow priviledged clients to kill connections
and other clients etc.
Make events on the global object. Implement the bind with the event,
handle destroy of the globals.
Add link properties
Use append to preserve the order.
This commit is contained in:
Wim Taymans 2018-02-15 17:49:04 +01:00
parent b86f141273
commit 6c000229f0
18 changed files with 416 additions and 99 deletions

View file

@ -97,15 +97,25 @@ static void *create_object(void *_data,
if (output_port_id == -1)
outport = pw_node_get_free_port(output_node, SPA_DIRECTION_OUTPUT);
else
outport = pw_node_find_port(output_node, SPA_DIRECTION_OUTPUT, output_port_id);
else {
global = pw_core_find_global(core, output_port_id);
if (global == NULL || pw_global_get_type(global) != t->port)
goto no_output_port;
outport = pw_global_get_object(global);
}
if (outport == NULL)
goto no_output_port;
if (input_port_id == -1)
inport = pw_node_get_free_port(input_node, SPA_DIRECTION_INPUT);
else
inport = pw_node_find_port(input_node, SPA_DIRECTION_INPUT, input_port_id);
else {
global = pw_core_find_global(core, input_port_id);
if (global == NULL || pw_global_get_type(global) != t->port)
goto no_output_port;
inport = pw_global_get_object(global);
}
if (inport == NULL)
goto no_input_port;