[vlc-commits] alsa: insert default choice if not in ALSA device hints
Rémi Denis-Courmont
git at videolan.org
Wed Oct 21 19:46:05 CEST 2015
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 21 20:30:49 2015 +0300| [e563b2afd5d8df191d4197a57a584e81e5654d01] | committer: Jean-Baptiste Kempf
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.
(cherry picked from commit 1d92fdf3e259b0f8d482b4a5534022cdc71fea16)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=e563b2afd5d8df191d4197a57a584e81e5654d01
---
modules/audio_output/alsa.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 7e71d3e..42c1d75 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -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;
More information about the vlc-commits
mailing list