Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7294b5b in mainline


Ignore:
Timestamp:
2013-03-24T13:04:04Z (7 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
ec81221
Parents:
13318d1
Message:

libhound: Add client wrappers for connection control

Location:
uspace/lib/hound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/include/hound/client.h

    r13318d1 r7294b5b  
    5858int hound_context_set_main_stream_format(hound_context_t *hound,
    5959    unsigned channels, unsigned rate, pcm_sample_format_t format);
    60 int hound_get_output_targets(const char **names, size_t *count);
    61 int hound_get_input_targets(const char **names, size_t *count);
     60
     61int hound_context_get_available_targets(hound_context_t *hound,
     62    const char ***names, size_t *count);
     63int hound_context_get_connected_targets(hound_context_t *hound,
     64    const char ***names, size_t *count);
    6265
    6366int hound_context_connect_target(hound_context_t *hound, const char* target);
  • uspace/lib/hound/src/client.c

    r13318d1 r7294b5b  
    9595                new_context->id = hound_service_register_context(
    9696                    new_context->session, new_context->name, record);
    97                 if (new_context->id <= 0) {
     97                if (hound_context_id_err(new_context->id) != EOK) {
    9898                        free(new_context->name);
    9999                        free(new_context);
     
    136136}
    137137
    138 int hound_get_output_targets(const char **names, size_t *count)
    139 {
     138int hound_context_get_available_targets(hound_context_t *hound,
     139    const char ***names, size_t *count)
     140{
     141        assert(hound);
    140142        assert(names);
    141143        assert(count);
    142         return ENOTSUP;
    143 }
    144 
    145 int hound_get_input_targets(const char **names, size_t *count)
    146 {
     144        return hound_service_get_list_all(hound->session, names, count,
     145            hound->record ? HOUND_SOURCE_DEVS : HOUND_SINK_DEVS);
     146}
     147
     148int hound_context_get_connected_targets(hound_context_t *hound,
     149    const char ***names, size_t *count)
     150{
     151        assert(hound);
    147152        assert(names);
    148153        assert(count);
    149         return ENOTSUP;
     154        return hound_service_get_list(hound->session, names, count,
     155            HOUND_CONNECTED | (hound->record ?
     156                HOUND_SOURCE_DEVS : HOUND_SINK_DEVS), hound->name);
    150157}
    151158
     
    153160{
    154161        assert(hound);
    155         return ENOTSUP;
     162        if (hound->record)
     163                return hound_service_connect_source_sink(
     164                    hound->session, target, hound->name);
     165        else
     166                return hound_service_connect_source_sink(
     167                    hound->session, hound->name, target);
    156168}
    157169
     
    159171{
    160172        assert(hound);
    161         return ENOTSUP;
     173        if (hound->record)
     174                return hound_service_disconnect_source_sink(
     175                    hound->session, target, hound->name);
     176        else
     177                return hound_service_disconnect_source_sink(
     178                    hound->session, hound->name, target);
    162179}
    163180
Note: See TracChangeset for help on using the changeset viewer.