Ignore:
File:
1 edited

Legend:

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

    rfeeac0d re5bc912  
    176176
    177177/**
     178 * List instance helper.
     179 * @param l link
     180 * @return pointer to a hound context structure, NULL on failure.
     181 */
     182static inline hound_ctx_stream_t *hound_ctx_stream_from_link(link_t *l)
     183{
     184        return l ? list_get_instance(l, hound_ctx_stream_t, link) : NULL;
     185}
     186
     187/**
    178188 * New stream append helper.
    179189 * @param ctx hound context.
     
    407417        pcm_format_silence(buffer, size, &source->format);
    408418        fibril_mutex_lock(&ctx->guard);
    409         list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
     419        list_foreach(ctx->streams, it) {
     420                hound_ctx_stream_t *stream = hound_ctx_stream_from_link(it);
    410421                ssize_t copied = hound_ctx_stream_add_self(
    411422                    stream, buffer, size, &source->format);
     
    415426        log_verbose("CTX: %p. Pushing audio to %u connections", ctx,
    416427            list_count(&source->connections));
    417         list_foreach(source->connections, source_link, connection_t, conn) {
     428        list_foreach(source->connections, it) {
     429                connection_t *conn = connection_from_source_list(it);
    418430                connection_push_data(conn, adata);
    419431        }
     
    432444        /* count available data */
    433445        size_t available_frames = -1;  /* this is ugly.... */
    434         list_foreach(sink->connections, source_link, connection_t, conn) {
     446        list_foreach(sink->connections, it) {
     447                connection_t *conn = connection_from_source_list(it);
    435448                available_frames = min(available_frames,
    436449                    audio_pipe_frames(&conn->fifo));
     
    453466        /* mix data */
    454467        pcm_format_silence(buffer, bsize, &sink->format);
    455         list_foreach(sink->connections, source_link, connection_t, conn) {
     468        list_foreach(sink->connections, it) {
     469                connection_t *conn = connection_from_source_list(it);
    456470                /* This should not trigger data update on the source */
    457471                const size_t copied = connection_add_source_data(
     
    462476        }
    463477        /* push to all streams */
    464         list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
     478        list_foreach(ctx->streams, it) {
     479                hound_ctx_stream_t *stream = hound_ctx_stream_from_link(it);
    465480                const int ret = stream_push_data(stream, adata);
    466481                if (ret != EOK)
Note: See TracChangeset for help on using the changeset viewer.