Changeset f3fced0 in mainline
- Timestamp:
- 2012-07-13T05:39:36Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9b2ac3d
- Parents:
- 63d6ff9
- Location:
- uspace/srv/audio/hound
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_device.c
r63d6ff9 rf3fced0 100 100 audio_device_t *dev = sink->private_data; 101 101 if (list_count(&sink->sources) == 1) { 102 log_verbose("First connection on device sink '%s'", sink->name); 103 102 104 int ret = get_buffer(dev); 103 105 if (ret != EOK) { … … 106 108 return ret; 107 109 } 110 108 111 ret = start_playback(dev); 109 112 if (ret != EOK) { … … 115 118 } 116 119 if (list_count(&sink->sources) == 0) { 120 log_verbose("No connections on device sink '%s'", sink->name); 117 121 int ret = stop_playback(dev); 118 122 if (ret != EOK) { -
uspace/srv/audio/hound/audio_sink.c
r63d6ff9 rf3fced0 58 58 sink->private_data = private_data; 59 59 sink->format = *f; 60 sink->connection_change = connection_change; 60 61 log_verbose("Initialized sink (%p) '%s'", sink, sink->name); 61 62 return EOK; … … 90 91 sink->format = AUDIO_FORMAT_DEFAULT; 91 92 } else { 92 log_verbose("Set format base on the first "93 "source(%s): %u channel s, %uHz, %s for "94 " 93 log_verbose("Set format based on the first " 94 "source(%s): %u channel(s), %uHz, %s for " 95 "sink %s.", source->name, 95 96 source->format.channels, 96 97 source->format.sampling_rate, … … 103 104 } 104 105 106 audio_source_connected(source, sink); 107 105 108 if (sink->connection_change) { 109 log_verbose("Calling connection change"); 106 110 const int ret = sink->connection_change(sink); 107 111 if (ret != EOK) { 108 112 log_debug("Connection hook failed."); 113 audio_source_connected(source, NULL); 109 114 list_remove(&source->link); 110 115 sink->format = old_format; … … 112 117 } 113 118 } 119 log_verbose("Connected source '%s' to sink '%s'", 120 source->name, sink->name); 114 121 115 122 return EOK; -
uspace/srv/audio/hound/hound.c
r63d6ff9 rf3fced0 55 55 audio_ ## type ## _list_instance(it); \ 56 56 if (str_cmp(name, dev->name) == 0) { \ 57 log_debug("%s with name '%s' is already present", \57 log_debug("%s with name '%s' is in the list", \ 58 58 #type, name); \ 59 59 return dev; \ … … 82 82 list_initialize(&hound->devices); 83 83 list_initialize(&hound->sources); 84 list_initialize(&hound->available_sources);85 84 list_initialize(&hound->sinks); 86 85 return EOK; … … 202 201 } 203 202 203 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name) 204 { 205 assert(hound); 206 log_verbose("Connecting '%s' to '%s'.", source_name, sink_name); 207 fibril_mutex_lock(&hound->list_guard); 208 audio_source_t *source = 209 find_source_by_name(&hound->sources, source_name); 210 audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name); 211 if (!source || !sink) { 212 fibril_mutex_unlock(&hound->list_guard); 213 log_debug("Sink (%p), or source (%p) not found", sink, source); 214 return ENOENT; 215 } 216 list_remove(&source->link); 217 const int ret = audio_sink_add_source(sink, source); 218 if (ret != EOK) { 219 log_debug("Failed add source to sink list: %s", str_error(ret)); 220 list_append(&source->link, &hound->sources); 221 } 222 fibril_mutex_unlock(&hound->list_guard); 223 return EOK; 224 } 225 226 int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name) 227 { 228 return ENOTSUP; 229 } 204 230 /** 205 231 * @} -
uspace/srv/audio/hound/hound.h
r63d6ff9 rf3fced0 52 52 list_t devices; 53 53 list_t sources; 54 list_t available_sources;55 54 list_t sinks; 56 55 } hound_t; … … 60 59 int hound_add_source(hound_t *hound, audio_source_t *source); 61 60 int hound_add_sink(hound_t *hound, audio_sink_t *sink); 62 int hound_connect( const char* source_name, const char* sink_name);63 int hound_disconnect( const char* source_name, const char* sink_name);61 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name); 62 int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name); 64 63 65 64 #endif -
uspace/srv/audio/hound/main.c
r63d6ff9 rf3fced0 145 145 ipc_call_t call; 146 146 ipc_callid_t callid = async_get_call(&call); 147 log_debug("Got method %u", IPC_GET_IMETHOD(call));148 147 switch (IPC_GET_IMETHOD(call)) { 149 148 case HOUND_REGISTER_PLAYBACK: { … … 209 208 } 210 209 case HOUND_CONNECT: { 211 //TODO Get Name 212 //TODO Get Name 213 //TODO connect in hound 210 const char *name_a = get_name(); 211 const char *name_b = get_name(); 212 const int ret = hound_connect(&hound, name_a, name_b); 213 if (ret != EOK) 214 log_error("Failed to connect '%s' to '%s': %s", 215 name_a, name_b, str_error(ret)); 216 free(name_a); 217 free(name_b); 218 async_answer_0(callid, ret); 214 219 break; 215 220 } 216 221 case HOUND_DISCONNECT: { 217 //TODO Get Name 218 //TODO Get Name 219 //TODO disconnect in hound 222 const char *name_a = get_name(); 223 const char *name_b = get_name(); 224 const int ret = hound_disconnect(&hound, name_a, name_b); 225 if (ret != EOK) 226 log_error("Failed to disconnect '%s' from '%s'" 227 ": %s", name_a, name_b, str_error(ret)); 228 free(name_a); 229 free(name_b); 230 async_answer_0(callid, ret); 220 231 break; 221 232 } 222 233 default: 234 log_debug("Got unknown method %u", 235 IPC_GET_IMETHOD(call)); 223 236 async_answer_0(callid, ENOTSUP); 224 237 break; 225 238 case 0: 239 //TODO remove all clients 226 240 return; 227 241 }
Note:
See TracChangeset
for help on using the changeset viewer.