]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/oss.c
skins2: improve fullscreen behaviour
[vlc] / modules / audio_output / oss.c
index 60e594c4149033d1c26f36aebf2a364a873d23f2..8dc4a4a75d9854f0769925965df48a52d4b2257e 100644 (file)
@@ -111,24 +111,16 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     switch (fmt->i_format)
     {
 #ifdef AFMT_FLOAT
-        case VLC_CODEC_F64B:
-        case VLC_CODEC_F64L:
-        case VLC_CODEC_F32B:
-        case VLC_CODEC_F32L:
+        case VLC_CODEC_FL64:
+        case VLC_CODEC_FL32:
             format = AFMT_FLOAT;
             break;
 #endif
-        case VLC_CODEC_S32B:
-            format = AFMT_S32_BE;
+        case VLC_CODEC_S32N:
+            format = AFMT_S32_NE;
             break;
-        case VLC_CODEC_S32L:
-            format = AFMT_S32_LE;
-            break;
-        case VLC_CODEC_S16B:
-            format = AFMT_S16_BE;
-            break;
-        case VLC_CODEC_S16L:
-            format = AFMT_S16_LE;
+        case VLC_CODEC_S16N:
+            format = AFMT_S16_NE;
             break;
         case VLC_CODEC_U8:
             format = AFMT_U8;
@@ -155,12 +147,8 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     switch (format)
     {
         case AFMT_U8:     fmt->i_format = VLC_CODEC_U8;   break;
-        case AFMT_S16_BE: fmt->i_format = VLC_CODEC_S16B; break;
-        case AFMT_S16_LE: fmt->i_format = VLC_CODEC_S16L; break;
-        //case AFMT_S24_BE:
-        //case AFMT_S24_LE:
-        case AFMT_S32_BE: fmt->i_format = VLC_CODEC_S32B; break;
-        case AFMT_S32_LE: fmt->i_format = VLC_CODEC_S32L; break;
+        case AFMT_S16_NE: fmt->i_format = VLC_CODEC_S16N; break;
+        case AFMT_S32_NE: fmt->i_format = VLC_CODEC_S32N; break;
 #ifdef AFMT_FLOAT
         case AFMT_FLOAT:  fmt->i_format = VLC_CODEC_FL32; break;
 #endif
@@ -368,27 +356,24 @@ static int MuteSet (audio_output_t *aout, bool mute)
     return 0;
 }
 
-static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
+static int DevicesEnum (audio_output_t *aout)
 {
-    aout_sys_t *sys = sys;
-    int fd = sys->fd;
-    oss_sysinfo si;
-
+    int fd = vlc_open ("/dev/dsp", O_WRONLY);
     if (fd == -1)
         return -1;
+
+    oss_sysinfo si;
+    int n = -1;
+
     if (ioctl (fd, SNDCTL_SYSINFO, &si) < 0)
     {
         msg_Err (aout, "cannot get system infos: %m");
-        return -1;
+        goto out;
     }
 
     msg_Dbg (aout, "using %s version %s (0x%06X) under %s", si.product,
              si.version, si.versionnum, si.license);
 
-    char **ids = xmalloc (sizeof (*ids) * si.numaudios);
-    char **names = xmalloc (sizeof (*names) * si.numaudios);
-    int n = 0;
-
     for (int i = 0; i < si.numaudios; i++)
     {
         oss_audioinfo ai = { .dev = i };
@@ -405,12 +390,11 @@ static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
         if (!ai.enabled)
             continue;
 
-        ids[n] = xstrdup (ai.devnode);
-        names[n] = xstrdup (ai.name);
+        aout_HotplugReport (aout, ai.devnode, ai.name);
         n++;
     }
-    *idp = ids;
-    *namep = names;
+out:
+    close (fd);
     return n;
 }
 
@@ -452,8 +436,9 @@ static int Open (vlc_object_t *obj)
     aout->stop = Stop;
     aout->volume_set = VolumeSet;
     aout->mute_set = MuteSet;
-    aout->device_enum = DevicesEnum;
     aout->device_select = DeviceSelect;
+
+    DevicesEnum (aout);
     return VLC_SUCCESS;
 }