ao_alsa: always enable "plug" plugin for non-default device

This seems safer: otherwise, opening the AO could randomly fail if the
audio formats happens to be not float.

Unfortunately, this only works if the user does not select a device.
Since ALSA devices are arbitrary strings, including plugins with complex
parameters, it's not trivial or maybe even impossible to edit the string
in a way the "plug" plugin is added.

With --audio-device, it would be safe for users to select either
"default" or one of the "plughw" devices. Everything else seems
questionable.
This commit is contained in:
wm4 2014-11-25 18:15:45 +01:00
parent 5d5f5b094b
commit e1ae936e6b
1 changed files with 2 additions and 3 deletions

View File

@ -457,10 +457,9 @@ static int init(struct ao *ao)
ao->channels.num);
} else {
device = select_chmap(ao, &implied_chmap);
if (strcmp(device, "default") != 0 && (ao->format & AF_FORMAT_F)) {
// hack - use the converter plugin (why the heck?)
// Not-default likely means a hw device - enable software conversions.
if (strcmp(device, "default") != 0)
device = talloc_asprintf(ao, "plug:%s", device);
}
}
if (ao->device)
device = ao->device;