Changeset 6da3baec in mainline for uspace/srv/audio/hound/hound.c
- Timestamp:
- 2013-04-03T21:25:28Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be7eccf
- Parents:
- 8f8ec69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/hound.c
r8f8ec69 r6da3baec 79 79 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name); 80 80 81 static void hound_remove_sink_internal(hound_t *hound, audio_sink_t *sink) 82 { 83 assert(hound); 84 assert(sink); 85 log_verbose("Removing sink '%s'.", sink->name); 86 if (!list_empty(&sink->connections)) 87 log_warning("Removing sink '%s' while still connected.", sink->name); 88 while (!list_empty(&sink->connections)) { 89 connection_t *conn = 90 connection_from_sink_list(list_first(&sink->connections)); 91 list_remove(&conn->hound_link); 92 connection_destroy(conn); 93 } 94 list_remove(&sink->link); 95 } 96 97 static void hound_remove_source_internal(hound_t *hound, audio_source_t *source) 98 { 99 assert(hound); 100 assert(source); 101 log_verbose("Removing source '%s'.", source->name); 102 if (!list_empty(&source->connections)) 103 log_warning("Removing source '%s' while still connected.", source->name); 104 while (!list_empty(&source->connections)) { 105 connection_t *conn = 106 connection_from_source_list(list_first(&source->connections)); 107 assert(conn); 108 list_remove(&conn->hound_link); 109 connection_destroy(conn); 110 } 111 list_remove(&source->link); 112 } 113 81 114 int hound_init(hound_t *hound) 82 115 { … … 117 150 fibril_mutex_lock(&hound->list_guard); 118 151 list_remove(&ctx->link); 152 if (ctx->source) 153 hound_remove_source_internal(hound, ctx->source); 154 if (ctx->sink) 155 hound_remove_sink_internal(hound, ctx->sink); 119 156 fibril_mutex_unlock(&hound->list_guard); 120 157 return EOK; … … 250 287 if (!source) 251 288 return EINVAL; 252 log_verbose("Removing source '%s'.", source->name); 253 fibril_mutex_lock(&hound->list_guard); 254 255 list_remove(&source->link); 256 fibril_mutex_unlock(&hound->list_guard); 257 return EOK; 258 } 289 fibril_mutex_lock(&hound->list_guard); 290 hound_remove_source_internal(hound, source); 291 fibril_mutex_unlock(&hound->list_guard); 292 return EOK; 293 } 294 259 295 260 296 int hound_remove_sink(hound_t *hound, audio_sink_t *sink) … … 263 299 if (!sink) 264 300 return EINVAL; 265 log_verbose("Removing sink '%s'.", sink->name); 266 fibril_mutex_lock(&hound->list_guard); 267 268 if (!list_empty(&sink->connections)) { 269 // TODO disconnect instead 270 fibril_mutex_unlock(&hound->list_guard); 271 return EBUSY; 272 } 273 list_remove(&sink->link); 301 fibril_mutex_lock(&hound->list_guard); 302 hound_remove_sink_internal(hound, sink); 274 303 fibril_mutex_unlock(&hound->list_guard); 275 304 return EOK; … … 383 412 list_append(&conn->hound_link, &hound->connections); 384 413 fibril_mutex_unlock(&hound->list_guard); 385 log_debug("CONNECTED: %s -> %s", source_name, sink_name);386 414 return EOK; 387 415 } … … 396 424 } 397 425 398 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name) 426 static int hound_disconnect_internal(hound_t *hound, const char* source_name, 427 const char* sink_name) 399 428 { 400 429 assert(hound);
Note:
See TracChangeset
for help on using the changeset viewer.