diff options
author | Chris Robinson <[email protected]> | 2012-02-29 22:31:51 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-02-29 22:31:51 -0800 |
commit | d34fc21a50f73288aadd51fb9730a95180f28bcf (patch) | |
tree | 4dd4c7f852a5bc93eea4f9a5bcf9dd1c99fb1a75 /Alc | |
parent | f5435aa2de17f9f5b2de9cda0efcf725905b40e6 (diff) |
Print the enumerated devices from PulseAudio
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/pulseaudio.c | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 39d64916..e7ff369a 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -524,10 +524,7 @@ static void sink_info_callback(pa_context *context, const pa_sink_info *info, in static void sink_device_callback(pa_context *context, const pa_sink_info *info, int eol, void *pdata) //{{{ { pa_threaded_mainloop *loop = pdata; - char str[1024]; void *temp; - int count; - ALuint i; (void)context; @@ -537,26 +534,13 @@ static void sink_device_callback(pa_context *context, const pa_sink_info *info, return; } - count = 0; - do { - if(count == 0) - snprintf(str, sizeof(str), "%s", info->description); - else - snprintf(str, sizeof(str), "%s #%d", info->description, count+1); - count++; - - for(i = 0;i < numDevNames;i++) - { - if(strcmp(str, allDevNameMap[i].name) == 0) - break; - } - } while(i != numDevNames); + TRACE("Got device \"%s\", \"%s\"\n", info->description, info->name); temp = realloc(allDevNameMap, (numDevNames+1) * sizeof(*allDevNameMap)); if(temp) { allDevNameMap = temp; - allDevNameMap[numDevNames].name = strdup(str); + allDevNameMap[numDevNames].name = strdup(info->description); allDevNameMap[numDevNames].device_name = strdup(info->name); numDevNames++; } @@ -565,10 +549,7 @@ static void sink_device_callback(pa_context *context, const pa_sink_info *info, static void source_device_callback(pa_context *context, const pa_source_info *info, int eol, void *pdata) //{{{ { pa_threaded_mainloop *loop = pdata; - char str[1024]; void *temp; - int count; - ALuint i; (void)context; @@ -578,26 +559,13 @@ static void source_device_callback(pa_context *context, const pa_source_info *in return; } - count = 0; - do { - if(count == 0) - snprintf(str, sizeof(str), "%s", info->description); - else - snprintf(str, sizeof(str), "%s #%d", info->description, count+1); - count++; - - for(i = 0;i < numCaptureDevNames;i++) - { - if(strcmp(str, allCaptureDevNameMap[i].name) == 0) - break; - } - } while(i != numCaptureDevNames); + TRACE("Got device \"%s\", \"%s\"\n", info->description, info->name); temp = realloc(allCaptureDevNameMap, (numCaptureDevNames+1) * sizeof(*allCaptureDevNameMap)); if(temp) { allCaptureDevNameMap = temp; - allCaptureDevNameMap[numCaptureDevNames].name = strdup(str); + allCaptureDevNameMap[numCaptureDevNames].name = strdup(info->description); allCaptureDevNameMap[numCaptureDevNames].device_name = strdup(info->name); numCaptureDevNames++; } |