Changeset 3b6c1d4 in mainline for uspace/srv/audio/hound/hound.c


Ignore:
Timestamp:
2013-04-02T15:13:12Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
62beb4b
Parents:
2d1fdcad
Message:

hound: implement context manipulation

File:
1 edited

Legend:

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

    r2d1fdcad r3b6c1d4  
    7575        FIND_BY_NAME(sink);
    7676}
     77
    7778static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
    7879
     
    8283        fibril_mutex_initialize(&hound->list_guard);
    8384        list_initialize(&hound->devices);
     85        list_initialize(&hound->contexts);
    8486        list_initialize(&hound->sources);
    8587        list_initialize(&hound->sinks);
    8688        return EOK;
     89}
     90
     91int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
     92{
     93        log_info("Trying to add context %p", ctx);
     94        assert(hound);
     95        if (!ctx)
     96                return EINVAL;
     97        list_append(&ctx->link, &hound->contexts);
     98        //TODO register sinks/sources
     99        return EOK;
     100}
     101
     102int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
     103{
     104        assert(hound);
     105        if (!ctx)
     106                return EINVAL;
     107        list_remove(&ctx->link);
     108        return EOK;
     109}
     110
     111hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id)
     112{
     113        assert(hound);
     114
     115        //TODO locking
     116
     117        list_foreach(hound->contexts, it) {
     118                hound_ctx_t *ctx = hound_ctx_from_link(it);
     119                if (hound_ctx_get_id(ctx) == id)
     120                        return ctx;
     121        }
     122        return NULL;
    87123}
    88124
Note: See TracChangeset for help on using the changeset viewer.