Changeset 5a6cc679 in mainline for uspace/srv/audio


Ignore:
Timestamp:
2018-01-31T02:21:24Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0a9cc2
Parents:
132ab5d1
Message:

Merge commit '50f19b7ee8e94570b5c63896736c4eb49cfa18db' into forwardport

Not all ints are converted to errno_t in xhci tree yet, however it compiles and works :)

Location:
uspace/srv/audio/hound
Files:
16 edited

Legend:

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

    r132ab5d1 r5a6cc679  
    213213 * @return Error code.
    214214 */
    215 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
     215errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
    216216{
    217217        assert(pipe);
  • uspace/srv/audio/hound/audio_data.h

    r132ab5d1 r5a6cc679  
    7575void audio_pipe_fini(audio_pipe_t *pipe);
    7676
    77 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);
     77errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);
    7878audio_data_t *audio_pipe_pop(audio_pipe_t *pipe);
    7979
     
    113113 * Reference counted buffer is created automatically.
    114114 */
    115 static inline int audio_pipe_push_data(audio_pipe_t *pipe,
     115static inline errno_t audio_pipe_push_data(audio_pipe_t *pipe,
    116116    const void *data, size_t size, pcm_format_t f)
    117117{
    118118        audio_data_t *adata = audio_data_create(data, size, f);
    119119        if (adata) {
    120                 const int ret = audio_pipe_push(pipe, adata);
     120                const errno_t ret = audio_pipe_push(pipe, adata);
    121121                audio_data_unref(adata);
    122122                return ret;
  • uspace/srv/audio/hound/audio_device.c

    r132ab5d1 r5a6cc679  
    5151#define BUFFER_PARTS   16
    5252
    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);
     53static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new);
     54static errno_t device_source_connection_callback(audio_source_t *source, bool new);
    5555static 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);
     56static errno_t device_check_format(audio_sink_t* sink);
     57static errno_t get_buffer(audio_device_t *dev);
     58static errno_t release_buffer(audio_device_t *dev);
    5959static void advance_buffer(audio_device_t *dev, size_t size);
    6060static inline bool is_running(audio_device_t *dev)
     
    7272 * @return Error code.
    7373 */
    74 int audio_device_init(audio_device_t *dev, service_id_t id, const char *name)
     74errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name)
    7575{
    7676        assert(dev);
     
    122122        assert(dev);
    123123        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);
    125125        if (rc == EOK && val)
    126126                return &dev->source;
     
    138138        assert(dev);
    139139        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);
    141141        if (rc == EOK && val)
    142142                return &dev->sink;
     
    153153 * connections.
    154154 */
    155 static int device_sink_connection_callback(audio_sink_t* sink, bool new)
     155static errno_t device_sink_connection_callback(audio_sink_t* sink, bool new)
    156156{
    157157        assert(sink);
     
    160160                log_verbose("First connection on device sink '%s'", sink->name);
    161161
    162                 int ret = get_buffer(dev);
     162                errno_t ret = get_buffer(dev);
    163163                if (ret != EOK) {
    164164                        log_error("Failed to get device buffer: %s",
     
    196196                log_verbose("Removed last connection on device sink '%s'",
    197197                    sink->name);
    198                 int ret = audio_pcm_stop_playback(dev->sess);
     198                errno_t ret = audio_pcm_stop_playback(dev->sess);
    199199                if (ret != EOK) {
    200200                        log_error("Failed to stop playback: %s",
     
    215215 * connections.
    216216 */
    217 static int device_source_connection_callback(audio_source_t *source, bool new)
     217static errno_t device_source_connection_callback(audio_source_t *source, bool new)
    218218{
    219219        assert(source);
    220220        audio_device_t *dev = source->private_data;
    221221        if (new && list_count(&source->connections) == 1) {
    222                 int ret = get_buffer(dev);
     222                errno_t ret = get_buffer(dev);
    223223                if (ret != EOK) {
    224224                        log_error("Failed to get device buffer: %s",
     
    244244        if (list_count(&source->connections) == 0) { /* Disconnected */
    245245                assert(!new);
    246                 int ret = audio_pcm_stop_capture_immediate(dev->sess);
     246                errno_t ret = audio_pcm_stop_capture_immediate(dev->sess);
    247247                if (ret != EOK) {
    248248                        log_error("Failed to start recording: %s",
     
    289289                        log_verbose("Capture terminated");
    290290                        dev->source.format = AUDIO_FORMAT_ANY;
    291                         const int ret = release_buffer(dev);
     291                        const errno_t ret = release_buffer(dev);
    292292                        if (ret != EOK) {
    293293                                log_error("Failed to release buffer: %s",
     
    300300                        log_verbose("Playback Terminated");
    301301                        dev->sink.format = AUDIO_FORMAT_ANY;
    302                         const int ret = release_buffer(dev);
     302                        const errno_t ret = release_buffer(dev);
    303303                        if (ret != EOK) {
    304304                                log_error("Failed to release buffer: %s",
     
    309309                }
    310310                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,
    312312                            dev->buffer.position, dev->buffer.fragment_size);
    313313                        advance_buffer(dev, dev->buffer.fragment_size);
     
    329329 * @return Error code.
    330330 */
    331 static int device_check_format(audio_sink_t* sink)
     331static errno_t device_check_format(audio_sink_t* sink)
    332332{
    333333        assert(sink);
     
    347347 * @return Error code.
    348348 */
    349 static int get_buffer(audio_device_t *dev)
     349static errno_t get_buffer(audio_device_t *dev)
    350350{
    351351        assert(dev);
     
    362362        size_t preferred_size = 0;
    363363
    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,
    365365            &preferred_size);
    366366        if (ret == EOK) {
     
    378378 * @return Error code.
    379379 */
    380 static int release_buffer(audio_device_t *dev)
     380static errno_t release_buffer(audio_device_t *dev)
    381381{
    382382        assert(dev);
    383383        assert(dev->buffer.base);
    384384
    385         const int ret = audio_pcm_release_buffer(dev->sess);
     385        const errno_t ret = audio_pcm_release_buffer(dev->sess);
    386386        if (ret == EOK) {
    387387                as_area_destroy(dev->buffer.base);
  • uspace/srv/audio/hound/audio_device.h

    r132ab5d1 r5a6cc679  
    7676};
    7777
    78 int audio_device_init(audio_device_t *dev, service_id_t id, const char *name);
     78errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name);
    7979void audio_device_fini(audio_device_t *dev);
    8080audio_source_t * audio_device_get_source(audio_device_t *dev);
    8181audio_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);
     82errno_t audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size);
     83errno_t audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size);
    8484
    8585#endif
  • uspace/srv/audio/hound/audio_sink.c

    r132ab5d1 r5a6cc679  
    5656 * @return Error code.
    5757 */
    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 *),
     58errno_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 *),
    6161    const pcm_format_t *f)
    6262{
     
    9797 * @return Error code.
    9898 */
    99 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)
     99errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)
    100100{
    101101        assert(sink);
     
    114114        }
    115115        if (sink->check_format) {
    116                 const int ret = sink->check_format(sink);
     116                const errno_t ret = sink->check_format(sink);
    117117                if (ret != EOK && ret != ELIMIT) {
    118118                        log_debug("Format check failed on sink %s", sink->name);
     
    141141        pcm_format_silence(dest, size, &sink->format);
    142142        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(
    144144                    conn, dest, size, sink->format);
    145145                if (ret != EOK) {
  • uspace/srv/audio/hound/audio_sink.h

    r132ab5d1 r5a6cc679  
    6060        void *private_data;
    6161        /** Connect/disconnect callback */
    62         int (*connection_change)(audio_sink_t *, bool);
     62        errno_t (*connection_change)(audio_sink_t *, bool);
    6363        /** Backend callback to check data */
    64         int (*check_format)(audio_sink_t *);
     64        errno_t (*check_format)(audio_sink_t *);
    6565        /** new data notifier */
    66         int (*data_available)(audio_sink_t *);
     66        errno_t (*data_available)(audio_sink_t *);
    6767};
    6868
     
    7777}
    7878
    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 *),
     79errno_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 *),
    8282    const pcm_format_t *f);
    8383
    8484void audio_sink_fini(audio_sink_t *sink);
    85 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);
     85errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);
    8686void audio_sink_mix_inputs(audio_sink_t *sink, void* dest, size_t size);
    8787
  • uspace/srv/audio/hound/audio_source.c

    r132ab5d1 r5a6cc679  
    5656 * @return Error code.
    5757 */
    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),
     58errno_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),
    6161    const pcm_format_t *f)
    6262{
     
    9696 * @return Error code.
    9797 */
    98 int audio_source_push_data(audio_source_t *source, const void *data,
     98errno_t audio_source_push_data(audio_source_t *source, const void *data,
    9999    size_t size)
    100100{
     
    107107
    108108        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);
    110110                if (ret != EOK) {
    111111                        log_warning("Failed push data to %s: %s",
  • uspace/srv/audio/hound/audio_source.h

    r132ab5d1 r5a6cc679  
    5555        void *private_data;
    5656        /** 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);
    5858        /** 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);
    6060};
    6161
     
    7070}
    7171
    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),
     72errno_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),
    7575    const pcm_format_t *f);
    7676void audio_source_fini(audio_source_t *source);
    77 int audio_source_push_data(audio_source_t *source, const void *data,
     77errno_t audio_source_push_data(audio_source_t *source, const void *data,
    7878    size_t size);
    7979static inline const pcm_format_t *audio_source_format(const audio_source_t *s)
  • uspace/srv/audio/hound/connection.c

    r132ab5d1 r5a6cc679  
    101101 * @param format format of the destination audio buffer.
    102102 */
    103 int connection_add_source_data(connection_t *connection, void *data,
     103errno_t connection_add_source_data(connection_t *connection, void *data,
    104104    size_t size, pcm_format_t format)
    105105{
     
    129129 * @return Error code.
    130130 */
    131 int connection_push_data(connection_t *connection,
     131errno_t connection_push_data(connection_t *connection,
    132132    audio_data_t *adata)
    133133{
    134134        assert(connection);
    135135        assert(adata);
    136         const int ret = audio_pipe_push(&connection->fifo, adata);
     136        const errno_t ret = audio_pipe_push(&connection->fifo, adata);
    137137        if (ret == EOK && connection->sink->data_available)
    138138                connection->sink->data_available(connection->sink);
  • uspace/srv/audio/hound/connection.h

    r132ab5d1 r5a6cc679  
    8484void connection_destroy(connection_t *connection);
    8585
    86 int connection_add_source_data(connection_t *connection, void *data,
     86errno_t connection_add_source_data(connection_t *connection, void *data,
    8787    size_t size, pcm_format_t format);
    8888
    89 int connection_push_data(connection_t *connection, audio_data_t *adata);
     89errno_t connection_push_data(connection_t *connection, audio_data_t *adata);
    9090
    9191/**
  • uspace/srv/audio/hound/hound.c

    r132ab5d1 r5a6cc679  
    110110}
    111111
    112 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
     112static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
    113113
    114114/**
     
    162162 * @return Error code.
    163163 */
    164 int hound_init(hound_t *hound)
     164errno_t hound_init(hound_t *hound)
    165165{
    166166        assert(hound);
     
    180180 * @return Error code.
    181181 */
    182 int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
     182errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
    183183{
    184184        log_info("Trying to add context %p", ctx);
     
    189189        list_append(&ctx->link, &hound->contexts);
    190190        fibril_mutex_unlock(&hound->list_guard);
    191         int ret = EOK;
     191        errno_t ret = EOK;
    192192        if (ret == EOK && ctx->source)
    193193                ret = hound_add_source(hound, ctx->source);
     
    208208 * @return Error code.
    209209 */
    210 int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
     210errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
    211211{
    212212        assert(hound);
     
    254254 * @return Error code.
    255255 */
    256 int hound_add_device(hound_t *hound, service_id_t id, const char *name)
     256errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name)
    257257{
    258258        log_verbose("Adding device \"%s\", service: %zu", name, id);
     
    283283        }
    284284
    285         const int ret = audio_device_init(dev, id, name);
     285        const errno_t ret = audio_device_init(dev, id, name);
    286286        if (ret != EOK) {
    287287                log_debug("Failed to initialize new audio device: %s",
     
    296296        audio_source_t *source = audio_device_get_source(dev);
    297297        if (source) {
    298                 const int ret = hound_add_source(hound, source);
     298                const errno_t ret = hound_add_source(hound, source);
    299299                if (ret != EOK) {
    300300                        log_debug("Failed to add device source: %s",
     
    308308        audio_sink_t *sink = audio_device_get_sink(dev);
    309309        if (sink) {
    310                 const int ret = hound_add_sink(hound, sink);
     310                const errno_t ret = hound_add_sink(hound, sink);
    311311                if (ret != EOK) {
    312312                        log_debug("Failed to add device sink: %s",
     
    330330 * @return Error code.
    331331 */
    332 int hound_add_source(hound_t *hound, audio_source_t *source)
     332errno_t hound_add_source(hound_t *hound, audio_source_t *source)
    333333{
    334334        assert(hound);
     
    354354 * @return Error code.
    355355 */
    356 int hound_add_sink(hound_t *hound, audio_sink_t *sink)
     356errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink)
    357357{
    358358        assert(hound);
     
    378378 * @return Error code.
    379379 */
    380 int hound_remove_source(hound_t *hound, audio_source_t *source)
     380errno_t hound_remove_source(hound_t *hound, audio_source_t *source)
    381381{
    382382        assert(hound);
     
    395395 * @return Error code.
    396396 */
    397 int hound_remove_sink(hound_t *hound, audio_sink_t *sink)
     397errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink)
    398398{
    399399        assert(hound);
     
    413413 * @return Error code.
    414414 */
    415 int hound_list_sources(hound_t *hound, const char ***list, size_t *size)
     415errno_t hound_list_sources(hound_t *hound, const char ***list, size_t *size)
    416416{
    417417        assert(hound);
     
    428428        }
    429429        const char **names = calloc(count, sizeof(char *));
    430         int ret = names ? EOK : ENOMEM;
     430        errno_t ret = names ? EOK : ENOMEM;
    431431        for (unsigned long i = 0; i < count && ret == EOK; ++i) {
    432432                link_t *slink = list_nth(&hound->sources, i);
     
    455455 * @return Error code.
    456456 */
    457 int hound_list_sinks(hound_t *hound, const char ***list, size_t *size)
     457errno_t hound_list_sinks(hound_t *hound, const char ***list, size_t *size)
    458458{
    459459        assert(hound);
     
    470470        }
    471471        const char **names = calloc(count, sizeof(char *));
    472         int ret = names ? EOK : ENOMEM;
     472        errno_t ret = names ? EOK : ENOMEM;
    473473        for (size_t i = 0; i < count && ret == EOK; ++i) {
    474474                link_t *slink = list_nth(&hound->sinks, i);
     
    501501 * identifiers with the same index are connected.
    502502 */
    503 int hound_list_connections(hound_t *hound, const char ***sources,
     503errno_t hound_list_connections(hound_t *hound, const char ***sources,
    504504    const char ***sinks, size_t *size)
    505505{
     
    516516 * @return Error code.
    517517 */
    518 int hound_connect(hound_t *hound, const char* source_name, const char* sink_name)
     518errno_t hound_connect(hound_t *hound, const char* source_name, const char* sink_name)
    519519{
    520520        assert(hound);
     
    555555 * @return Error code.
    556556 */
    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);
     557errno_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);
    562562        fibril_mutex_unlock(&hound->list_guard);
    563563        return ret;
     
    573573 * This function has to be called with the list_guard lock held.
    574574 */
    575 static int hound_disconnect_internal(hound_t *hound, const char* source_name,
     575static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name,
    576576    const char* sink_name)
    577577{
  • uspace/srv/audio/hound/hound.h

    r132ab5d1 r5a6cc679  
    6565} hound_t;
    6666
    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);
     67errno_t hound_init(hound_t *hound);
     68errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);
     69errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);
    7070hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id);
    7171
    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,
     72errno_t hound_add_device(hound_t *hound, service_id_t id, const char* name);
     73errno_t hound_add_source(hound_t *hound, audio_source_t *source);
     74errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink);
     75errno_t hound_list_sources(hound_t *hound, const char ***list, size_t *size);
     76errno_t hound_list_sinks(hound_t *hound, const char ***list, size_t *size);
     77errno_t hound_list_connections(hound_t *hound, const char ***sources,
    7878    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);
     79errno_t hound_remove_source(hound_t *hound, audio_source_t *source);
     80errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink);
     81errno_t hound_connect(hound_t *hound, const char* source_name, const char* sink_name);
     82errno_t hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name);
    8383
    8484#endif
  • uspace/srv/audio/hound/hound_ctx.c

    r132ab5d1 r5a6cc679  
    4545#include "log.h"
    4646
    47 static int update_data(audio_source_t *source, size_t size);
    48 static int new_data(audio_sink_t *sink);
     47static errno_t update_data(audio_source_t *source, size_t size);
     48static errno_t new_data(audio_sink_t *sink);
    4949
    5050/**
     
    6868                        return NULL;
    6969                }
    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,
    7171                    NULL, new_data, &AUDIO_FORMAT_DEFAULT);
    7272                if (ret != EOK) {
     
    9999                        return NULL;
    100100                }
    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,
    102102                    update_data, &AUDIO_FORMAT_DEFAULT);
    103103                if (ret != EOK) {
     
    199199 * @return Error code.
    200200 */
    201 static int stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
     201static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
    202202{
    203203        assert(stream);
     
    216216        }
    217217
    218         const int ret = audio_pipe_push(&stream->fifo, adata);
     218        const errno_t ret = audio_pipe_push(&stream->fifo, adata);
    219219        fibril_mutex_unlock(&stream->guard);
    220220        if (ret == EOK)
     
    297297 * @return Error code.
    298298 */
    299 int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
     299errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
    300300    size_t size)
    301301{
     
    312312        }
    313313
    314         const int ret =
     314        const errno_t ret =
    315315            audio_pipe_push_data(&stream->fifo, data, size, stream->format);
    316316        fibril_mutex_unlock(&stream->guard);
     
    327327 * @return Error code.
    328328 */
    329 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
     329errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
    330330{
    331331        assert(stream);
     
    391391 * Mixes data from all streams and pushes it to all connections.
    392392 */
    393 int update_data(audio_source_t *source, size_t size)
     393errno_t update_data(audio_source_t *source, size_t size)
    394394{
    395395        assert(source);
     
    425425}
    426426
    427 int new_data(audio_sink_t *sink)
     427errno_t new_data(audio_sink_t *sink)
    428428{
    429429        assert(sink);
     
    463463        /* push to all streams */
    464464        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);
    466466                if (ret != EOK)
    467467                        log_error("Failed to push data to stream: %s",
  • uspace/srv/audio/hound/hound_ctx.h

    r132ab5d1 r5a6cc679  
    7272void hound_ctx_destroy_stream(hound_ctx_stream_t *stream);
    7373
    74 int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer,
     74errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer,
    7575    size_t size);
    76 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
     76errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
    7777size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
    7878    size_t size, const pcm_format_t *f);
  • uspace/srv/audio/hound/iface.c

    r132ab5d1 r5a6cc679  
    4343#include "log.h"
    4444
    45 static int iface_add_context(void *server, hound_context_id_t *id,
     45static errno_t iface_add_context(void *server, hound_context_id_t *id,
    4646    const char *name, bool record)
    4747{
     
    5555                return ENOMEM;
    5656
    57         const int ret = hound_add_ctx(server, ctx);
     57        const errno_t ret = hound_add_ctx(server, ctx);
    5858        if (ret != EOK)
    5959                hound_ctx_destroy(ctx);
     
    6363}
    6464
    65 static int iface_rem_context(void *server, hound_context_id_t id)
     65static errno_t iface_rem_context(void *server, hound_context_id_t id)
    6666{
    6767        assert(server);
     
    6969        if (!ctx)
    7070                return EINVAL;
    71         const int ret = hound_remove_ctx(server, ctx);
     71        const errno_t ret = hound_remove_ctx(server, ctx);
    7272        if (ret == EOK) {
    7373                hound_ctx_destroy(ctx);
     
    8686}
    8787
    88 static int iface_get_list(void *server, const char ***list, size_t *size,
     88static errno_t iface_get_list(void *server, const char ***list, size_t *size,
    8989    const char *connection, int flags)
    9090{
     
    9898}
    9999
    100 static int iface_connect(void *server, const char *source, const char *sink)
     100static errno_t iface_connect(void *server, const char *source, const char *sink)
    101101{
    102102        log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
     
    104104}
    105105
    106 static int iface_disconnect(void *server, const char *source, const char *sink)
     106static errno_t iface_disconnect(void *server, const char *source, const char *sink)
    107107{
    108108        log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
     
    110110}
    111111
    112 static int iface_add_stream(void *server, hound_context_id_t id, int flags,
     112static errno_t iface_add_stream(void *server, hound_context_id_t id, int flags,
    113113    pcm_format_t format, size_t size, void **data)
    114114{
     
    130130}
    131131
    132 static int iface_rem_stream(void *server, void *stream)
     132static errno_t iface_rem_stream(void *server, void *stream)
    133133{
    134134        hound_ctx_destroy_stream(stream);
     
    136136}
    137137
    138 static int iface_drain_stream(void *stream)
     138static errno_t iface_drain_stream(void *stream)
    139139{
    140140        hound_ctx_stream_drain(stream);
     
    142142}
    143143
    144 static int iface_stream_data_read(void *stream, void *buffer, size_t size)
     144static errno_t iface_stream_data_read(void *stream, void *buffer, size_t size)
    145145{
    146146        return hound_ctx_stream_read(stream, buffer, size);
    147147}
    148148
    149 static int iface_stream_data_write(void *stream, const void *buffer, size_t size)
     149static errno_t iface_stream_data_write(void *stream, const void *buffer, size_t size)
    150150{
    151151        return hound_ctx_stream_write(stream, buffer, size);
  • uspace/srv/audio/hound/main.c

    r132ab5d1 r5a6cc679  
    5757static hound_t hound;
    5858
    59 static int device_callback(service_id_t id, const char *name)
     59static errno_t device_callback(service_id_t id, const char *name)
    6060{
    6161        return hound_add_device(&hound, id, name);
     
    7676        }
    7777
    78         int ret = hound_init(&hound);
     78        errno_t ret = hound_init(&hound);
    7979        if (ret != EOK) {
    8080                log_fatal("Failed to initialize hound structure: %s",
Note: See TracChangeset for help on using the changeset viewer.