Changeset 6906f61 in mainline


Ignore:
Timestamp:
2012-07-13T21:31:42Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88a37b5
Parents:
43c40a3
Message:

hound: Add support for "default" keyword

File:
1 edited

Legend:

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

    r43c40a3 r6906f61  
    161161{
    162162        assert(hound);
    163         if (!source || !source->name) {
     163        if (!source || !source->name || str_cmp(source->name, "default") == 0) {
    164164                log_debug("Invalid source specified.");
    165165                return EINVAL;
     
    187187{
    188188        assert(hound);
    189         if (!sink || !sink->name) {
     189        if (!sink || !sink->name || str_cmp(sink->name, "default") == 0) {
    190190                log_debug("Invalid source specified.");
    191191                return EINVAL;
     
    242242        log_verbose("Connecting '%s' to '%s'.", source_name, sink_name);
    243243        fibril_mutex_lock(&hound->list_guard);
     244
    244245        audio_source_t *source =
    245             find_source_by_name(&hound->sources, source_name);
    246         audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name);
     246            audio_source_list_instance(list_first(&hound->sources));
     247        if (str_cmp(source_name, "default") != 0)
     248            source = find_source_by_name(&hound->sources, source_name);
     249
     250        audio_sink_t *sink =
     251            audio_sink_list_instance(list_first(&hound->sinks));
     252        if (str_cmp(sink_name, "default") != 0)
     253            sink = find_sink_by_name(&hound->sinks, sink_name);
     254
    247255        if (!source || !sink) {
    248256                fibril_mutex_unlock(&hound->list_guard);
     
    274282        assert(fibril_mutex_is_locked(&hound->list_guard));
    275283        log_verbose("Disconnecting '%s' to '%s'.", source_name, sink_name);
    276         audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name);
    277         audio_source_t *source = sink ?  find_source_by_name(&sink->sources, source_name) : NULL;
     284
     285        audio_sink_t *sink =
     286            audio_sink_list_instance(list_first(&hound->sinks));
     287        if (str_cmp(sink_name, "default") != 0)
     288            sink = find_sink_by_name(&hound->sinks, sink_name);
     289
     290        audio_source_t *source =
     291            audio_source_list_instance(list_first(&hound->sources));
     292        if (str_cmp(source_name, "default") != 0)
     293            source = sink ? find_source_by_name(&sink->sources, source_name) : NULL;
    278294        if (!source || !sink) {
    279295                log_debug("Source (%p), or sink (%p) not found", source, sink);
Note: See TracChangeset for help on using the changeset viewer.