Changeset 79c75fd07bec3ba6e33dcb5fce11aba37a20e601
- Timestamp:
- 11/07/10 19:52:08 (3 years ago)
- Children:
- eb866bf6e8302d2fc26ac8c490d28ba9adc6bd67
- Parents:
- 7d3acd7331866af33e845d1b35fbe4a4d599a5b8
- git-author:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-11-07T19:42:12Z+0200
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-11-07T19:52:08Z+0200
- Location:
- daemon
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
daemon/graph.c
r222dec6 r79c75fd0 1785 1785 1786 1786 return port_ptr->port; 1787 } 1788 1789 bool ladish_graph_client_has_visible_app_port(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const uuid_t app_uuid) 1790 { 1791 struct ladish_graph_client * client_ptr; 1792 struct list_head * node_ptr; 1793 struct ladish_graph_port * port_ptr; 1794 1795 client_ptr = ladish_graph_find_client(graph_ptr, client_handle); 1796 if (client_ptr == NULL) 1797 { 1798 ASSERT_NO_PASS; 1799 return false; 1800 } 1801 1802 list_for_each(node_ptr, &client_ptr->ports) 1803 { 1804 port_ptr = list_entry(node_ptr, struct ladish_graph_port, siblings_client); 1805 if (port_ptr->hidden) 1806 { 1807 continue; 1808 } 1809 1810 if (ladish_port_belongs_to_app(port_ptr->port, app_uuid)) 1811 { 1812 ASSERT(!client_ptr->hidden); 1813 return true; 1814 } 1815 } 1816 1817 return false; 1787 1818 } 1788 1819 -
daemon/graph.h
r2eac623 r79c75fd0 175 175 void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle); 176 176 void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr); 177 bool ladish_graph_client_has_visible_app_port(ladish_graph_handle graph, ladish_client_handle client, const uuid_t app_uuid); 177 178 178 179 void ladish_graph_dump(ladish_graph_handle graph_handle); -
daemon/port.c
r2eac623 r79c75fd0 32 32 int refcount; 33 33 uuid_t uuid; /* The UUID of the port */ 34 uuid_t app_uuid; /* The UUID of the app that owns this client */ 34 35 bool link; /* Whether the port is studio-room link port */ 35 36 uint64_t jack_id; /* JACK port ID. */ … … 72 73 } 73 74 75 uuid_clear(port_ptr->app_uuid); 76 74 77 port_ptr->jack_id = 0; 75 78 port_ptr->jack_id_room = 0; … … 170 173 } 171 174 175 void ladish_port_set_app(ladish_port_handle port_handle, const uuid_t app_uuid) 176 { 177 uuid_copy(port_ptr->app_uuid, app_uuid); 178 } 179 180 bool ladish_port_get_app(ladish_port_handle port_handle, uuid_t app_uuid) 181 { 182 if (uuid_is_null(port_ptr->app_uuid)) 183 { 184 return false; 185 } 186 187 uuid_copy(app_uuid, port_ptr->app_uuid); 188 return true; 189 } 190 191 bool ladish_port_has_app(ladish_port_handle port_handle) 192 { 193 return !uuid_is_null(port_ptr->app_uuid); 194 } 195 196 bool ladish_port_belongs_to_app(ladish_port_handle port_handle, const uuid_t app_uuid) 197 { 198 if (uuid_is_null(port_ptr->app_uuid)) 199 { 200 return false; 201 } 202 203 return uuid_compare(port_ptr->app_uuid, app_uuid) == 0; 204 } 205 172 206 #undef port_ptr -
daemon/port.h
r2eac623 r79c75fd0 51 51 void * ladish_port_get_vgraph(ladish_port_handle port_handle); 52 52 53 void ladish_port_set_app(ladish_port_handle port, const uuid_t app_uuid); 54 bool ladish_port_get_app(ladish_port_handle port, uuid_t app_uuid); 55 bool ladish_port_has_app(ladish_port_handle port); 56 bool ladish_port_belongs_to_app(ladish_port_handle port, const uuid_t app_uuid); 57 53 58 #endif /* #ifndef PORT_H__62F81E7C_91FA_44AB_94A9_E0E2D226ED58__INCLUDED */ -
daemon/virtualizer.c
r7d3acd7 r79c75fd0 217 217 { 218 218 ladish_port_handle port; 219 ladish_client_handle jclient;220 219 ladish_graph_handle vgraph; 221 220 … … 227 226 } 228 227 229 jclient = ladish_graph_get_port_client(virtualizer_ptr->jack_graph, port); 230 if (jclient == NULL) 231 { 232 log_error("Port %"PRIu64" without jack client was (dis)connected", port_id); 233 return false; 234 } 235 236 vgraph = ladish_client_get_vgraph(jclient); 228 vgraph = ladish_port_get_vgraph(port); 237 229 if (vgraph == NULL) 238 230 { … … 628 620 } 629 621 622 /* for normal ports, one can find the app_uuid through the jack client, 623 but for a2j ports the jack client is shared between graphs */ 624 if (has_app) 625 { 626 ladish_port_set_app(port, app_uuid); 627 } 628 630 629 ladish_client_set_jack_id(vclient, client_id); 631 630 ladish_graph_adjust_port(vgraph, port, type, flags); … … 643 642 ladish_port_set_jack_id(port, port_id); 644 643 645 /* for normal ports, one can find the vgraph through the jack client,644 /* for normal ports, one can find the vgraph and app_uuid through the jack client, 646 645 but for a2j ports the jack client is shared between graphs */ 647 646 ladish_port_set_vgraph(port, vgraph); 647 if (has_app) 648 { 649 ladish_port_set_app(port, app_uuid); 650 } 648 651 649 652 if (!ladish_graph_add_port(virtualizer_ptr->jack_graph, jack_client, port, jack_port_name, type, flags, false)) … … 1100 1103 } 1101 1104 1105 static bool app_has_a2j_ports(ladish_graph_handle jack_graph, const uuid_t app_uuid) 1106 { 1107 ladish_client_handle a2jclient; 1108 1109 a2jclient = ladish_graph_find_client_by_uuid(jack_graph, g_a2j_uuid); 1110 if (a2jclient == NULL) 1111 { 1112 return false; 1113 } 1114 1115 return ladish_graph_client_has_visible_app_port(jack_graph, a2jclient, app_uuid); 1116 } 1117 1102 1118 bool 1103 1119 ladish_virtualizer_is_hidden_app( … … 1116 1132 //ladish_graph_dump(g_studio.jack_graph); 1117 1133 1134 if (app_has_a2j_ports(jack_graph, app_uuid)) 1135 { 1136 log_info("app '%s' still has a2j ports", app_name); 1137 return false; 1138 } 1139 1118 1140 jclient = ladish_graph_find_client_by_app(jack_graph, app_uuid); 1119 1141 if (jclient == NULL) … … 1177 1199 return true; 1178 1200 } 1201 1202 struct app_remove_context 1203 { 1204 uuid_t app_uuid; 1205 const char * app_name; 1206 }; 1207 1208 #define app_info_ptr ((struct app_remove_context *)context) 1209 1210 static 1211 bool 1212 remove_app_port( 1213 void * context, 1214 ladish_graph_handle graph_handle, 1215 void * client_iteration_context_ptr, 1216 ladish_client_handle client_handle, 1217 const char * client_name, 1218 ladish_port_handle port_handle, 1219 const char * port_name, 1220 uint32_t port_type, 1221 uint32_t port_flags) 1222 { 1223 ladish_graph_handle vgraph; 1224 ladish_client_handle vclient; 1225 1226 if (!ladish_port_belongs_to_app(port_handle, app_info_ptr->app_uuid)) 1227 { 1228 return true; 1229 } 1230 1231 //log_info("removing port '%s':'%s' (JACK) of app '%s'", client_name, port_name, app_info_ptr->app_name); 1232 1233 vgraph = ladish_port_get_vgraph(port_handle); 1234 if (vgraph == NULL) 1235 { 1236 log_error("port '%s':'%s' of app '5s' has no vgraph", client_name, port_name, app_info_ptr->app_name); 1237 ASSERT_NO_PASS; 1238 return true; 1239 } 1240 1241 vclient = ladish_graph_get_port_client(vgraph, port_handle); 1242 if (vgraph == NULL) 1243 { 1244 log_error("app port '%s':'%s' not found in vgraph '%s'", client_name, port_name, ladish_graph_get_description(vgraph)); 1245 ASSERT_NO_PASS; 1246 return true; 1247 } 1248 1249 log_info( 1250 "removing %s %s port %p of app '%s' ('%s':'%s' in %s)", 1251 port_type == JACKDBUS_PORT_TYPE_AUDIO ? "audio" : "midi", 1252 JACKDBUS_PORT_IS_INPUT(port_flags) ? "input" : "output", 1253 port_handle, 1254 app_info_ptr->app_name, 1255 ladish_graph_get_client_name(vgraph, vclient), 1256 ladish_graph_get_port_name(vgraph, port_handle), 1257 ladish_graph_get_description(vgraph)); 1258 1259 return true; 1260 } 1261 1262 #undef app_info_ptr 1179 1263 1180 1264 void … … 1191 1275 uuid_t jclient_uuid; 1192 1276 bool is_a2j; 1277 struct app_remove_context ctx; 1193 1278 1194 1279 //ladish_graph_dump(g_studio.jack_graph); 1280 1281 uuid_copy(ctx.app_uuid, app_uuid); 1282 ctx.app_name = app_name; 1283 1284 ladish_graph_iterate_nodes(jack_graph, false, NULL, &ctx, NULL, remove_app_port, NULL); 1195 1285 1196 1286 jclient = ladish_graph_find_client_by_app(jack_graph, app_uuid);
