Changeset 6da3baec in mainline
- 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
- Location:
- uspace/srv/audio/hound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_device.c
r8f8ec69 r6da3baec 128 128 if (list_count(&sink->connections) == 0) { 129 129 assert(!new); 130 log_verbose("No connections on device sink '%s'", sink->name); 130 log_verbose("Removed last connection on device sink '%s'", 131 sink->name); 131 132 int ret = audio_pcm_stop_playback(dev->sess); 132 133 if (ret != EOK) { -
uspace/srv/audio/hound/connection.c
r8f8ec69 r6da3baec 58 58 if (sink->connection_change) 59 59 sink->connection_change(sink, true); 60 log_debug("CONNECTED: %s -> %s", source->name, sink->name); 60 61 } 61 62 return conn; … … 68 69 list_remove(&connection->source_link); 69 70 list_remove(&connection->sink_link); 70 connection->sink->connection_change(connection->sink, false); 71 connection->source->connection_change(connection->source, false); 71 if (connection->sink && connection->sink->connection_change) 72 connection->sink->connection_change(connection->sink, false); 73 if (connection->source && connection->source->connection_change) 74 connection->source->connection_change(connection->source, false); 75 log_debug("DISCONNECTED: %s -> %s", 76 connection->source->name, connection->sink->name); 72 77 free(connection); 73 78 } -
uspace/srv/audio/hound/connection.h
r8f8ec69 r6da3baec 54 54 static inline connection_t * connection_from_source_list(link_t *l) 55 55 { 56 return l ist_get_instance(l, connection_t, source_link);56 return l ? list_get_instance(l, connection_t, source_link) : NULL; 57 57 } 58 58 59 59 static inline connection_t * connection_from_sink_list(link_t *l) 60 60 { 61 return l ist_get_instance(l, connection_t, sink_link);61 return l ? list_get_instance(l, connection_t, sink_link) : NULL; 62 62 } 63 63 64 64 static inline connection_t * connection_from_hound_list(link_t *l) 65 65 { 66 return l ist_get_instance(l, connection_t, hound_link);66 return l ? list_get_instance(l, connection_t, hound_link) : NULL; 67 67 } 68 68 -
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.