port: add events for add/remove of link

This commit is contained in:
Wim Taymans 2017-08-16 12:41:28 +02:00
parent 2cb1590859
commit 5e593563af
2 changed files with 10 additions and 0 deletions

View file

@ -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);

View file

@ -42,6 +42,7 @@ extern "C" {
* The port object
*/
struct pw_port;
struct pw_link;
#include <pipewire/core.h>
#include <pipewire/introspect.h>
@ -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);