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

ALSA: adapt to hotplug event

parent 51406fae
...@@ -740,11 +740,6 @@ static int EnumDevices(vlc_object_t *obj, char const *varname, ...@@ -740,11 +740,6 @@ static int EnumDevices(vlc_object_t *obj, char const *varname,
return n; return n;
} }
static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
{
return EnumDevices (VLC_OBJECT(aout), NULL, idp, namep);
}
static int DeviceSelect (audio_output_t *aout, const char *id) static int DeviceSelect (audio_output_t *aout, const char *id)
{ {
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
...@@ -775,9 +770,24 @@ static int Open(vlc_object_t *obj) ...@@ -775,9 +770,24 @@ static int Open(vlc_object_t *obj)
aout->start = Start; aout->start = Start;
aout->stop = Stop; aout->stop = Stop;
aout_SoftVolumeInit (aout); aout_SoftVolumeInit (aout);
aout->device_enum = DevicesEnum;
aout->device_select = DeviceSelect; aout->device_select = DeviceSelect;
aout_DeviceReport (aout, sys->device); aout_DeviceReport (aout, sys->device);
/* ALSA does not support hot-plug events so list devices at startup */
char **ids, **names;
int count = EnumDevices (VLC_OBJECT(aout), NULL, &ids, &names);
if (count >= 0)
{
for (int i = 0; i < count; i++)
{
aout_HotplugReport (aout, ids[i], names[i]);
free (names[i]);
free (ids[i]);
}
free (names);
free (ids);
}
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
free (sys); free (sys);
......
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