Ignore:
Timestamp:
2013-04-11T21:55:43Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6eeaf1d
Parents:
bee5349
Message:

hound: implement device source events

File:
1 edited

Legend:

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

    rbee5349 r4eff63c  
    4141#include <str_error.h>
    4242
     43#include "audio_data.h"
    4344#include "audio_source.h"
    4445#include "audio_sink.h"
     46#include "connection.h"
    4547#include "log.h"
    4648
     
    8789        source->name = NULL;
    8890}
     91/**
     92 * Push data to all connections.
     93 * @param source The source of the data.
     94 * @param dest Destination buffer.
     95 * @param size size of the @p dest buffer.
     96 * @return Error code.
     97 */
     98int audio_source_push_data(audio_source_t *source, const void *data,
     99    size_t size)
     100{
     101        assert(source);
     102        assert(data);
     103
     104        audio_data_t *adata = audio_data_create(data, size, source->format);
     105        if (!adata)
     106                return ENOMEM;
     107
     108        list_foreach(source->connections, it) {
     109                connection_t *conn = connection_from_source_list(it);
     110                const int ret = connection_push_data(conn, adata);
     111                if (ret != EOK) {
     112                        log_warning("Failed push data to %s: %s",
     113                            connection_sink_name(conn), str_error(ret));
     114                }
     115        }
     116        audio_data_unref(adata);
     117        return EOK;
     118}
    89119
    90120/**
Note: See TracChangeset for help on using the changeset viewer.