From a608c373e62619c5c34e12fce9d611e4d397da8b Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Mon, 8 Nov 2010 02:39:53 +0200 Subject: [PATCH] ladishd: properly handle a2j ports for apps with same names For real jack ports it works because different apps have different jack client. For a2j ports, it did not work because the jack client is same and the a2j_fake_jack_port_name is same too, because the instead of alsa client name, the app name is used now --- daemon/graph.c | 13 ++++++++++++- daemon/graph.h | 2 +- daemon/virtualizer.c | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/daemon/graph.c b/daemon/graph.c index 0359e571..e2129070 100644 --- a/daemon/graph.c +++ b/daemon/graph.c @@ -1650,7 +1650,12 @@ ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_h return NULL; } -ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name) +ladish_port_handle +ladish_graph_find_port_by_name( + ladish_graph_handle graph_handle, + ladish_client_handle client_handle, + const char * name, + void * vgraph_filter) { struct ladish_graph_client * client_ptr; struct list_head * node_ptr; @@ -1662,6 +1667,12 @@ ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_hand list_for_each(node_ptr, &client_ptr->ports) { port_ptr = list_entry(node_ptr, struct ladish_graph_port, siblings_client); + + if (vgraph_filter != NULL && ladish_port_get_vgraph(port_ptr->port) != vgraph_filter) + { + continue; + } + if (strcmp(port_ptr->name, name) == 0) { return port_ptr->port; diff --git a/daemon/graph.h b/daemon/graph.h index 981c88c9..09ad2c55 100644 --- a/daemon/graph.h +++ b/daemon/graph.h @@ -141,7 +141,7 @@ ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle gra ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id, bool room, bool studio); ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name, bool appless); ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_handle, const uuid_t app_uuid); -ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name); +ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, void * vgraph_filter); ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid); ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids, void * vgraph_filter); diff --git a/daemon/virtualizer.c b/daemon/virtualizer.c index 5ee74860..36c34057 100644 --- a/daemon/virtualizer.c +++ b/daemon/virtualizer.c @@ -592,7 +592,7 @@ port_appeared( * if not found - create new port and add it to the jack graph. * Then process to adding it to virtual graph */ - port = ladish_graph_find_port_by_name(virtualizer_ptr->jack_graph, jack_client, jack_port_name); + port = ladish_graph_find_port_by_name(virtualizer_ptr->jack_graph, jack_client, jack_port_name, vgraph); if (port != NULL) { log_info("found existing port %p", port);