Changeset 1c33539 in mainline for uspace/srv/audio/hound/hound.c


Ignore:
Timestamp:
2012-07-13T07:26:20Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6424800
Parents:
fd5c0b7
Message:

hound: Implement disconnect

File:
1 edited

Legend:

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

    rfd5c0b7 r1c33539  
    211211        if (!source || !sink) {
    212212                fibril_mutex_unlock(&hound->list_guard);
    213                 log_debug("Sink (%p), or source (%p) not found", sink, source);
     213                log_debug("Source (%p), or sink (%p) not found", source, sink);
    214214                return ENOENT;
    215215        }
     
    226226int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name)
    227227{
     228        assert(hound);
     229        log_verbose("Disconnecting '%s' to '%s'.", source_name, sink_name);
     230        fibril_mutex_lock(&hound->list_guard);
     231        audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name);
     232        audio_source_t *source = sink ?  find_source_by_name(&sink->sources, source_name) : NULL;
     233        if (!source || !sink) {
     234                fibril_mutex_unlock(&hound->list_guard);
     235                log_debug("Source (%p), or sink (%p) not found", source, sink);
     236                return ENOENT;
     237        }
     238        const int ret = audio_sink_remove_source(sink, source);
     239        if (ret != EOK) {
     240                log_debug("Failed remove source to sink list: %s", str_error(ret));
     241        } else {
     242                list_append(&source->link, &hound->sources);
     243        }
     244        fibril_mutex_unlock(&hound->list_guard);
     245        return EOK;
    228246        return ENOTSUP;
    229247}
Note: See TracChangeset for help on using the changeset viewer.