root/daemon/graph.h @ dd822c7476d99ae99aae0264ab774609ed0ef896

Revision dd822c7476d99ae99aae0264ab774609ed0ef896, 8.8 KB (checked in by Nedko Arnaudov <nedko@…>, 3 years ago)

daemon: fix load of studios with more than one room

The room link ports were searched by uuid gloablly.
When two rooms had same ports uuid, always the first one was found.
Then when setting the graph override uuid for port, the port
override uuid of the second room was set over the port of the first
room. Thus the first room port was getting wrong override uuid and the
second room port override uuid was never set.

The solution implemented is to search for the port within the already
found room client. Then set the override uuid for the found port.

Room client in the studio graph has uuid of the room and is created
when room is loaded. This ensures that later when room-link ports are
added, the port of the right room client will be found. Then the
override uuid will be set to the proper port.

  • Property mode set to 100644
Line 
1/* -*- Mode: C ; c-basic-offset: 2 -*- */
2/*
3 * LADI Session Handler (ladish)
4 *
5 * Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
6 *
7 **************************************************************************
8 * This file contains interface to the D-Bus patchbay interface helpers
9 **************************************************************************
10 *
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26
27#ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
28#define PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
29
30#include "client.h"
31#include "port.h"
32
33typedef struct ladish_graph_tag { int unused; } * ladish_graph_handle;
34
35typedef
36bool
37(* ladish_graph_connect_request_handler)(
38  void * context,
39  ladish_graph_handle graph_handle,
40  ladish_port_handle port1,
41  ladish_port_handle port2);
42
43typedef
44bool
45(* ladish_graph_disconnect_request_handler)(
46  void * context,
47  ladish_graph_handle graph_handle,
48  uint64_t connection_id);
49
50typedef void (* ladish_graph_simple_port_callback)(ladish_port_handle port_handle);
51
52bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * opath);
53bool ladish_graph_copy(ladish_graph_handle src, ladish_graph_handle dest, bool skip_hidden);
54void ladish_graph_destroy(ladish_graph_handle graph_handle);
55
56const char * ladish_graph_get_opath(ladish_graph_handle graph_handle);
57const char * ladish_graph_get_description(ladish_graph_handle graph_handle);
58
59void
60ladish_graph_set_connection_handlers(
61  ladish_graph_handle graph_handle,
62  void * graph_context,
63  ladish_graph_connect_request_handler connect_handler,
64  ladish_graph_disconnect_request_handler disconnect_handler);
65
66void ladish_graph_clear(ladish_graph_handle graph_handle, ladish_graph_simple_port_callback port_callback);
67void * ladish_graph_get_dbus_context(ladish_graph_handle graph_handle);
68ladish_dict_handle ladish_graph_get_dict(ladish_graph_handle graph_handle);
69ladish_dict_handle ladish_graph_get_connection_dict(ladish_graph_handle graph_handle, uint64_t connection_id);
70bool ladish_graph_add_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, bool hidden);
71
72void
73ladish_graph_remove_client(
74  ladish_graph_handle graph_handle,
75  ladish_client_handle client_handle);
76
77bool
78ladish_graph_rename_client(
79  ladish_graph_handle graph_handle,
80  ladish_client_handle client_handle,
81  const char * new_client_name);
82
83bool
84ladish_graph_add_port(
85  ladish_graph_handle graph_handle,
86  ladish_client_handle client_handle,
87  ladish_port_handle port_handle,
88  const char * name,
89  uint32_t type,
90  uint32_t flags,
91  bool hidden);
92
93ladish_client_handle
94ladish_graph_remove_port(
95  ladish_graph_handle graph_handle,
96  ladish_port_handle port_handle);
97
98ladish_client_handle
99ladish_graph_remove_port_by_jack_id(
100  ladish_graph_handle graph_handle,
101  uint64_t jack_port_id,
102  bool room,
103  bool studio);
104
105bool
106ladish_graph_rename_port(
107  ladish_graph_handle graph_handle,
108  ladish_port_handle port_handle,
109  const char * new_port_name);
110
111uint64_t
112ladish_graph_add_connection(
113  ladish_graph_handle graph_handle,
114  ladish_port_handle port1_handle,
115  ladish_port_handle port2_handle,
116  bool hidden);
117
118void
119ladish_graph_remove_connection(
120  ladish_graph_handle graph_handle,
121  uint64_t connection_id,
122  bool force);
123
124bool
125ladish_graph_get_connection_ports(
126  ladish_graph_handle graph_handle,
127  uint64_t connection_id,
128  ladish_port_handle * port1_handle_ptr,
129  ladish_port_handle * port2_handle_ptr);
130
131bool
132ladish_graph_find_connection(
133  ladish_graph_handle graph_handle,
134  ladish_port_handle port1_handle,
135  ladish_port_handle port2_handle,
136  uint64_t * connection_id_ptr);
137
138ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id);
139ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id);
140ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id);
141ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id, bool room, bool studio);
142ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name, bool appless);
143ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_handle, const uuid_t app_uuid);
144ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name);
145ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
146ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids);
147
148ladish_port_handle
149ladish_graph_find_client_port_by_uuid(
150  ladish_graph_handle graph,
151  ladish_client_handle client,
152  const uuid_t uuid,
153  bool use_link_override_uuids);
154
155void
156ladish_graph_set_link_port_override_uuid(
157  ladish_graph_handle graph,
158  ladish_port_handle port,
159  const uuid_t override_uuid);
160
161ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
162const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
163const char * ladish_graph_get_port_name(ladish_graph_handle graph, ladish_port_handle port);
164bool ladish_graph_client_is_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
165bool ladish_graph_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
166bool ladish_graph_client_is_hidden(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
167bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
168void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
169void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
170void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
171void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
172void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags);
173void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id);
174void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
175void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle);
176void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr);
177
178void ladish_graph_dump(ladish_graph_handle graph_handle);
179
180bool
181ladish_graph_iterate_nodes(
182  ladish_graph_handle graph_handle,
183  bool skip_hidden,
184  void * vgraph_filter,
185  void * callback_context,
186  bool
187  (* client_begin_callback)(
188    void * context,
189    ladish_graph_handle graph_handle,
190    ladish_client_handle client_handle,
191    const char * client_name,
192    void ** client_iteration_context_ptr_ptr),
193  bool
194  (* port_callback)(
195    void * context,
196    ladish_graph_handle graph_handle,
197    void * client_iteration_context_ptr,
198    ladish_client_handle client_handle,
199    const char * client_name,
200    ladish_port_handle port_handle,
201    const char * port_name,
202    uint32_t port_type,
203    uint32_t port_flags),
204  bool
205  (* client_end_callback)(
206    void * context,
207    ladish_graph_handle graph_handle,
208    ladish_client_handle client_handle,
209    const char * client_name,
210    void * client_iteration_context_ptr));
211
212bool
213ladish_graph_iterate_connections(
214  ladish_graph_handle graph_handle,
215  bool skip_hidden,
216  void * callback_context,
217  bool (* callback)(
218    void * context,
219    ladish_graph_handle graph_handle,
220    ladish_port_handle port1_handle,
221    ladish_port_handle port2_handle,
222    ladish_dict_handle dict));
223
224void ladish_graph_clear_persist(ladish_graph_handle graph_handle);
225void ladish_graph_set_persist(ladish_graph_handle graph_handle);
226bool ladish_graph_is_persist(ladish_graph_handle graph_handle);
227bool ladish_graph_looks_empty(ladish_graph_handle graph_handle);
228
229extern const struct dbus_interface_descriptor g_interface_patchbay;
230
231#endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */
Note: See TracBrowser for help on using the browser.