Commit 1d92fdf3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

alsa: insert default choice if not in ALSA device hints

This ensures that the default value ("default") for alsa-audio-device
is listed as a possible choice.
parent 509f755a
......@@ -709,6 +709,7 @@ static int EnumDevices(vlc_object_t *obj, char const *varname,
char **ids = NULL, **names = NULL;
unsigned n = 0;
bool hinted_default = false;
for (size_t i = 0; hints[i] != NULL; i++)
{
......@@ -729,9 +730,22 @@ static int EnumDevices(vlc_object_t *obj, char const *varname,
ids[n] = name;
names[n] = desc;
n++;
if (!strcmp(name, "default"))
hinted_default = true;
}
snd_device_name_free_hint(hints);
if (!hinted_default)
{
ids = xrealloc (ids, (n + 1) * sizeof (*ids));
names = xrealloc (names, (n + 1) * sizeof (*names));
ids[n] = xstrdup ("default");
names[n] = _("Default");
n++;
}
*idp = ids;
*namep = names;
(void) varname;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment