[vlc-commits] OSS: open device node to list devices if required

Rémi Denis-Courmont git at videolan.org
Fri Apr 12 22:44:37 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 12 23:44:00 2013 +0300| [b0dcc696f713d4311b830c891b3ae6fec698ce02] | committer: Rémi Denis-Courmont

OSS: open device node to list devices if required

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0dcc696f713d4311b830c891b3ae6fec698ce02
---

 modules/audio_output/oss.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 8a70eb3..c737fe2 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -363,7 +363,12 @@ static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
     oss_sysinfo si;
 
     if (fd == -1)
-        return -1;
+    {
+        fd = vlc_open ("/dev/dsp", O_WRONLY);
+        if (fd == -1)
+            return -1;
+    }
+
     if (ioctl (fd, SNDCTL_SYSINFO, &si) < 0)
     {
         msg_Err (aout, "cannot get system infos: %m");
@@ -397,8 +402,12 @@ static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
         names[n] = xstrdup (ai.name);
         n++;
     }
+
     *idp = ids;
     *namep = names;
+    if (sys->fd == -1)
+        close (fd);
+
     return n;
 }
 



More information about the vlc-commits mailing list