Add gstsink to devicefinder

This commit is contained in:
Jonas Kvinge
2018-06-17 15:07:11 +02:00
parent 416beb6b8e
commit 008c39cd00
6 changed files with 12 additions and 11 deletions

View File

@@ -35,7 +35,7 @@
#include "alsadevicefinder.h"
AlsaDeviceFinder::AlsaDeviceFinder()
: DeviceFinder("alsa") {
: DeviceFinder("alsa", "alsasink") {
}
@@ -59,18 +59,20 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
if (card < 0) break;
char str[32];
snprintf(str, sizeof(str) - 1, "hw:%d", card);
snd_ctl_t* handle;
snprintf(str, 31, "hw:%d", card);
result = snd_ctl_open(&handle, str, 0);
if (result < 0) {
qLog(Error) << "Unable to open soundcard" << card << ":" << snd_strerror(result);
continue;
}
BOOST_SCOPE_EXIT(&handle) { snd_ctl_close(handle); }
BOOST_SCOPE_EXIT_END
result = snd_ctl_card_info(handle, cardinfo);
if (result < 0) {
qLog(Error) << "Control hardware failure for card" << card << ":" << snd_strerror(result);
BOOST_SCOPE_EXIT(&handle) { snd_ctl_close(handle); }
BOOST_SCOPE_EXIT_END
continue;
}
@@ -103,8 +105,6 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
ret.append(device);
}
BOOST_SCOPE_EXIT(&handle) { snd_ctl_close(handle); }
BOOST_SCOPE_EXIT_END
}
snd_config_update_free_global();