| 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 | |
|---|
| 33 | typedef struct ladish_graph_tag { int unused; } * ladish_graph_handle; |
|---|
| 34 | |
|---|
| 35 | typedef |
|---|
| 36 | bool |
|---|
| 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 | |
|---|
| 43 | typedef |
|---|
| 44 | bool |
|---|
| 45 | (* ladish_graph_disconnect_request_handler)( |
|---|
| 46 | void * context, |
|---|
| 47 | ladish_graph_handle graph_handle, |
|---|
| 48 | uint64_t connection_id); |
|---|
| 49 | |
|---|
| 50 | typedef void (* ladish_graph_simple_port_callback)(ladish_port_handle port_handle); |
|---|
| 51 | |
|---|
| 52 | bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * opath); |
|---|
| 53 | bool ladish_graph_copy(ladish_graph_handle src, ladish_graph_handle dest, bool skip_hidden); |
|---|
| 54 | void ladish_graph_destroy(ladish_graph_handle graph_handle); |
|---|
| 55 | |
|---|
| 56 | const char * ladish_graph_get_opath(ladish_graph_handle graph_handle); |
|---|
| 57 | const char * ladish_graph_get_description(ladish_graph_handle graph_handle); |
|---|
| 58 | |
|---|
| 59 | void |
|---|
| 60 | ladish_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 | |
|---|
| 66 | void ladish_graph_clear(ladish_graph_handle graph_handle, ladish_graph_simple_port_callback port_callback); |
|---|
| 67 | void * ladish_graph_get_dbus_context(ladish_graph_handle graph_handle); |
|---|
| 68 | ladish_dict_handle ladish_graph_get_dict(ladish_graph_handle graph_handle); |
|---|
| 69 | ladish_dict_handle ladish_graph_get_connection_dict(ladish_graph_handle graph_handle, uint64_t connection_id); |
|---|
| 70 | bool ladish_graph_add_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, bool hidden); |
|---|
| 71 | |
|---|
| 72 | void |
|---|
| 73 | ladish_graph_remove_client( |
|---|
| 74 | ladish_graph_handle graph_handle, |
|---|
| 75 | ladish_client_handle client_handle); |
|---|
| 76 | |
|---|
| 77 | bool |
|---|
| 78 | ladish_graph_rename_client( |
|---|
| 79 | ladish_graph_handle graph_handle, |
|---|
| 80 | ladish_client_handle client_handle, |
|---|
| 81 | const char * new_client_name); |
|---|
| 82 | |
|---|
| 83 | bool |
|---|
| 84 | ladish_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 | |
|---|
| 93 | ladish_client_handle |
|---|
| 94 | ladish_graph_remove_port( |
|---|
| 95 | ladish_graph_handle graph_handle, |
|---|
| 96 | ladish_port_handle port_handle); |
|---|
| 97 | |
|---|
| 98 | ladish_client_handle |
|---|
| 99 | ladish_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 | |
|---|
| 105 | bool |
|---|
| 106 | ladish_graph_rename_port( |
|---|
| 107 | ladish_graph_handle graph_handle, |
|---|
| 108 | ladish_port_handle port_handle, |
|---|
| 109 | const char * new_port_name); |
|---|
| 110 | |
|---|
| 111 | uint64_t |
|---|
| 112 | ladish_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 | |
|---|
| 118 | void |
|---|
| 119 | ladish_graph_remove_connection( |
|---|
| 120 | ladish_graph_handle graph_handle, |
|---|
| 121 | uint64_t connection_id, |
|---|
| 122 | bool force); |
|---|
| 123 | |
|---|
| 124 | bool |
|---|
| 125 | ladish_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 | |
|---|
| 131 | bool |
|---|
| 132 | ladish_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 | |
|---|
| 138 | ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id); |
|---|
| 139 | ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id); |
|---|
| 140 | ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id); |
|---|
| 141 | ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id, bool room, bool studio); |
|---|
| 142 | ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name, bool appless); |
|---|
| 143 | ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_handle, const uuid_t app_uuid); |
|---|
| 144 | ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name); |
|---|
| 145 | ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid); |
|---|
| 146 | ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids); |
|---|
| 147 | |
|---|
| 148 | ladish_port_handle |
|---|
| 149 | ladish_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 | |
|---|
| 155 | void |
|---|
| 156 | ladish_graph_set_link_port_override_uuid( |
|---|
| 157 | ladish_graph_handle graph, |
|---|
| 158 | ladish_port_handle port, |
|---|
| 159 | const uuid_t override_uuid); |
|---|
| 160 | |
|---|
| 161 | ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle); |
|---|
| 162 | const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 163 | const char * ladish_graph_get_port_name(ladish_graph_handle graph, ladish_port_handle port); |
|---|
| 164 | bool ladish_graph_client_is_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 165 | bool ladish_graph_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 166 | bool ladish_graph_client_is_hidden(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 167 | bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle); |
|---|
| 168 | void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle); |
|---|
| 169 | void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle); |
|---|
| 170 | void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 171 | void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle); |
|---|
| 172 | void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags); |
|---|
| 173 | void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id); |
|---|
| 174 | void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle); |
|---|
| 175 | void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle); |
|---|
| 176 | void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr); |
|---|
| 177 | |
|---|
| 178 | void ladish_graph_dump(ladish_graph_handle graph_handle); |
|---|
| 179 | |
|---|
| 180 | bool |
|---|
| 181 | ladish_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 | |
|---|
| 212 | bool |
|---|
| 213 | ladish_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 | |
|---|
| 224 | void ladish_graph_clear_persist(ladish_graph_handle graph_handle); |
|---|
| 225 | void ladish_graph_set_persist(ladish_graph_handle graph_handle); |
|---|
| 226 | bool ladish_graph_is_persist(ladish_graph_handle graph_handle); |
|---|
| 227 | bool ladish_graph_looks_empty(ladish_graph_handle graph_handle); |
|---|
| 228 | |
|---|
| 229 | void ladish_graph_trick_dicts(ladish_graph_handle graph_handle); |
|---|
| 230 | |
|---|
| 231 | extern const struct dbus_interface_descriptor g_interface_patchbay; |
|---|
| 232 | |
|---|
| 233 | #endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */ |
|---|