Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/hound_ctx.c

    rb7fd2a0 r38d150e  
    4545#include "log.h"
    4646
    47 static errno_t update_data(audio_source_t *source, size_t size);
    48 static errno_t new_data(audio_sink_t *sink);
     47static int update_data(audio_source_t *source, size_t size);
     48static int new_data(audio_sink_t *sink);
    4949
    5050/**
     
    6868                        return NULL;
    6969                }
    70                 const errno_t ret = audio_sink_init(ctx->sink, name, ctx, NULL,
     70                const int ret = audio_sink_init(ctx->sink, name, ctx, NULL,
    7171                    NULL, new_data, &AUDIO_FORMAT_DEFAULT);
    7272                if (ret != EOK) {
     
    9999                        return NULL;
    100100                }
    101                 const errno_t ret = audio_source_init(ctx->source, name, ctx, NULL,
     101                const int ret = audio_source_init(ctx->source, name, ctx, NULL,
    102102                    update_data, &AUDIO_FORMAT_DEFAULT);
    103103                if (ret != EOK) {
     
    199199 * @return Error code.
    200200 */
    201 static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
     201static int stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
    202202{
    203203        assert(stream);
     
    216216        }
    217217
    218         const errno_t ret = audio_pipe_push(&stream->fifo, adata);
     218        const int ret = audio_pipe_push(&stream->fifo, adata);
    219219        fibril_mutex_unlock(&stream->guard);
    220220        if (ret == EOK)
     
    297297 * @return Error code.
    298298 */
    299 errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
     299int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
    300300    size_t size)
    301301{
     
    312312        }
    313313
    314         const errno_t ret =
     314        const int ret =
    315315            audio_pipe_push_data(&stream->fifo, data, size, stream->format);
    316316        fibril_mutex_unlock(&stream->guard);
     
    327327 * @return Error code.
    328328 */
    329 errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
     329int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
    330330{
    331331        assert(stream);
     
    340340
    341341        pcm_format_silence(data, size, &stream->format);
    342         const size_t ret =
     342        const int ret =
    343343            audio_pipe_mix_data(&stream->fifo, data, size, &stream->format);
    344344        fibril_mutex_unlock(&stream->guard);
    345         if (ret > 0) {
     345        if (ret == EOK)
    346346                fibril_condvar_signal(&stream->change);
    347                 return EOK;
    348         }
    349         return EEMPTY;
     347        return ret;
    350348}
    351349
     
    356354 * @param size Size of the @p data buffer.
    357355 * @param format Destination data format.
    358  * @return Size of the destination buffer touch with stream's data.
    359  */
    360 size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
     356 * @return Size of the destination buffer touch with stream's data,
     357 *         error code on failure.
     358 */
     359ssize_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
    361360    size_t size, const pcm_format_t *f)
    362361{
    363362        assert(stream);
    364363        fibril_mutex_lock(&stream->guard);
    365         const size_t ret = audio_pipe_mix_data(&stream->fifo, data, size, f);
     364        const int ret = audio_pipe_mix_data(&stream->fifo, data, size, f);
    366365        fibril_condvar_signal(&stream->change);
    367366        fibril_mutex_unlock(&stream->guard);
     
    391390 * Mixes data from all streams and pushes it to all connections.
    392391 */
    393 errno_t update_data(audio_source_t *source, size_t size)
     392int update_data(audio_source_t *source, size_t size)
    394393{
    395394        assert(source);
     
    425424}
    426425
    427 errno_t new_data(audio_sink_t *sink)
     426int new_data(audio_sink_t *sink)
    428427{
    429428        assert(sink);
     
    458457        list_foreach(sink->connections, source_link, connection_t, conn) {
    459458                /* This should not trigger data update on the source */
    460                 connection_add_source_data(
     459                const size_t copied = connection_add_source_data(
    461460                    conn, buffer, bsize, sink->format);
     461                if (copied != bsize)
     462                        log_error("Copied less than advertised data, "
     463                            "something is wrong");
    462464        }
    463465        /* push to all streams */
    464466        list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
    465                 const errno_t ret = stream_push_data(stream, adata);
     467                const int ret = stream_push_data(stream, adata);
    466468                if (ret != EOK)
    467469                        log_error("Failed to push data to stream: %s",
Note: See TracChangeset for help on using the changeset viewer.