]> code.delx.au - pulseaudio/blob - src/modules/dbus/iface-card.c
Merge remote branch 'coling/history'
[pulseaudio] / src / modules / dbus / iface-card.c
1 /***
2 This file is part of PulseAudio.
3
4 Copyright 2009 Tanu Kaskinen
5
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2.1 of the License,
9 or (at your option) any later version.
10
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA.
20 ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <dbus/dbus.h>
27
28 #include <pulsecore/core-util.h>
29 #include <pulsecore/dbus-util.h>
30 #include <pulsecore/protocol-dbus.h>
31
32 #include "iface-card-profile.h"
33
34 #include "iface-card.h"
35
36 #define OBJECT_NAME "card"
37
38 static void handle_get_index(DBusConnection *conn, DBusMessage *msg, void *userdata);
39 static void handle_get_name(DBusConnection *conn, DBusMessage *msg, void *userdata);
40 static void handle_get_driver(DBusConnection *conn, DBusMessage *msg, void *userdata);
41 static void handle_get_owner_module(DBusConnection *conn, DBusMessage *msg, void *userdata);
42 static void handle_get_sinks(DBusConnection *conn, DBusMessage *msg, void *userdata);
43 static void handle_get_sources(DBusConnection *conn, DBusMessage *msg, void *userdata);
44 static void handle_get_profiles(DBusConnection *conn, DBusMessage *msg, void *userdata);
45 static void handle_get_active_profile(DBusConnection *conn, DBusMessage *msg, void *userdata);
46 static void handle_set_active_profile(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata);
47 static void handle_get_property_list(DBusConnection *conn, DBusMessage *msg, void *userdata);
48
49 static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdata);
50
51 static void handle_get_profile_by_name(DBusConnection *conn, DBusMessage *msg, void *userdata);
52
53 struct pa_dbusiface_card {
54 pa_dbusiface_core *core;
55
56 pa_card *card;
57 char *path;
58 pa_hashmap *profiles;
59 uint32_t next_profile_index;
60 pa_card_profile *active_profile;
61 pa_proplist *proplist;
62
63 pa_dbus_protocol *dbus_protocol;
64 pa_subscription *subscription;
65 };
66
67 enum property_handler_index {
68 PROPERTY_HANDLER_INDEX,
69 PROPERTY_HANDLER_NAME,
70 PROPERTY_HANDLER_DRIVER,
71 PROPERTY_HANDLER_OWNER_MODULE,
72 PROPERTY_HANDLER_SINKS,
73 PROPERTY_HANDLER_SOURCES,
74 PROPERTY_HANDLER_PROFILES,
75 PROPERTY_HANDLER_ACTIVE_PROFILE,
76 PROPERTY_HANDLER_PROPERTY_LIST,
77 PROPERTY_HANDLER_MAX
78 };
79
80 static pa_dbus_property_handler property_handlers[PROPERTY_HANDLER_MAX] = {
81 [PROPERTY_HANDLER_INDEX] = { .property_name = "Index", .type = "u", .get_cb = handle_get_index, .set_cb = NULL },
82 [PROPERTY_HANDLER_NAME] = { .property_name = "Name", .type = "s", .get_cb = handle_get_name, .set_cb = NULL },
83 [PROPERTY_HANDLER_DRIVER] = { .property_name = "Driver", .type = "s", .get_cb = handle_get_driver, .set_cb = NULL },
84 [PROPERTY_HANDLER_OWNER_MODULE] = { .property_name = "OwnerModule", .type = "o", .get_cb = handle_get_owner_module, .set_cb = NULL },
85 [PROPERTY_HANDLER_SINKS] = { .property_name = "Sinks", .type = "ao", .get_cb = handle_get_sinks, .set_cb = NULL },
86 [PROPERTY_HANDLER_SOURCES] = { .property_name = "Sources", .type = "ao", .get_cb = handle_get_sources, .set_cb = NULL },
87 [PROPERTY_HANDLER_PROFILES] = { .property_name = "Profiles", .type = "ao", .get_cb = handle_get_profiles, .set_cb = NULL },
88 [PROPERTY_HANDLER_ACTIVE_PROFILE] = { .property_name = "ActiveProfile", .type = "o", .get_cb = handle_get_active_profile, .set_cb = handle_set_active_profile },
89 [PROPERTY_HANDLER_PROPERTY_LIST] = { .property_name = "PropertyList", .type = "a{say}", .get_cb = handle_get_property_list, .set_cb = NULL }
90 };
91
92 enum method_handler_index {
93 METHOD_HANDLER_GET_PROFILE_BY_NAME,
94 METHOD_HANDLER_MAX
95 };
96
97 static pa_dbus_arg_info get_profile_by_name_args[] = { { "name", "s", "in" }, { "profile", "o", "out" } };
98
99 static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
100 [METHOD_HANDLER_GET_PROFILE_BY_NAME] = {
101 .method_name = "GetProfileByName",
102 .arguments = get_profile_by_name_args,
103 .n_arguments = sizeof(get_profile_by_name_args) / sizeof(pa_dbus_arg_info),
104 .receive_cb = handle_get_profile_by_name }
105 };
106
107 enum signal_index {
108 SIGNAL_ACTIVE_PROFILE_UPDATED,
109 SIGNAL_PROPERTY_LIST_UPDATED,
110 SIGNAL_MAX
111 };
112
113 static pa_dbus_arg_info active_profile_updated_args[] = { { "profile", "o", NULL } };
114 static pa_dbus_arg_info property_list_updated_args[] = { { "property_list", "a{say}", NULL } };
115
116 static pa_dbus_signal_info signals[SIGNAL_MAX] = {
117 [SIGNAL_ACTIVE_PROFILE_UPDATED] = { .name = "ActiveProfileUpdated", .arguments = active_profile_updated_args, .n_arguments = 1 },
118 [SIGNAL_PROPERTY_LIST_UPDATED] = { .name = "PropertyListUpdated", .arguments = property_list_updated_args, .n_arguments = 1 }
119 };
120
121 static pa_dbus_interface_info card_interface_info = {
122 .name = PA_DBUSIFACE_CARD_INTERFACE,
123 .method_handlers = method_handlers,
124 .n_method_handlers = METHOD_HANDLER_MAX,
125 .property_handlers = property_handlers,
126 .n_property_handlers = PROPERTY_HANDLER_MAX,
127 .get_all_properties_cb = handle_get_all,
128 .signals = signals,
129 .n_signals = SIGNAL_MAX
130 };
131
132 static void handle_get_index(DBusConnection *conn, DBusMessage *msg, void *userdata) {
133 pa_dbusiface_card *c = userdata;
134 dbus_uint32_t idx;
135
136 pa_assert(conn);
137 pa_assert(msg);
138 pa_assert(c);
139
140 idx = c->card->index;
141
142 pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_UINT32, &idx);
143 }
144
145 static void handle_get_name(DBusConnection *conn, DBusMessage *msg, void *userdata) {
146 pa_dbusiface_card *c = userdata;
147
148 pa_assert(conn);
149 pa_assert(msg);
150 pa_assert(c);
151
152 pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_STRING, &c->card->name);
153 }
154
155 static void handle_get_driver(DBusConnection *conn, DBusMessage *msg, void *userdata) {
156 pa_dbusiface_card *c = userdata;
157
158 pa_assert(conn);
159 pa_assert(msg);
160 pa_assert(c);
161
162 pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_STRING, &c->card->driver);
163 }
164
165 static void handle_get_owner_module(DBusConnection *conn, DBusMessage *msg, void *userdata) {
166 pa_dbusiface_card *c = userdata;
167 const char *owner_module;
168
169 pa_assert(conn);
170 pa_assert(msg);
171 pa_assert(c);
172
173 if (!c->card->module) {
174 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NO_SUCH_PROPERTY, "Card %s doesn't have an owner module.", c->card->name);
175 return;
176 }
177
178 owner_module = pa_dbusiface_core_get_module_path(c->core, c->card->module);
179
180 pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, &owner_module);
181 }
182
183 /* The caller frees the array, but not the strings. */
184 static const char **get_sinks(pa_dbusiface_card *c, unsigned *n) {
185 const char **sinks = NULL;
186 unsigned i = 0;
187 uint32_t idx = 0;
188 pa_sink *sink = NULL;
189
190 pa_assert(c);
191 pa_assert(n);
192
193 *n = pa_idxset_size(c->card->sinks);
194
195 if (*n == 0)
196 return NULL;
197
198 sinks = pa_xnew(const char *, *n);
199
200 PA_IDXSET_FOREACH(sink, c->card->sinks, idx) {
201 sinks[i] = pa_dbusiface_core_get_sink_path(c->core, sink);
202 ++i;
203 }
204
205 return sinks;
206 }
207
208 static void handle_get_sinks(DBusConnection *conn, DBusMessage *msg, void *userdata) {
209 pa_dbusiface_card *c = userdata;
210 const char **sinks;
211 unsigned n_sinks;
212
213 pa_assert(conn);
214 pa_assert(msg);
215 pa_assert(c);
216
217 sinks = get_sinks(c, &n_sinks);
218
219 pa_dbus_send_basic_array_variant_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, sinks, n_sinks);
220
221 pa_xfree(sinks);
222 }
223
224 /* The caller frees the array, but not the strings. */
225 static const char **get_sources(pa_dbusiface_card *c, unsigned *n) {
226 const char **sources = NULL;
227 unsigned i = 0;
228 uint32_t idx = 0;
229 pa_source *source = NULL;
230
231 pa_assert(c);
232 pa_assert(n);
233
234 *n = pa_idxset_size(c->card->sources);
235
236 if (*n == 0)
237 return NULL;
238
239 sources = pa_xnew(const char *, *n);
240
241 PA_IDXSET_FOREACH(source, c->card->sinks, idx) {
242 sources[i] = pa_dbusiface_core_get_source_path(c->core, source);
243 ++i;
244 }
245
246 return sources;
247 }
248
249 static void handle_get_sources(DBusConnection *conn, DBusMessage *msg, void *userdata) {
250 pa_dbusiface_card *c = userdata;
251 const char **sources;
252 unsigned n_sources;
253
254 pa_assert(conn);
255 pa_assert(msg);
256 pa_assert(c);
257
258 sources = get_sources(c, &n_sources);
259
260 pa_dbus_send_basic_array_variant_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, sources, n_sources);
261
262 pa_xfree(sources);
263 }
264
265 /* The caller frees the array, but not the strings. */
266 static const char **get_profiles(pa_dbusiface_card *c, unsigned *n) {
267 const char **profiles;
268 unsigned i = 0;
269 void *state = NULL;
270 pa_dbusiface_card_profile *profile;
271
272 pa_assert(c);
273 pa_assert(n);
274
275 *n = pa_hashmap_size(c->profiles);
276
277 if (*n == 0)
278 return NULL;
279
280 profiles = pa_xnew(const char *, *n);
281
282 PA_HASHMAP_FOREACH(profile, c->profiles, state)
283 profiles[i++] = pa_dbusiface_card_profile_get_path(profile);
284
285 return profiles;
286 }
287
288 static void handle_get_profiles(DBusConnection *conn, DBusMessage *msg, void *userdata) {
289 pa_dbusiface_card *c = userdata;
290 const char **profiles;
291 unsigned n_profiles;
292
293 pa_assert(conn);
294 pa_assert(msg);
295 pa_assert(c);
296
297 profiles = get_profiles(c, &n_profiles);
298
299 pa_dbus_send_basic_array_variant_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, profiles, n_profiles);
300
301 pa_xfree(profiles);
302 }
303
304 static void handle_get_active_profile(DBusConnection *conn, DBusMessage *msg, void *userdata) {
305 pa_dbusiface_card *c = userdata;
306 const char *active_profile;
307
308 pa_assert(conn);
309 pa_assert(msg);
310 pa_assert(c);
311
312 if (!c->active_profile) {
313 pa_assert(pa_hashmap_isempty(c->profiles));
314
315 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NO_SUCH_PROPERTY,
316 "The card %s has no profiles, and therefore there's no active profile either.", c->card->name);
317 return;
318 }
319
320 active_profile = pa_dbusiface_card_profile_get_path(pa_hashmap_get(c->profiles, c->active_profile->name));
321
322 pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, &active_profile);
323 }
324
325 static void handle_set_active_profile(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) {
326 pa_dbusiface_card *c = userdata;
327 const char *new_active_path;
328 pa_dbusiface_card_profile *new_active;
329 int r;
330
331 pa_assert(conn);
332 pa_assert(msg);
333 pa_assert(iter);
334 pa_assert(c);
335
336 if (!c->active_profile) {
337 pa_assert(pa_hashmap_isempty(c->profiles));
338
339 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NO_SUCH_PROPERTY,
340 "The card %s has no profiles, and therefore there's no active profile either.",
341 c->card->name);
342 return;
343 }
344
345 dbus_message_iter_get_basic(iter, &new_active_path);
346
347 if (!(new_active = pa_hashmap_get(c->profiles, new_active_path))) {
348 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NOT_FOUND, "%s: No such profile.", new_active_path);
349 return;
350 }
351
352 if ((r = pa_card_set_profile(c->card, pa_dbusiface_card_profile_get_name(new_active), TRUE)) < 0) {
353 pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
354 "Internal error in PulseAudio: pa_card_set_profile() failed with error code %i.", r);
355 return;
356 }
357
358 pa_dbus_send_empty_reply(conn, msg);
359 }
360
361 static void handle_get_property_list(DBusConnection *conn, DBusMessage *msg, void *userdata) {
362 pa_dbusiface_card *c = userdata;
363
364 pa_assert(conn);
365 pa_assert(msg);
366 pa_assert(c);
367
368 pa_dbus_send_proplist_variant_reply(conn, msg, c->proplist);
369 }
370
371 static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdata) {
372 pa_dbusiface_card *c = userdata;
373 DBusMessage *reply = NULL;
374 DBusMessageIter msg_iter;
375 DBusMessageIter dict_iter;
376 dbus_uint32_t idx;
377 const char *owner_module = NULL;
378 const char **sinks = NULL;
379 unsigned n_sinks = 0;
380 const char **sources = NULL;
381 unsigned n_sources = 0;
382 const char **profiles = NULL;
383 unsigned n_profiles = 0;
384 const char *active_profile = NULL;
385
386 pa_assert(conn);
387 pa_assert(msg);
388 pa_assert(c);
389
390 idx = c->card->index;
391 if (c->card->module)
392 owner_module = pa_dbusiface_core_get_module_path(c->core, c->card->module);
393 sinks = get_sinks(c, &n_sinks);
394 sources = get_sources(c, &n_sources);
395 profiles = get_profiles(c, &n_profiles);
396 if (c->active_profile)
397 active_profile = pa_dbusiface_card_profile_get_path(pa_hashmap_get(c->profiles, c->active_profile->name));
398
399 pa_assert_se((reply = dbus_message_new_method_return(msg)));
400
401 dbus_message_iter_init_append(reply, &msg_iter);
402 pa_assert_se(dbus_message_iter_open_container(&msg_iter, DBUS_TYPE_ARRAY, "{sv}", &dict_iter));
403
404 pa_dbus_append_basic_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_INDEX].property_name, DBUS_TYPE_UINT32, &idx);
405 pa_dbus_append_basic_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_NAME].property_name, DBUS_TYPE_STRING, &c->card->name);
406 pa_dbus_append_basic_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_DRIVER].property_name, DBUS_TYPE_STRING, &c->card->driver);
407
408 if (owner_module)
409 pa_dbus_append_basic_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_OWNER_MODULE].property_name, DBUS_TYPE_OBJECT_PATH, &owner_module);
410
411 pa_dbus_append_basic_array_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_SINKS].property_name, DBUS_TYPE_OBJECT_PATH, sinks, n_sinks);
412 pa_dbus_append_basic_array_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_SOURCES].property_name, DBUS_TYPE_OBJECT_PATH, sources, n_sources);
413 pa_dbus_append_basic_array_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_PROFILES].property_name, DBUS_TYPE_OBJECT_PATH, profiles, n_profiles);
414
415 if (active_profile)
416 pa_dbus_append_basic_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_ACTIVE_PROFILE].property_name, DBUS_TYPE_OBJECT_PATH, &active_profile);
417
418 pa_dbus_append_proplist_variant_dict_entry(&dict_iter, property_handlers[PROPERTY_HANDLER_PROPERTY_LIST].property_name, c->proplist);
419
420 pa_assert_se(dbus_message_iter_close_container(&msg_iter, &dict_iter));
421
422 pa_assert_se(dbus_connection_send(conn, reply, NULL));
423
424 dbus_message_unref(reply);
425
426 pa_xfree(sinks);
427 pa_xfree(sources);
428 pa_xfree(profiles);
429 }
430
431 static void handle_get_profile_by_name(DBusConnection *conn, DBusMessage *msg, void *userdata) {
432 pa_dbusiface_card *c = userdata;
433 const char *profile_name = NULL;
434 pa_dbusiface_card_profile *profile = NULL;
435 const char *profile_path = NULL;
436
437 pa_assert(conn);
438 pa_assert(msg);
439 pa_assert(c);
440
441 pa_assert_se(dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &profile_name, DBUS_TYPE_INVALID));
442
443 if (!(profile = pa_hashmap_get(c->profiles, profile_name))) {
444 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NOT_FOUND, "%s: No such profile on card %s.", profile_name, c->card->name);
445 return;
446 }
447
448 profile_path = pa_dbusiface_card_profile_get_path(profile);
449
450 pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, &profile_path);
451 }
452
453 static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
454 pa_dbusiface_card *c = userdata;
455 DBusMessage *signal = NULL;
456
457 pa_assert(core);
458 pa_assert((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_CARD);
459 pa_assert(c);
460
461 /* We can't use idx != c->card->index, because the c->card pointer may
462 * be stale at this point. */
463 if (pa_idxset_get_by_index(core->cards, idx) != c->card)
464 return;
465
466 if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_CHANGE)
467 return;
468
469 if (c->active_profile != c->card->active_profile) {
470 const char *object_path;
471
472 c->active_profile = c->card->active_profile;
473 object_path = pa_dbusiface_card_profile_get_path(pa_hashmap_get(c->profiles, c->active_profile->name));
474
475 pa_assert_se(signal = dbus_message_new_signal(c->path,
476 PA_DBUSIFACE_CARD_INTERFACE,
477 signals[SIGNAL_ACTIVE_PROFILE_UPDATED].name));
478 pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
479
480 pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
481 dbus_message_unref(signal);
482 signal = NULL;
483 }
484
485 if (!pa_proplist_equal(c->proplist, c->card->proplist)) {
486 DBusMessageIter msg_iter;
487
488 pa_proplist_update(c->proplist, PA_UPDATE_SET, c->card->proplist);
489
490 pa_assert_se(signal = dbus_message_new_signal(c->path,
491 PA_DBUSIFACE_CARD_INTERFACE,
492 signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
493 dbus_message_iter_init_append(signal, &msg_iter);
494 pa_dbus_append_proplist(&msg_iter, c->proplist);
495
496 pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
497 dbus_message_unref(signal);
498 signal = NULL;
499 }
500 }
501
502 pa_dbusiface_card *pa_dbusiface_card_new(pa_dbusiface_core *core, pa_card *card) {
503 pa_dbusiface_card *c = NULL;
504
505 pa_assert(core);
506 pa_assert(card);
507
508 c = pa_xnew0(pa_dbusiface_card, 1);
509 c->core = core;
510 c->card = card;
511 c->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, OBJECT_NAME, card->index);
512 c->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
513 c->next_profile_index = 0;
514 c->active_profile = NULL;
515 c->proplist = pa_proplist_copy(card->proplist);
516 c->dbus_protocol = pa_dbus_protocol_get(card->core);
517 c->subscription = pa_subscription_new(card->core, PA_SUBSCRIPTION_MASK_CARD, subscription_cb, c);
518
519 if (card->profiles) {
520 pa_card_profile *profile;
521 void *state = NULL;
522
523 PA_HASHMAP_FOREACH(profile, card->profiles, state) {
524 pa_dbusiface_card_profile *p = pa_dbusiface_card_profile_new(c, card->core, profile, c->next_profile_index++);
525 pa_hashmap_put(c->profiles, pa_dbusiface_card_profile_get_name(p), p);
526 }
527 pa_assert_se(c->active_profile = card->active_profile);
528 }
529
530 pa_assert_se(pa_dbus_protocol_add_interface(c->dbus_protocol, c->path, &card_interface_info, c) >= 0);
531
532 return c;
533 }
534
535 static void profile_free_cb(void *p, void *userdata) {
536 pa_dbusiface_card_profile *profile = p;
537
538 pa_assert(profile);
539
540 pa_dbusiface_card_profile_free(profile);
541 }
542
543 void pa_dbusiface_card_free(pa_dbusiface_card *c) {
544 pa_assert(c);
545
546 pa_assert_se(pa_dbus_protocol_remove_interface(c->dbus_protocol, c->path, card_interface_info.name) >= 0);
547
548 pa_hashmap_free(c->profiles, profile_free_cb, NULL);
549 pa_proplist_free(c->proplist);
550 pa_dbus_protocol_unref(c->dbus_protocol);
551 pa_subscription_free(c->subscription);
552
553 pa_xfree(c->path);
554 pa_xfree(c);
555 }
556
557 const char *pa_dbusiface_card_get_path(pa_dbusiface_card *c) {
558 pa_assert(c);
559
560 return c->path;
561 }