mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
Add link introspection
This commit is contained in:
parent
b969623ec8
commit
e6f45a7686
8 changed files with 156 additions and 39 deletions
|
|
@ -277,6 +277,8 @@ pinos_core_add_global (PinosCore *core,
|
|||
PinosBindFunc bind)
|
||||
{
|
||||
PinosGlobal *global;
|
||||
PinosResource *registry;
|
||||
PinosMessageNotifyGlobal ng;
|
||||
|
||||
global = calloc (1, sizeof (PinosGlobal));
|
||||
global->core = core;
|
||||
|
|
@ -294,6 +296,14 @@ pinos_core_add_global (PinosCore *core,
|
|||
|
||||
pinos_log_debug ("global %p: new %u", global, global->id);
|
||||
|
||||
ng.id = global->id;
|
||||
ng.type = spa_id_map_get_uri (core->uri.map, global->type);
|
||||
spa_list_for_each (registry, &core->registry_resource_list, link) {
|
||||
pinos_resource_send_message (registry,
|
||||
PINOS_MESSAGE_NOTIFY_GLOBAL,
|
||||
&ng,
|
||||
true);
|
||||
}
|
||||
return global;
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +323,8 @@ void
|
|||
pinos_global_destroy (PinosGlobal *global)
|
||||
{
|
||||
PinosCore *core = global->core;
|
||||
PinosResource *registry;
|
||||
PinosMessageNotifyGlobalRemove ng;
|
||||
|
||||
pinos_log_debug ("global %p: destroy", global);
|
||||
pinos_signal_emit (&global->destroy_signal, global);
|
||||
|
|
@ -322,6 +334,14 @@ pinos_global_destroy (PinosGlobal *global)
|
|||
spa_list_remove (&global->link);
|
||||
pinos_signal_emit (&core->global_removed, core, global);
|
||||
|
||||
ng.id = global->id;
|
||||
spa_list_for_each (registry, &core->registry_resource_list, link) {
|
||||
pinos_resource_send_message (registry,
|
||||
PINOS_MESSAGE_NOTIFY_GLOBAL_REMOVE,
|
||||
&ng,
|
||||
true);
|
||||
}
|
||||
|
||||
pinos_main_loop_defer (core->main_loop,
|
||||
global,
|
||||
SPA_RESULT_WAIT_SYNC,
|
||||
|
|
|
|||
|
|
@ -681,24 +681,48 @@ link_dispatch_func (void *object,
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
link_unbind_func (void *data)
|
||||
{
|
||||
PinosResource *resource = data;
|
||||
spa_list_remove (&resource->link);
|
||||
}
|
||||
|
||||
static void
|
||||
link_bind_func (PinosGlobal *global,
|
||||
PinosClient *client,
|
||||
uint32_t version,
|
||||
uint32_t id)
|
||||
{
|
||||
PinosLink *this = global->object;
|
||||
PinosResource *resource;
|
||||
PinosMessageLinkInfo m;
|
||||
PinosLinkInfo info;
|
||||
|
||||
resource = pinos_resource_new (client,
|
||||
id,
|
||||
global->core->uri.link,
|
||||
global->object,
|
||||
NULL);
|
||||
link_unbind_func);
|
||||
|
||||
resource->dispatch_func = link_dispatch_func;
|
||||
resource->dispatch_data = client;
|
||||
resource->dispatch_data = global;
|
||||
|
||||
pinos_log_debug ("link %p: bound to %d", global->object, resource->id);
|
||||
|
||||
spa_list_insert (this->resource_list.prev, &resource->link);
|
||||
|
||||
m.info = &info;
|
||||
info.id = resource->id;
|
||||
info.change_mask = ~0;
|
||||
info.output_node_id = this->output ? this->output->node->global->id : -1;
|
||||
info.output_port_id = this->output ? this->output->port_id : -1;
|
||||
info.input_node_id = this->input ? this->input->node->global->id : -1;
|
||||
info.input_port_id = this->input ? this->input->port_id : -1;
|
||||
pinos_resource_send_message (resource,
|
||||
PINOS_MESSAGE_LINK_INFO,
|
||||
&m,
|
||||
true);
|
||||
}
|
||||
|
||||
PinosLink *
|
||||
|
|
@ -722,6 +746,7 @@ pinos_link_new (PinosCore *core,
|
|||
this->input = input;
|
||||
this->output = output;
|
||||
|
||||
spa_list_init (&this->resource_list);
|
||||
pinos_signal_init (&this->destroy_signal);
|
||||
|
||||
impl->format_filter = format_filter;
|
||||
|
|
|
|||
|
|
@ -52,9 +52,10 @@ struct _PinosLink {
|
|||
PINOS_SIGNAL (destroy_signal, (PinosListener *,
|
||||
PinosLink *));
|
||||
|
||||
SpaList resource_list;
|
||||
|
||||
PinosPort *output;
|
||||
SpaList output_link;
|
||||
|
||||
PinosPort *input;
|
||||
SpaList input_link;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue