[vlc-commits] ALSA: adapt to hotplug event
Rémi Denis-Courmont
git at videolan.org
Sun Apr 14 10:51:34 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 14 11:23:03 2013 +0300| [10605093dca45603d25f1812fdf8416f82528eb1] | committer: Rémi Denis-Courmont
ALSA: adapt to hotplug event
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10605093dca45603d25f1812fdf8416f82528eb1
---
modules/audio_output/alsa.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 2ba9a36..fa7d70f 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -740,11 +740,6 @@ static int EnumDevices(vlc_object_t *obj, char const *varname,
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)
{
aout_sys_t *sys = aout->sys;
@@ -775,9 +770,24 @@ static int Open(vlc_object_t *obj)
aout->start = Start;
aout->stop = Stop;
aout_SoftVolumeInit (aout);
- aout->device_enum = DevicesEnum;
aout->device_select = DeviceSelect;
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;
error:
free (sys);
More information about the vlc-commits
mailing list