Changeset 13df13c8 in mainline
- Timestamp:
- 2012-07-13T19:48:19Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 43c40a3
- Parents:
- ab07cf0
- Location:
- uspace/srv/audio/hound
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_client.c
rab07cf0 r13df13c8 54 54 } 55 55 56 static int client_sink_connection_change(audio_sink_t *sink );56 static int client_sink_connection_change(audio_sink_t *sink, bool new); 57 57 static int client_source_connection_change(audio_source_t *source); 58 58 static int client_source_update_data(audio_source_t *source, size_t size); … … 105 105 } 106 106 107 static int client_sink_connection_change(audio_sink_t *sink )107 static int client_sink_connection_change(audio_sink_t *sink, bool new) 108 108 { 109 109 //TODO create fibril -
uspace/srv/audio/hound/audio_device.c
rab07cf0 r13df13c8 49 49 #define BUFFER_BLOCKS 2 50 50 51 static int device_sink_connection_callback(audio_sink_t *sink );51 static int device_sink_connection_callback(audio_sink_t *sink, bool new); 52 52 static int device_source_connection_callback(audio_source_t *source); 53 53 static void device_event_callback(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 95 95 } 96 96 97 static int device_sink_connection_callback(audio_sink_t* sink )97 static int device_sink_connection_callback(audio_sink_t* sink, bool new) 98 98 { 99 99 assert(sink); 100 100 audio_device_t *dev = sink->private_data; 101 if ( list_count(&sink->sources) == 1) {101 if (new && list_count(&sink->sources) == 1) { 102 102 log_verbose("First connection on device sink '%s'", sink->name); 103 103 … … 118 118 } 119 119 if (list_count(&sink->sources) == 0) { 120 assert(!new); 120 121 log_verbose("No connections on device sink '%s'", sink->name); 121 122 int ret = stop_playback(dev); -
uspace/srv/audio/hound/audio_sink.c
rab07cf0 r13df13c8 45 45 46 46 int audio_sink_init(audio_sink_t *sink, const char *name, 47 void *private_data, int (*connection_change)(audio_sink_t *sink),47 void *private_data, int (*connection_change)(audio_sink_t *, bool), 48 48 const audio_format_t *f) 49 49 { … … 108 108 if (sink->connection_change) { 109 109 log_verbose("Calling connection change"); 110 const int ret = sink->connection_change(sink );110 const int ret = sink->connection_change(sink, true); 111 111 if (ret != EOK) { 112 112 log_debug("Connection hook failed."); … … 130 130 list_remove(&source->link); 131 131 if (sink->connection_change) { 132 const int ret = sink->connection_change(sink );132 const int ret = sink->connection_change(sink, false); 133 133 if (ret != EOK) { 134 134 log_debug("Connected hook failed."); -
uspace/srv/audio/hound/audio_sink.h
rab07cf0 r13df13c8 40 40 #include <async.h> 41 41 #include <bool.h> 42 #include <pcm_sample_format.h>43 42 #include <fibril.h> 44 43 … … 54 53 audio_format_t format; 55 54 void *private_data; 56 int (*connection_change)(audio_sink_t * sink);55 int (*connection_change)(audio_sink_t *, bool); 57 56 }; 58 57 … … 63 62 64 63 int audio_sink_init(audio_sink_t *sink, const char *name, 65 void *private_data, int (*connection_change)(audio_sink_t * sink),64 void *private_data, int (*connection_change)(audio_sink_t *, bool), 66 65 const audio_format_t *f); 67 66 void audio_sink_fini(audio_sink_t *sink); -
uspace/srv/audio/hound/audio_source.c
rab07cf0 r13df13c8 143 143 source->available_data.size -= real_size; 144 144 145 log_verbose("Mixing successful %p <= %p, %zu",146 buffer, source->available_data.position, real_size);145 // log_verbose("Mixing successful %p <= %p, %zu", 146 // buffer, source->available_data.position, real_size); 147 147 148 148 buffer += real_size; -
uspace/srv/audio/hound/hound.c
rab07cf0 r13df13c8 75 75 FIND_BY_NAME(sink); 76 76 } 77 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name); 77 78 78 79 int hound_init(hound_t *hound) … … 209 210 fibril_mutex_lock(&hound->list_guard); 210 211 if (!list_member(&source->link, &hound->sources)) { 211 fibril_mutex_unlock(&hound->list_guard); 212 return EBUSY; 212 assert(source->connected_sink); 213 hound_disconnect_internal(hound, source->name, 214 source->connected_sink->name); 213 215 } 214 216 list_remove(&source->link); … … 224 226 log_verbose("Removing sink '%s'.", sink->name); 225 227 fibril_mutex_lock(&hound->list_guard); 228 226 229 if (!list_empty(&sink->sources)) { 230 // TODO disconnect instead 227 231 fibril_mutex_unlock(&hound->list_guard); 228 232 return EBUSY; … … 259 263 { 260 264 assert(hound); 265 fibril_mutex_lock(&hound->list_guard); 266 const int ret = hound_disconnect_internal(hound, source_name, sink_name); 267 fibril_mutex_unlock(&hound->list_guard); 268 return ret; 269 } 270 271 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name) 272 { 273 assert(hound); 274 assert(fibril_mutex_is_locked(&hound->list_guard)); 261 275 log_verbose("Disconnecting '%s' to '%s'.", source_name, sink_name); 262 fibril_mutex_lock(&hound->list_guard);263 276 audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name); 264 277 audio_source_t *source = sink ? find_source_by_name(&sink->sources, source_name) : NULL; 265 278 if (!source || !sink) { 266 fibril_mutex_unlock(&hound->list_guard);267 279 log_debug("Source (%p), or sink (%p) not found", source, sink); 268 280 return ENOENT; … … 274 286 list_append(&source->link, &hound->sources); 275 287 } 276 fibril_mutex_unlock(&hound->list_guard); 277 return EOK; 278 return ENOTSUP; 288 return EOK; 279 289 } 280 290 /**
Note:
See TracChangeset
for help on using the changeset viewer.