diff --git a/src/pipewire/link.c b/src/pipewire/link.c index 7a8cd9e5d..c3ebc6ba1 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -1105,6 +1105,9 @@ struct pw_link *pw_link_new(struct pw_core *core, do_add_link, SPA_ID_INVALID, sizeof(struct pw_port *), &input, false, this); + spa_hook_list_call(&output->listener_list, struct pw_port_events, link_added, this); + spa_hook_list_call(&input->listener_list, struct pw_port_events, link_added, this); + this->global = pw_core_add_global(core, NULL, parent, core->type.link, PW_VERSION_LINK, link_bind_func, this); @@ -1139,10 +1142,12 @@ void pw_link_destroy(struct pw_link *link) input_remove(link, link->input); spa_list_remove(&link->input_link); + spa_hook_list_call(&link->input->listener_list, struct pw_port_events, link_removed, link); link->input = NULL; output_remove(link, link->output); spa_list_remove(&link->output_link); + spa_hook_list_call(&link->output->listener_list, struct pw_port_events, link_removed, link); link->output = NULL; pw_work_queue_destroy(impl->work); diff --git a/src/pipewire/port.h b/src/pipewire/port.h index 71646c253..038f3c52c 100644 --- a/src/pipewire/port.h +++ b/src/pipewire/port.h @@ -42,6 +42,7 @@ extern "C" { * The port object */ struct pw_port; +struct pw_link; #include #include @@ -93,6 +94,10 @@ struct pw_port_events { void (*destroy) (void *data); + void (*link_added) (void *data, struct pw_link *link); + + void (*link_removed) (void *data, struct pw_link *link); + void (*state_changed) (void *data, enum pw_port_state state); void (*properties_changed) (void *data, const struct pw_properties *properties);