Changeset f3fced0 in mainline for uspace/srv/audio/hound/hound.c


Ignore:
Timestamp:
2012-07-13T05:39:36Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b2ac3d
Parents:
63d6ff9
Message:

hound: Implement connect code.

File:
1 edited

Legend:

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

    r63d6ff9 rf3fced0  
    5555                    audio_ ## type ## _list_instance(it); \
    5656                if (str_cmp(name, dev->name) == 0) { \
    57                         log_debug("%s with name '%s' is already present", \
     57                        log_debug("%s with name '%s' is in the list", \
    5858                            #type, name); \
    5959                        return dev; \
     
    8282        list_initialize(&hound->devices);
    8383        list_initialize(&hound->sources);
    84         list_initialize(&hound->available_sources);
    8584        list_initialize(&hound->sinks);
    8685        return EOK;
     
    202201}
    203202
     203int hound_connect(hound_t *hound, const char* source_name, const char* sink_name)
     204{
     205        assert(hound);
     206        log_verbose("Connecting '%s' to '%s'.", source_name, sink_name);
     207        fibril_mutex_lock(&hound->list_guard);
     208        audio_source_t *source =
     209            find_source_by_name(&hound->sources, source_name);
     210        audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name);
     211        if (!source || !sink) {
     212                fibril_mutex_unlock(&hound->list_guard);
     213                log_debug("Sink (%p), or source (%p) not found", sink, source);
     214                return ENOENT;
     215        }
     216        list_remove(&source->link);
     217        const int ret = audio_sink_add_source(sink, source);
     218        if (ret != EOK) {
     219                log_debug("Failed add source to sink list: %s", str_error(ret));
     220                list_append(&source->link, &hound->sources);
     221        }
     222        fibril_mutex_unlock(&hound->list_guard);
     223        return EOK;
     224}
     225
     226int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name)
     227{
     228        return ENOTSUP;
     229}
    204230/**
    205231 * @}
Note: See TracChangeset for help on using the changeset viewer.