Changeset 5a6cc679 in mainline for uspace/srv/audio
- Timestamp:
- 2018-01-31T02:21:24Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a0a9cc2
- Parents:
- 132ab5d1
- Location:
- uspace/srv/audio/hound
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
r132ab5d1 r5a6cc679 213 213 * @return Error code. 214 214 */ 215 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)215 errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data) 216 216 { 217 217 assert(pipe); -
uspace/srv/audio/hound/audio_data.h
r132ab5d1 r5a6cc679 75 75 void audio_pipe_fini(audio_pipe_t *pipe); 76 76 77 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);77 errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data); 78 78 audio_data_t *audio_pipe_pop(audio_pipe_t *pipe); 79 79 … … 113 113 * Reference counted buffer is created automatically. 114 114 */ 115 static inline int audio_pipe_push_data(audio_pipe_t *pipe,115 static inline errno_t audio_pipe_push_data(audio_pipe_t *pipe, 116 116 const void *data, size_t size, pcm_format_t f) 117 117 { 118 118 audio_data_t *adata = audio_data_create(data, size, f); 119 119 if (adata) { 120 const int ret = audio_pipe_push(pipe, adata);120 const errno_t ret = audio_pipe_push(pipe, adata); 121 121 audio_data_unref(adata); 122 122 return ret; -
uspace/srv/audio/hound/audio_device.c
r132ab5d1 r5a6cc679 51 51 #define BUFFER_PARTS 16 52 52 53 static int device_sink_connection_callback(audio_sink_t *sink, bool new);54 static int device_source_connection_callback(audio_source_t *source, bool new);53 static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new); 54 static errno_t device_source_connection_callback(audio_source_t *source, bool new); 55 55 static void device_event_callback(ipc_callid_t iid, ipc_call_t *icall, void *arg); 56 static int device_check_format(audio_sink_t* sink);57 static int get_buffer(audio_device_t *dev);58 static int release_buffer(audio_device_t *dev);56 static errno_t device_check_format(audio_sink_t* sink); 57 static errno_t get_buffer(audio_device_t *dev); 58 static errno_t release_buffer(audio_device_t *dev); 59 59 static void advance_buffer(audio_device_t *dev, size_t size); 60 60 static inline bool is_running(audio_device_t *dev) … … 72 72 * @return Error code. 73 73 */ 74 int audio_device_init(audio_device_t *dev, service_id_t id, const char *name)74 errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name) 75 75 { 76 76 assert(dev); … … 122 122 assert(dev); 123 123 sysarg_t val; 124 int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val);124 errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val); 125 125 if (rc == EOK && val) 126 126 return &dev->source; … … 138 138 assert(dev); 139 139 sysarg_t val; 140 int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val);140 errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val); 141 141 if (rc == EOK && val) 142 142 return &dev->sink; … … 153 153 * connections. 154 154 */ 155 static int 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); … … 160 160 log_verbose("First connection on device sink '%s'", sink->name); 161 161 162 int ret = get_buffer(dev);162 errno_t ret = get_buffer(dev); 163 163 if (ret != EOK) { 164 164 log_error("Failed to get device buffer: %s", … … 196 196 log_verbose("Removed last connection on device sink '%s'", 197 197 sink->name); 198 int ret = audio_pcm_stop_playback(dev->sess);198 errno_t ret = audio_pcm_stop_playback(dev->sess); 199 199 if (ret != EOK) { 200 200 log_error("Failed to stop playback: %s", … … 215 215 * connections. 216 216 */ 217 static int device_source_connection_callback(audio_source_t *source, bool new)217 static errno_t device_source_connection_callback(audio_source_t *source, bool new) 218 218 { 219 219 assert(source); 220 220 audio_device_t *dev = source->private_data; 221 221 if (new && list_count(&source->connections) == 1) { 222 int ret = get_buffer(dev);222 errno_t ret = get_buffer(dev); 223 223 if (ret != EOK) { 224 224 log_error("Failed to get device buffer: %s", … … 244 244 if (list_count(&source->connections) == 0) { /* Disconnected */ 245 245 assert(!new); 246 int ret = audio_pcm_stop_capture_immediate(dev->sess);246 errno_t ret = audio_pcm_stop_capture_immediate(dev->sess); 247 247 if (ret != EOK) { 248 248 log_error("Failed to start recording: %s", … … 289 289 log_verbose("Capture terminated"); 290 290 dev->source.format = AUDIO_FORMAT_ANY; 291 const int ret = release_buffer(dev);291 const errno_t ret = release_buffer(dev); 292 292 if (ret != EOK) { 293 293 log_error("Failed to release buffer: %s", … … 300 300 log_verbose("Playback Terminated"); 301 301 dev->sink.format = AUDIO_FORMAT_ANY; 302 const int ret = release_buffer(dev);302 const errno_t ret = release_buffer(dev); 303 303 if (ret != EOK) { 304 304 log_error("Failed to release buffer: %s", … … 309 309 } 310 310 case PCM_EVENT_FRAMES_CAPTURED: { 311 const int ret = audio_source_push_data(&dev->source,311 const errno_t ret = audio_source_push_data(&dev->source, 312 312 dev->buffer.position, dev->buffer.fragment_size); 313 313 advance_buffer(dev, dev->buffer.fragment_size); … … 329 329 * @return Error code. 330 330 */ 331 static int device_check_format(audio_sink_t* sink)331 static errno_t device_check_format(audio_sink_t* sink) 332 332 { 333 333 assert(sink); … … 347 347 * @return Error code. 348 348 */ 349 static int get_buffer(audio_device_t *dev)349 static errno_t get_buffer(audio_device_t *dev) 350 350 { 351 351 assert(dev); … … 362 362 size_t preferred_size = 0; 363 363 364 const int ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base,364 const errno_t ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base, 365 365 &preferred_size); 366 366 if (ret == EOK) { … … 378 378 * @return Error code. 379 379 */ 380 static int release_buffer(audio_device_t *dev)380 static errno_t release_buffer(audio_device_t *dev) 381 381 { 382 382 assert(dev); 383 383 assert(dev->buffer.base); 384 384 385 const int ret = audio_pcm_release_buffer(dev->sess);385 const errno_t ret = audio_pcm_release_buffer(dev->sess); 386 386 if (ret == EOK) { 387 387 as_area_destroy(dev->buffer.base); -
uspace/srv/audio/hound/audio_device.h
r132ab5d1 r5a6cc679 76 76 }; 77 77 78 int audio_device_init(audio_device_t *dev, service_id_t id, const char *name);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 80 audio_source_t * audio_device_get_source(audio_device_t *dev); 81 81 audio_sink_t * audio_device_get_sink(audio_device_t *dev); 82 int audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size);83 int audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size);82 errno_t audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size); 83 errno_t audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size); 84 84 85 85 #endif -
uspace/srv/audio/hound/audio_sink.c
r132ab5d1 r5a6cc679 56 56 * @return Error code. 57 57 */ 58 int audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,59 int (*connection_change)(audio_sink_t *, bool),60 int (*check_format)(audio_sink_t *), int (*data_available)(audio_sink_t *),58 errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data, 59 errno_t (*connection_change)(audio_sink_t *, bool), 60 errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *), 61 61 const pcm_format_t *f) 62 62 { … … 97 97 * @return Error code. 98 98 */ 99 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)99 errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format) 100 100 { 101 101 assert(sink); … … 114 114 } 115 115 if (sink->check_format) { 116 const int ret = sink->check_format(sink);116 const errno_t ret = sink->check_format(sink); 117 117 if (ret != EOK && ret != ELIMIT) { 118 118 log_debug("Format check failed on sink %s", sink->name); … … 141 141 pcm_format_silence(dest, size, &sink->format); 142 142 list_foreach(sink->connections, sink_link, connection_t, conn) { 143 const int ret = connection_add_source_data(143 const errno_t ret = connection_add_source_data( 144 144 conn, dest, size, sink->format); 145 145 if (ret != EOK) { -
uspace/srv/audio/hound/audio_sink.h
r132ab5d1 r5a6cc679 60 60 void *private_data; 61 61 /** Connect/disconnect callback */ 62 int (*connection_change)(audio_sink_t *, bool);62 errno_t (*connection_change)(audio_sink_t *, bool); 63 63 /** Backend callback to check data */ 64 int (*check_format)(audio_sink_t *);64 errno_t (*check_format)(audio_sink_t *); 65 65 /** new data notifier */ 66 int (*data_available)(audio_sink_t *);66 errno_t (*data_available)(audio_sink_t *); 67 67 }; 68 68 … … 77 77 } 78 78 79 int audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,80 int (*connection_change)(audio_sink_t *, bool),81 int (*check_format)(audio_sink_t *), int (*data_available)(audio_sink_t *),79 errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data, 80 errno_t (*connection_change)(audio_sink_t *, bool), 81 errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *), 82 82 const pcm_format_t *f); 83 83 84 84 void audio_sink_fini(audio_sink_t *sink); 85 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);85 errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format); 86 86 void audio_sink_mix_inputs(audio_sink_t *sink, void* dest, size_t size); 87 87 -
uspace/srv/audio/hound/audio_source.c
r132ab5d1 r5a6cc679 56 56 * @return Error code. 57 57 */ 58 int audio_source_init(audio_source_t *source, const char *name, void *data,59 int (*connection_change)(audio_source_t *, bool new),60 int (*update_available_data)(audio_source_t *, size_t),58 errno_t audio_source_init(audio_source_t *source, const char *name, void *data, 59 errno_t (*connection_change)(audio_source_t *, bool new), 60 errno_t (*update_available_data)(audio_source_t *, size_t), 61 61 const pcm_format_t *f) 62 62 { … … 96 96 * @return Error code. 97 97 */ 98 int audio_source_push_data(audio_source_t *source, const void *data,98 errno_t audio_source_push_data(audio_source_t *source, const void *data, 99 99 size_t size) 100 100 { … … 107 107 108 108 list_foreach(source->connections, source_link, connection_t, conn) { 109 const int ret = connection_push_data(conn, adata);109 const errno_t ret = connection_push_data(conn, adata); 110 110 if (ret != EOK) { 111 111 log_warning("Failed push data to %s: %s", -
uspace/srv/audio/hound/audio_source.h
r132ab5d1 r5a6cc679 55 55 void *private_data; 56 56 /** Callback for connection and disconnection */ 57 int (*connection_change)(audio_source_t *source, bool added);57 errno_t (*connection_change)(audio_source_t *source, bool added); 58 58 /** Ask backend for more data */ 59 int (*update_available_data)(audio_source_t *source, size_t size);59 errno_t (*update_available_data)(audio_source_t *source, size_t size); 60 60 }; 61 61 … … 70 70 } 71 71 72 int audio_source_init(audio_source_t *source, const char *name, void *data,73 int (*connection_change)(audio_source_t *, bool),74 int (*update_available_data)(audio_source_t *, size_t),72 errno_t audio_source_init(audio_source_t *source, const char *name, void *data, 73 errno_t (*connection_change)(audio_source_t *, bool), 74 errno_t (*update_available_data)(audio_source_t *, size_t), 75 75 const pcm_format_t *f); 76 76 void audio_source_fini(audio_source_t *source); 77 int audio_source_push_data(audio_source_t *source, const void *data,77 errno_t audio_source_push_data(audio_source_t *source, const void *data, 78 78 size_t size); 79 79 static inline const pcm_format_t *audio_source_format(const audio_source_t *s) -
uspace/srv/audio/hound/connection.c
r132ab5d1 r5a6cc679 101 101 * @param format format of the destination audio buffer. 102 102 */ 103 int connection_add_source_data(connection_t *connection, void *data,103 errno_t connection_add_source_data(connection_t *connection, void *data, 104 104 size_t size, pcm_format_t format) 105 105 { … … 129 129 * @return Error code. 130 130 */ 131 int connection_push_data(connection_t *connection,131 errno_t connection_push_data(connection_t *connection, 132 132 audio_data_t *adata) 133 133 { 134 134 assert(connection); 135 135 assert(adata); 136 const int ret = audio_pipe_push(&connection->fifo, adata);136 const errno_t ret = audio_pipe_push(&connection->fifo, adata); 137 137 if (ret == EOK && connection->sink->data_available) 138 138 connection->sink->data_available(connection->sink); -
uspace/srv/audio/hound/connection.h
r132ab5d1 r5a6cc679 84 84 void connection_destroy(connection_t *connection); 85 85 86 int connection_add_source_data(connection_t *connection, void *data,86 errno_t connection_add_source_data(connection_t *connection, void *data, 87 87 size_t size, pcm_format_t format); 88 88 89 int connection_push_data(connection_t *connection, audio_data_t *adata);89 errno_t connection_push_data(connection_t *connection, audio_data_t *adata); 90 90 91 91 /** -
uspace/srv/audio/hound/hound.c
r132ab5d1 r5a6cc679 110 110 } 111 111 112 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);112 static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name); 113 113 114 114 /** … … 162 162 * @return Error code. 163 163 */ 164 int hound_init(hound_t *hound)164 errno_t hound_init(hound_t *hound) 165 165 { 166 166 assert(hound); … … 180 180 * @return Error code. 181 181 */ 182 int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)182 errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx) 183 183 { 184 184 log_info("Trying to add context %p", ctx); … … 189 189 list_append(&ctx->link, &hound->contexts); 190 190 fibril_mutex_unlock(&hound->list_guard); 191 int ret = EOK;191 errno_t ret = EOK; 192 192 if (ret == EOK && ctx->source) 193 193 ret = hound_add_source(hound, ctx->source); … … 208 208 * @return Error code. 209 209 */ 210 int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)210 errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx) 211 211 { 212 212 assert(hound); … … 254 254 * @return Error code. 255 255 */ 256 int hound_add_device(hound_t *hound, service_id_t id, const char *name)256 errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name) 257 257 { 258 258 log_verbose("Adding device \"%s\", service: %zu", name, id); … … 283 283 } 284 284 285 const int ret = audio_device_init(dev, id, name);285 const errno_t ret = audio_device_init(dev, id, name); 286 286 if (ret != EOK) { 287 287 log_debug("Failed to initialize new audio device: %s", … … 296 296 audio_source_t *source = audio_device_get_source(dev); 297 297 if (source) { 298 const int ret = hound_add_source(hound, source);298 const errno_t ret = hound_add_source(hound, source); 299 299 if (ret != EOK) { 300 300 log_debug("Failed to add device source: %s", … … 308 308 audio_sink_t *sink = audio_device_get_sink(dev); 309 309 if (sink) { 310 const int ret = hound_add_sink(hound, sink);310 const errno_t ret = hound_add_sink(hound, sink); 311 311 if (ret != EOK) { 312 312 log_debug("Failed to add device sink: %s", … … 330 330 * @return Error code. 331 331 */ 332 int hound_add_source(hound_t *hound, audio_source_t *source)332 errno_t hound_add_source(hound_t *hound, audio_source_t *source) 333 333 { 334 334 assert(hound); … … 354 354 * @return Error code. 355 355 */ 356 int hound_add_sink(hound_t *hound, audio_sink_t *sink)356 errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink) 357 357 { 358 358 assert(hound); … … 378 378 * @return Error code. 379 379 */ 380 int hound_remove_source(hound_t *hound, audio_source_t *source)380 errno_t hound_remove_source(hound_t *hound, audio_source_t *source) 381 381 { 382 382 assert(hound); … … 395 395 * @return Error code. 396 396 */ 397 int hound_remove_sink(hound_t *hound, audio_sink_t *sink)397 errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink) 398 398 { 399 399 assert(hound); … … 413 413 * @return Error code. 414 414 */ 415 int hound_list_sources(hound_t *hound, const char ***list, size_t *size)415 errno_t hound_list_sources(hound_t *hound, const char ***list, size_t *size) 416 416 { 417 417 assert(hound); … … 428 428 } 429 429 const char **names = calloc(count, sizeof(char *)); 430 int ret = names ? EOK : ENOMEM;430 errno_t ret = names ? EOK : ENOMEM; 431 431 for (unsigned long i = 0; i < count && ret == EOK; ++i) { 432 432 link_t *slink = list_nth(&hound->sources, i); … … 455 455 * @return Error code. 456 456 */ 457 int hound_list_sinks(hound_t *hound, const char ***list, size_t *size)457 errno_t hound_list_sinks(hound_t *hound, const char ***list, size_t *size) 458 458 { 459 459 assert(hound); … … 470 470 } 471 471 const char **names = calloc(count, sizeof(char *)); 472 int ret = names ? EOK : ENOMEM;472 errno_t ret = names ? EOK : ENOMEM; 473 473 for (size_t i = 0; i < count && ret == EOK; ++i) { 474 474 link_t *slink = list_nth(&hound->sinks, i); … … 501 501 * identifiers with the same index are connected. 502 502 */ 503 int hound_list_connections(hound_t *hound, const char ***sources,503 errno_t hound_list_connections(hound_t *hound, const char ***sources, 504 504 const char ***sinks, size_t *size) 505 505 { … … 516 516 * @return Error code. 517 517 */ 518 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name)518 errno_t hound_connect(hound_t *hound, const char* source_name, const char* sink_name) 519 519 { 520 520 assert(hound); … … 555 555 * @return Error code. 556 556 */ 557 int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name)558 { 559 assert(hound); 560 fibril_mutex_lock(&hound->list_guard); 561 const int ret = hound_disconnect_internal(hound, source_name, sink_name);557 errno_t hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name) 558 { 559 assert(hound); 560 fibril_mutex_lock(&hound->list_guard); 561 const errno_t ret = hound_disconnect_internal(hound, source_name, sink_name); 562 562 fibril_mutex_unlock(&hound->list_guard); 563 563 return ret; … … 573 573 * This function has to be called with the list_guard lock held. 574 574 */ 575 static int hound_disconnect_internal(hound_t *hound, const char* source_name,575 static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name, 576 576 const char* sink_name) 577 577 { -
uspace/srv/audio/hound/hound.h
r132ab5d1 r5a6cc679 65 65 } hound_t; 66 66 67 int hound_init(hound_t *hound);68 int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);69 int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);67 errno_t hound_init(hound_t *hound); 68 errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx); 69 errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx); 70 70 hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id); 71 71 72 int hound_add_device(hound_t *hound, service_id_t id, const char* name);73 int hound_add_source(hound_t *hound, audio_source_t *source);74 int hound_add_sink(hound_t *hound, audio_sink_t *sink);75 int hound_list_sources(hound_t *hound, const char ***list, size_t *size);76 int hound_list_sinks(hound_t *hound, const char ***list, size_t *size);77 int hound_list_connections(hound_t *hound, const char ***sources,72 errno_t hound_add_device(hound_t *hound, service_id_t id, const char* name); 73 errno_t hound_add_source(hound_t *hound, audio_source_t *source); 74 errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink); 75 errno_t hound_list_sources(hound_t *hound, const char ***list, size_t *size); 76 errno_t hound_list_sinks(hound_t *hound, const char ***list, size_t *size); 77 errno_t hound_list_connections(hound_t *hound, const char ***sources, 78 78 const char ***sinks, size_t *size); 79 int hound_remove_source(hound_t *hound, audio_source_t *source);80 int hound_remove_sink(hound_t *hound, audio_sink_t *sink);81 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name);82 int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name);79 errno_t hound_remove_source(hound_t *hound, audio_source_t *source); 80 errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink); 81 errno_t hound_connect(hound_t *hound, const char* source_name, const char* sink_name); 82 errno_t hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name); 83 83 84 84 #endif -
uspace/srv/audio/hound/hound_ctx.c
r132ab5d1 r5a6cc679 45 45 #include "log.h" 46 46 47 static int update_data(audio_source_t *source, size_t size);48 static int new_data(audio_sink_t *sink);47 static errno_t update_data(audio_source_t *source, size_t size); 48 static errno_t new_data(audio_sink_t *sink); 49 49 50 50 /** … … 68 68 return NULL; 69 69 } 70 const int ret = audio_sink_init(ctx->sink, name, ctx, NULL,70 const errno_t ret = audio_sink_init(ctx->sink, name, ctx, NULL, 71 71 NULL, new_data, &AUDIO_FORMAT_DEFAULT); 72 72 if (ret != EOK) { … … 99 99 return NULL; 100 100 } 101 const int ret = audio_source_init(ctx->source, name, ctx, NULL,101 const errno_t ret = audio_source_init(ctx->source, name, ctx, NULL, 102 102 update_data, &AUDIO_FORMAT_DEFAULT); 103 103 if (ret != EOK) { … … 199 199 * @return Error code. 200 200 */ 201 static int stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)201 static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata) 202 202 { 203 203 assert(stream); … … 216 216 } 217 217 218 const int ret = audio_pipe_push(&stream->fifo, adata);218 const errno_t ret = audio_pipe_push(&stream->fifo, adata); 219 219 fibril_mutex_unlock(&stream->guard); 220 220 if (ret == EOK) … … 297 297 * @return Error code. 298 298 */ 299 int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,299 errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data, 300 300 size_t size) 301 301 { … … 312 312 } 313 313 314 const int ret =314 const errno_t ret = 315 315 audio_pipe_push_data(&stream->fifo, data, size, stream->format); 316 316 fibril_mutex_unlock(&stream->guard); … … 327 327 * @return Error code. 328 328 */ 329 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)329 errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size) 330 330 { 331 331 assert(stream); … … 391 391 * Mixes data from all streams and pushes it to all connections. 392 392 */ 393 int update_data(audio_source_t *source, size_t size)393 errno_t update_data(audio_source_t *source, size_t size) 394 394 { 395 395 assert(source); … … 425 425 } 426 426 427 int new_data(audio_sink_t *sink)427 errno_t new_data(audio_sink_t *sink) 428 428 { 429 429 assert(sink); … … 463 463 /* push to all streams */ 464 464 list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) { 465 const int ret = stream_push_data(stream, adata);465 const errno_t ret = stream_push_data(stream, adata); 466 466 if (ret != EOK) 467 467 log_error("Failed to push data to stream: %s", -
uspace/srv/audio/hound/hound_ctx.h
r132ab5d1 r5a6cc679 72 72 void hound_ctx_destroy_stream(hound_ctx_stream_t *stream); 73 73 74 int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer,74 errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer, 75 75 size_t size); 76 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);76 errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size); 77 77 size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data, 78 78 size_t size, const pcm_format_t *f); -
uspace/srv/audio/hound/iface.c
r132ab5d1 r5a6cc679 43 43 #include "log.h" 44 44 45 static int iface_add_context(void *server, hound_context_id_t *id,45 static errno_t iface_add_context(void *server, hound_context_id_t *id, 46 46 const char *name, bool record) 47 47 { … … 55 55 return ENOMEM; 56 56 57 const int ret = hound_add_ctx(server, ctx);57 const errno_t ret = hound_add_ctx(server, ctx); 58 58 if (ret != EOK) 59 59 hound_ctx_destroy(ctx); … … 63 63 } 64 64 65 static int iface_rem_context(void *server, hound_context_id_t id)65 static errno_t iface_rem_context(void *server, hound_context_id_t id) 66 66 { 67 67 assert(server); … … 69 69 if (!ctx) 70 70 return EINVAL; 71 const int ret = hound_remove_ctx(server, ctx);71 const errno_t ret = hound_remove_ctx(server, ctx); 72 72 if (ret == EOK) { 73 73 hound_ctx_destroy(ctx); … … 86 86 } 87 87 88 static int iface_get_list(void *server, const char ***list, size_t *size,88 static errno_t iface_get_list(void *server, const char ***list, size_t *size, 89 89 const char *connection, int flags) 90 90 { … … 98 98 } 99 99 100 static int iface_connect(void *server, const char *source, const char *sink)100 static errno_t iface_connect(void *server, const char *source, const char *sink) 101 101 { 102 102 log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink); … … 104 104 } 105 105 106 static int iface_disconnect(void *server, const char *source, const char *sink)106 static errno_t iface_disconnect(void *server, const char *source, const char *sink) 107 107 { 108 108 log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink); … … 110 110 } 111 111 112 static int iface_add_stream(void *server, hound_context_id_t id, int flags,112 static errno_t iface_add_stream(void *server, hound_context_id_t id, int flags, 113 113 pcm_format_t format, size_t size, void **data) 114 114 { … … 130 130 } 131 131 132 static int iface_rem_stream(void *server, void *stream)132 static errno_t iface_rem_stream(void *server, void *stream) 133 133 { 134 134 hound_ctx_destroy_stream(stream); … … 136 136 } 137 137 138 static int iface_drain_stream(void *stream)138 static errno_t iface_drain_stream(void *stream) 139 139 { 140 140 hound_ctx_stream_drain(stream); … … 142 142 } 143 143 144 static int iface_stream_data_read(void *stream, void *buffer, size_t size)144 static errno_t iface_stream_data_read(void *stream, void *buffer, size_t size) 145 145 { 146 146 return hound_ctx_stream_read(stream, buffer, size); 147 147 } 148 148 149 static int iface_stream_data_write(void *stream, const void *buffer, size_t size)149 static errno_t iface_stream_data_write(void *stream, const void *buffer, size_t size) 150 150 { 151 151 return hound_ctx_stream_write(stream, buffer, size); -
uspace/srv/audio/hound/main.c
r132ab5d1 r5a6cc679 57 57 static hound_t hound; 58 58 59 static int device_callback(service_id_t id, const char *name)59 static errno_t device_callback(service_id_t id, const char *name) 60 60 { 61 61 return hound_add_device(&hound, id, name); … … 76 76 } 77 77 78 int ret = hound_init(&hound);78 errno_t ret = hound_init(&hound); 79 79 if (ret != EOK) { 80 80 log_fatal("Failed to initialize hound structure: %s",
Note:
See TracChangeset
for help on using the changeset viewer.