Changeset 6424800 in mainline
- Timestamp:
- 2012-07-13T08:38:20Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab07cf0
- Parents:
- 1c33539
- Location:
- uspace/srv/audio/hound
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/hound.c
r1c33539 r6424800 201 201 } 202 202 203 int hound_remove_source(hound_t *hound, audio_source_t *source) 204 { 205 assert(hound); 206 if (!source) 207 return EINVAL; 208 log_verbose("Removing source '%s'.", source->name); 209 fibril_mutex_lock(&hound->list_guard); 210 if (!list_member(&source->link, &hound->sources)) { 211 fibril_mutex_unlock(&hound->list_guard); 212 return EBUSY; 213 } 214 list_remove(&source->link); 215 fibril_mutex_unlock(&hound->list_guard); 216 return EOK; 217 } 218 219 int hound_remove_sink(hound_t *hound, audio_sink_t *sink) 220 { 221 assert(hound); 222 if (!sink) 223 return EINVAL; 224 log_verbose("Removing sink '%s'.", sink->name); 225 fibril_mutex_lock(&hound->list_guard); 226 if (!list_empty(&sink->sources)) { 227 fibril_mutex_unlock(&hound->list_guard); 228 return EBUSY; 229 } 230 list_remove(&sink->link); 231 fibril_mutex_unlock(&hound->list_guard); 232 return EOK; 233 } 234 203 235 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name) 204 236 { -
uspace/srv/audio/hound/hound.h
r1c33539 r6424800 59 59 int hound_add_source(hound_t *hound, audio_source_t *source); 60 60 int hound_add_sink(hound_t *hound, audio_sink_t *sink); 61 int hound_remove_source(hound_t *hound, audio_source_t *source); 62 int hound_remove_sink(hound_t *hound, audio_sink_t *sink); 61 63 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name); 62 64 int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name); -
uspace/srv/audio/hound/main.c
r1c33539 r6424800 178 178 audio_client_t * client = 179 179 audio_client_get_recording(name, &format, sess); 180 free(name); 180 181 if (!client) { 181 182 log_error("Failed to create recording client"); … … 196 197 } 197 198 case HOUND_UNREGISTER_PLAYBACK: { 198 //const char *name = get_name(); 199 //TODO unregister in hound 200 //TODO remove from local 199 const char *name = get_name(); 200 int ret = ENOENT; 201 list_foreach(local_playback, it) { 202 audio_client_t *client = 203 audio_client_list_instance(it); 204 if (str_cmp(client->name, name) == 0) { 205 ret = hound_remove_source(&hound, 206 &client->source); 207 if (ret == EOK) { 208 list_remove(&client->link); 209 audio_client_destroy(client); 210 } 211 break; 212 } 213 } 214 free(name); 215 async_answer_0(callid, ret); 201 216 break; 202 217 } 203 218 case HOUND_UNREGISTER_RECORDING: { 204 //TODO Get Name 205 //TODO unregister in hound 206 //TODO remove from local 219 const char *name = get_name(); 220 int ret = ENOENT; 221 list_foreach(local_recording, it) { 222 audio_client_t *client = 223 audio_client_list_instance(it); 224 if (str_cmp(client->name, name) == 0) { 225 ret = hound_remove_sink(&hound, 226 &client->sink); 227 if (ret == EOK) { 228 list_remove(&client->link); 229 audio_client_destroy(client); 230 } 231 break; 232 } 233 } 234 free(name); 235 async_answer_0(callid, ret); 207 236 break; 208 237 } … … 237 266 break; 238 267 case 0: 268 while(!list_empty(&local_recording)) { 269 audio_client_t *client = 270 audio_client_list_instance( 271 list_first(&local_recording)); 272 list_remove(&client->link); 273 hound_remove_sink(&hound, &client->sink); 274 audio_client_destroy(client); 275 } 276 while(!list_empty(&local_playback)) { 277 audio_client_t *client = 278 audio_client_list_instance( 279 list_first(&local_playback)); 280 list_remove(&client->link); 281 hound_remove_source(&hound, &client->source); 282 audio_client_destroy(client); 283 } 239 284 //TODO remove all clients 240 285 return;
Note:
See TracChangeset
for help on using the changeset viewer.