Changeset 1433ecda in mainline for uspace/srv/audio
- Timestamp:
- 2018-04-04T15:42:37Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- Location:
- uspace/srv/audio/hound
- Files:
-
- 8 edited
-
audio_data.h (modified) (1 diff)
-
audio_device.c (modified) (6 diffs)
-
audio_device.h (modified) (2 diffs)
-
audio_sink.c (modified) (1 diff)
-
audio_sink.h (modified) (2 diffs)
-
audio_source.h (modified) (1 diff)
-
connection.h (modified) (2 diffs)
-
hound.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.h
r47b2d7e3 r1433ecda 67 67 } audio_pipe_t; 68 68 69 audio_data_t * audio_data_create(const void *data, size_t size,69 audio_data_t *audio_data_create(const void *data, size_t size, 70 70 pcm_format_t format); 71 71 void audio_data_addref(audio_data_t *adata); -
uspace/srv/audio/hound/audio_device.c
r47b2d7e3 r1433ecda 54 54 static errno_t device_source_connection_callback(audio_source_t *source, bool new); 55 55 static void device_event_callback(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg); 56 static errno_t device_check_format(audio_sink_t *sink);56 static errno_t device_check_format(audio_sink_t *sink); 57 57 static errno_t get_buffer(audio_device_t *dev); 58 58 static errno_t release_buffer(audio_device_t *dev); … … 118 118 * capable of capturing audio. 119 119 */ 120 audio_source_t * audio_device_get_source(audio_device_t *dev)120 audio_source_t *audio_device_get_source(audio_device_t *dev) 121 121 { 122 122 assert(dev); … … 134 134 * capable of audio playback. 135 135 */ 136 audio_sink_t * audio_device_get_sink(audio_device_t *dev)136 audio_sink_t *audio_device_get_sink(audio_device_t *dev) 137 137 { 138 138 assert(dev); … … 153 153 * connections. 154 154 */ 155 static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new)155 static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new) 156 156 { 157 157 assert(sink); … … 275 275 cap_call_handle_t chandle = async_get_call(&call); 276 276 async_answer_0(chandle, EOK); 277 switch (IPC_GET_IMETHOD(call)) {277 switch (IPC_GET_IMETHOD(call)) { 278 278 case PCM_EVENT_FRAMES_PLAYED: 279 279 getuptime(&time1); … … 327 327 * @return Error code. 328 328 */ 329 static errno_t device_check_format(audio_sink_t *sink)329 static errno_t device_check_format(audio_sink_t *sink) 330 330 { 331 331 assert(sink); -
uspace/srv/audio/hound/audio_device.h
r47b2d7e3 r1433ecda 71 71 72 72 /** Linked list instance helper */ 73 static inline audio_device_t * audio_device_list_instance(link_t *l)73 static inline audio_device_t *audio_device_list_instance(link_t *l) 74 74 { 75 75 return l ? list_get_instance(l, audio_device_t, link) : NULL; … … 78 78 errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name); 79 79 void audio_device_fini(audio_device_t *dev); 80 audio_source_t * audio_device_get_source(audio_device_t *dev);81 audio_sink_t * audio_device_get_sink(audio_device_t *dev);80 audio_source_t *audio_device_get_source(audio_device_t *dev); 81 audio_sink_t *audio_device_get_sink(audio_device_t *dev); 82 82 errno_t audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size); 83 83 errno_t audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size); -
uspace/srv/audio/hound/audio_sink.c
r47b2d7e3 r1433ecda 134 134 * @return Error code. 135 135 */ 136 void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size)136 void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size) 137 137 { 138 138 assert(sink); -
uspace/srv/audio/hound/audio_sink.h
r47b2d7e3 r1433ecda 72 72 * @return pointer to a sink structure, NULL on failure. 73 73 */ 74 static inline audio_sink_t * audio_sink_list_instance(link_t *l)74 static inline audio_sink_t *audio_sink_list_instance(link_t *l) 75 75 { 76 76 return l ? list_get_instance(l, audio_sink_t, link) : NULL; … … 84 84 void audio_sink_fini(audio_sink_t *sink); 85 85 errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format); 86 void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size);86 void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size); 87 87 88 88 #endif -
uspace/srv/audio/hound/audio_source.h
r47b2d7e3 r1433ecda 65 65 * @return pointer to a source structure, NULL on failure. 66 66 */ 67 static inline audio_source_t * audio_source_list_instance(link_t *l)67 static inline audio_source_t *audio_source_list_instance(link_t *l) 68 68 { 69 69 return l ? list_get_instance(l, audio_source_t, link) : NULL; -
uspace/srv/audio/hound/connection.h
r47b2d7e3 r1433ecda 66 66 * @return pointer to a connection structure, NULL on failure. 67 67 */ 68 static inline connection_t * connection_from_source_list(link_t *l)68 static inline connection_t *connection_from_source_list(link_t *l) 69 69 { 70 70 return l ? list_get_instance(l, connection_t, source_link) : NULL; … … 76 76 * @return pointer to a connection structure, NULL on failure. 77 77 */ 78 static inline connection_t * connection_from_hound_list(link_t *l)78 static inline connection_t *connection_from_hound_list(link_t *l) 79 79 { 80 80 return l ? list_get_instance(l, connection_t, hound_link) : NULL; -
uspace/srv/audio/hound/hound.c
r47b2d7e3 r1433ecda 111 111 } 112 112 113 static errno_t hound_disconnect_internal(hound_t *hound, const char * source_name, const char*sink_name);113 static errno_t hound_disconnect_internal(hound_t *hound, const char *source_name, const char *sink_name); 114 114 115 115 /** … … 287 287 if (ret != EOK) { 288 288 log_debug("Failed to initialize new audio device: %s", 289 str_error(ret));289 str_error(ret)); 290 290 free(dev); 291 291 return ret; … … 517 517 * @return Error code. 518 518 */ 519 errno_t hound_connect(hound_t *hound, const char * source_name, const char*sink_name)519 errno_t hound_connect(hound_t *hound, const char *source_name, const char *sink_name) 520 520 { 521 521 assert(hound); … … 526 526 audio_source_list_instance(list_first(&hound->sources)); 527 527 if (str_cmp(source_name, "default") != 0) 528 source = find_source_by_name(&hound->sources, source_name);528 source = find_source_by_name(&hound->sources, source_name); 529 529 530 530 audio_sink_t *sink = 531 531 audio_sink_list_instance(list_first(&hound->sinks)); 532 532 if (str_cmp(sink_name, "default") != 0) 533 sink = find_sink_by_name(&hound->sinks, sink_name);533 sink = find_sink_by_name(&hound->sinks, sink_name); 534 534 535 535 if (!source || !sink) { … … 556 556 * @return Error code. 557 557 */ 558 errno_t hound_disconnect(hound_t *hound, const char * source_name, const char*sink_name)558 errno_t hound_disconnect(hound_t *hound, const char *source_name, const char *sink_name) 559 559 { 560 560 assert(hound); … … 574 574 * This function has to be called with the list_guard lock held. 575 575 */ 576 static errno_t hound_disconnect_internal(hound_t *hound, const char *source_name,577 const char *sink_name)576 static errno_t hound_disconnect_internal(hound_t *hound, const char *source_name, 577 const char *sink_name) 578 578 { 579 579 assert(hound); … … 585 585 if (str_cmp(connection_source_name(conn), source_name) == 0 || 586 586 str_cmp(connection_sink_name(conn), sink_name) == 0) { 587 log_debug("Removing %s -> %s", connection_source_name(conn),588 connection_sink_name(conn));589 list_remove(it);590 connection_destroy(conn);587 log_debug("Removing %s -> %s", connection_source_name(conn), 588 connection_sink_name(conn)); 589 list_remove(it); 590 connection_destroy(conn); 591 591 } 592 592 }
Note:
See TracChangeset
for help on using the changeset viewer.
