Changeset 23b1a8fa1e9204ef6d158984ead16a6c140dd849
- Timestamp:
- 11/28/09 19:46:43 (3 years ago)
- Children:
- effcdfca2735395c8d3c9a6b2f0e1181ab4e47b5
- Parents:
- 5955c05ca0b0a78226476b125dde072e81e7b77c
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2009-11-28T19:46:43Z+0200
- Location:
- daemon
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
daemon/graph.c
r5955c05 r23b1a8f 54 54 }; 55 55 56 struct ladish_graph_connection 57 { 58 struct list_head siblings; 59 uint64_t id; 60 bool hidden; 61 struct ladish_graph_port * port1_ptr; 62 struct ladish_graph_port * port2_ptr; 63 }; 64 56 65 struct ladish_graph 57 66 { … … 60 69 struct list_head clients; 61 70 struct list_head ports; 71 struct list_head connections; 62 72 uint64_t graph_version; 63 73 uint64_t next_client_id; … … 135 145 struct ladish_graph_port * port_ptr; 136 146 DBusMessageIter port_struct_iter; 137 //DBusMessageIter connection_struct_iter; 147 struct list_head * connection_node_ptr; 148 struct ladish_graph_connection * connection_ptr; 149 DBusMessageIter connection_struct_iter; 138 150 139 151 //log_info("get_graph() called"); … … 275 287 if (known_version < current_version) 276 288 { 277 #if 0 278 list_for_each(connection_node_ptr, &patchbay_ptr->graph.connections) 279 { 280 connection_ptr = list_entry(connection_node_ptr, struct jack_graph_connection, siblings); 289 list_for_each(connection_node_ptr, &graph_ptr->connections) 290 { 291 connection_ptr = list_entry(connection_node_ptr, struct ladish_graph_connection, siblings); 281 292 282 293 if (!dbus_message_iter_open_container(&connections_array_iter, DBUS_TYPE_STRUCT, NULL, &connection_struct_iter)) … … 285 296 } 286 297 287 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1 ->client->id))298 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1_ptr->client_ptr->id)) 288 299 { 289 300 goto nomem_close_connection_struct; 290 301 } 291 302 292 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1 ->client->name))303 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1_ptr->client_ptr->name)) 293 304 { 294 305 goto nomem_close_connection_struct; 295 306 } 296 307 297 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1 ->id))308 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1_ptr->id)) 298 309 { 299 310 goto nomem_close_connection_struct; 300 311 } 301 312 302 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1 ->name))313 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1_ptr->name)) 303 314 { 304 315 goto nomem_close_connection_struct; 305 316 } 306 317 307 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2 ->client->id))318 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2_ptr->client_ptr->id)) 308 319 { 309 320 goto nomem_close_connection_struct; 310 321 } 311 322 312 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2 ->client->name))323 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2_ptr->client_ptr->name)) 313 324 { 314 325 goto nomem_close_connection_struct; 315 326 } 316 327 317 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2 ->id))328 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2_ptr->id)) 318 329 { 319 330 goto nomem_close_connection_struct; 320 331 } 321 332 322 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2 ->name))333 if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2_ptr->name)) 323 334 { 324 335 goto nomem_close_connection_struct; … … 335 346 } 336 347 } 337 #endif338 348 } 339 349 … … 345 355 return; 346 356 347 #if 0348 357 nomem_close_connection_struct: 349 358 dbus_message_iter_close_container(&connections_array_iter, &connection_struct_iter); … … 351 360 nomem_close_connections_array: 352 361 dbus_message_iter_close_container(&iter, &connections_array_iter); 353 goto nomem_unlock; 354 #endif 362 goto nomem; 355 363 356 364 nomem_close_port_struct: … … 504 512 INIT_LIST_HEAD(&graph_ptr->clients); 505 513 INIT_LIST_HEAD(&graph_ptr->ports); 514 INIT_LIST_HEAD(&graph_ptr->connections); 506 515 507 516 graph_ptr->graph_version = 1; … … 1007 1016 &flags, 1008 1017 &type); 1018 } 1019 1020 return true; 1021 } 1022 1023 bool 1024 ladish_graph_add_connection( 1025 ladish_graph_handle graph_handle, 1026 ladish_port_handle port1_handle, 1027 ladish_port_handle port2_handle, 1028 bool hidden) 1029 { 1030 struct ladish_graph_port * port1_ptr; 1031 struct ladish_graph_port * port2_ptr; 1032 struct ladish_graph_connection * connection_ptr; 1033 1034 port1_ptr = ladish_graph_find_port(graph_ptr, port1_handle); 1035 ASSERT(port1_ptr != NULL); 1036 port2_ptr = ladish_graph_find_port(graph_ptr, port2_handle); 1037 ASSERT(port2_ptr != NULL); 1038 1039 connection_ptr = malloc(sizeof(struct ladish_graph_connection)); 1040 if (connection_ptr == NULL) 1041 { 1042 log_error("malloc() failed for struct ladish_graph_connection"); 1043 return false; 1044 } 1045 1046 connection_ptr->id = graph_ptr->next_connection_id++; 1047 connection_ptr->port1_ptr = port1_ptr; 1048 connection_ptr->port2_ptr = port2_ptr; 1049 connection_ptr->hidden = hidden; 1050 graph_ptr->graph_version++; 1051 1052 list_add_tail(&connection_ptr->siblings, &graph_ptr->connections); 1053 1054 if (!hidden && graph_ptr->opath != NULL) 1055 { 1056 dbus_signal_emit( 1057 g_dbus_connection, 1058 graph_ptr->opath, 1059 JACKDBUS_IFACE_PATCHBAY, 1060 "PortsConnected", 1061 "ttstststst", 1062 &graph_ptr->graph_version, 1063 &port1_ptr->client_ptr->id, 1064 &port1_ptr->client_ptr->name, 1065 &port1_ptr->id, 1066 &port1_ptr->name, 1067 &port2_ptr->client_ptr->id, 1068 &port2_ptr->client_ptr->name, 1069 &port2_ptr->id, 1070 &port2_ptr->name, 1071 &connection_ptr->id); 1009 1072 } 1010 1073 -
daemon/graph.h
r5955c05 r23b1a8f 84 84 ladish_port_handle port_handle); 85 85 86 bool 87 ladish_graph_add_connection( 88 ladish_graph_handle graph_handle, 89 ladish_port_handle port1_handle, 90 ladish_port_handle port2_handle, 91 bool hidden); 92 86 93 ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id); 87 94 ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id); -
daemon/virtualizer.c
r5955c05 r23b1a8f 273 273 274 274 port = ladish_graph_find_port_by_jack_id(virtualizer_ptr->jack_graph, port_id); 275 if ( client == NULL)275 if (port == NULL) 276 276 { 277 277 log_error("Unknown JACK port with id %"PRIu64" disappeared", port_id); … … 315 315 static bool ports_connect_request(void * context, ladish_graph_handle graph_handle, ladish_port_handle port1, ladish_port_handle port2) 316 316 { 317 uint64_t port1_id; 318 uint64_t port2_id; 319 317 320 ASSERT(graph_handle == virtualizer_ptr->studio_graph); 318 321 log_info("virtualizer: ports connect request"); 319 return false; 322 323 port1_id = ladish_port_get_jack_id(port1); 324 port2_id = ladish_port_get_jack_id(port2); 325 326 graph_proxy_connect_ports(virtualizer_ptr->jack_graph_proxy, port1_id, port2_id); 327 328 return true; 320 329 } 321 330 … … 329 338 static void ports_connected(void * context, uint64_t client1_id, uint64_t port1_id, uint64_t client2_id, uint64_t port2_id) 330 339 { 331 log_info("ports_connected"); 340 ladish_port_handle port1; 341 ladish_port_handle port2; 342 343 log_info("ports_connected %"PRIu64":%"PRIu64" %"PRIu64":%"PRIu64"", client1_id, port1_id, client2_id, port2_id); 344 345 port1 = ladish_graph_find_port_by_jack_id(virtualizer_ptr->jack_graph, port1_id); 346 if (port1 == NULL) 347 { 348 log_error("Unknown JACK port with id %"PRIu64" connected", port1_id); 349 return; 350 } 351 352 port2 = ladish_graph_find_port_by_jack_id(virtualizer_ptr->jack_graph, port2_id); 353 if (port2 == NULL) 354 { 355 log_error("Unknown JACK port with id %"PRIu64" connected", port2_id); 356 return; 357 } 358 359 ladish_graph_add_connection(virtualizer_ptr->jack_graph, port1, port2, false); 360 ladish_graph_add_connection(virtualizer_ptr->studio_graph, port1, port2, false); 332 361 } 333 362
