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

ALSA: list default and configured device in choice list (fix #4995)

parent 55bfdd0c
...@@ -745,6 +745,7 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name, ...@@ -745,6 +745,7 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
static void GetDevices (vlc_object_t *obj, module_config_t *item) static void GetDevices (vlc_object_t *obj, module_config_t *item)
{ {
void **hints; void **hints;
bool hinted_default = false;
msg_Dbg(obj, "Available ALSA PCM devices:"); msg_Dbg(obj, "Available ALSA PCM devices:");
...@@ -771,6 +772,9 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item) ...@@ -771,6 +772,9 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item)
*lf = ' '; *lf = ' ';
msg_Dbg(obj, "%s (%s)", (desc != NULL) ? desc : name, name); msg_Dbg(obj, "%s (%s)", (desc != NULL) ? desc : name, name);
if (!strcmp (name, "default"))
hinted_default = true;
if (item != NULL) if (item != NULL)
{ {
item->ppsz_list = xrealloc(item->ppsz_list, item->ppsz_list = xrealloc(item->ppsz_list,
...@@ -803,4 +807,25 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item) ...@@ -803,4 +807,25 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item)
item->ppsz_list[item->i_list] = NULL; item->ppsz_list[item->i_list] = NULL;
item->ppsz_list_text[item->i_list] = NULL; item->ppsz_list_text[item->i_list] = NULL;
} }
else
{
vlc_value_t val, text;
if (!hinted_default)
{
val.psz_string = (char *)"default";
text.psz_string = (char *)N_("Default");
var_Change(obj, "audio-device", VLC_VAR_ADDCHOICE, &val, &text);
}
val.psz_string = var_InheritString (obj, "alsa-audio-device");
if (likely(val.psz_string != NULL)
&& strcmp (val.psz_string, "default"))
{
text.psz_string = (char *)N_("VLC preferences");
var_Change(obj, "audio-device", VLC_VAR_ADDCHOICE, &val, &text);
}
var_Change(obj, "audio-device", VLC_VAR_SETVALUE, &val, NULL);
free (val.psz_string);
}
} }
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