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

Changeset ec81221 in mainline


Ignore:
Timestamp:
2013-03-24T14:09:11Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
2ba4d45
Parents:
7294b5b
Message:

libhound: Handle default target

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wavplay/main.c

    r7294b5b rec81221  
    8181        }
    8282
    83         ret = hound_context_connect_target(hound, "default");
     83        ret = hound_context_connect_target(hound, HOUND_DEFAULT_TARGET);
    8484        if (ret != EOK) {
    8585                printf("Failed to connect to default target: %s\n",
  • uspace/lib/hound/include/hound/client.h

    r7294b5b rec81221  
    4141#include <pcm/format.h>
    4242
    43 #define DEFAULT_SINK "default"
    44 #define DEFAULT_SOURCE "default"
     43#define HOUND_DEFAULT_TARGET "default"
     44#define HOUND_ALL_TARGETS "all"
     45#define DEFAULT_SINK "default" //DEPRECATED
    4546
    4647typedef struct hound_context hound_context_t;
  • uspace/lib/hound/src/client.c

    r7294b5b rec81221  
    160160{
    161161        assert(hound);
    162         if (hound->record)
    163                 return hound_service_connect_source_sink(
     162        assert(target);
     163
     164        const char **tgt = NULL;
     165        size_t count = 1;
     166        int ret = EOK;
     167        if (str_cmp(target, HOUND_DEFAULT_TARGET) == 0) {
     168                ret = hound_context_get_available_targets(hound, &tgt, &count);
     169                if (ret != EOK)
     170                        return ret;
     171                target = tgt[0];
     172        }
     173        //TODO handle all-targets
     174
     175        if (hound->record) {
     176                ret = hound_service_connect_source_sink(
    164177                    hound->session, target, hound->name);
    165         else
    166                 return hound_service_connect_source_sink(
     178        } else {
     179                ret = hound_service_connect_source_sink(
    167180                    hound->session, hound->name, target);
     181        }
     182        if (tgt)
     183                free(tgt[0]);
     184        free(tgt);
     185        return ret;
    168186}
    169187
     
    171189{
    172190        assert(hound);
    173         if (hound->record)
     191        assert(target);
     192        if (hound->record) {
    174193                return hound_service_disconnect_source_sink(
    175194                    hound->session, target, hound->name);
    176         else
     195        } else {
    177196                return hound_service_disconnect_source_sink(
    178197                    hound->session, hound->name, target);
     198        }
    179199}
    180200
Note: See TracChangeset for help on using the changeset viewer.