]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/oss.c
auhal: prepare SPDIF transition from the packet API (refs #8083)
[vlc] / modules / audio_output / oss.c
index e3c77ef38503df153a59304cd6c1b0c47369f404..8a70eb310a19ee145db17f2a0b2ec799d74de838 100644 (file)
@@ -111,26 +111,17 @@ 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;
+        case VLC_CODEC_S16N:
+            format = AFMT_S16_NE;
             break;
-        case VLC_CODEC_S16B:
-            format = AFMT_S16_BE;
-            break;
-        case VLC_CODEC_S16L:
-            format = AFMT_S16_LE;
-            break;
-        case VLC_CODEC_S8:
         case VLC_CODEC_U8:
             format = AFMT_U8;
             break;
@@ -155,14 +146,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     switch (format)
     {
-        case AFMT_S8:     fmt->i_format = VLC_CODEC_S8;   break;
         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
@@ -223,7 +209,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
         fmt->i_physical_channels = channels;
     }
 
-    VolumeSync (aout):
+    VolumeSync (aout);
     sys->starting = true;
     sys->format = *fmt;
     return VLC_SUCCESS;
@@ -332,6 +318,8 @@ static int VolumeSet (audio_output_t *aout, float vol)
 {
     aout_sys_t *sys = aout->sys;
     int fd = sys->fd;
+    if (fd == -1)
+        return -1;
 
     int level = lroundf (vol * 100.f);
     if (level > 0xFF)
@@ -353,6 +341,8 @@ static int MuteSet (audio_output_t *aout, bool mute)
 {
     aout_sys_t *sys = aout->sys;
     int fd = sys->fd;
+    if (fd == -1)
+        return -1;
 
     int level = mute ? 0 : (sys->level | (sys->level << 8));
     if (ioctl (fd, SNDCTL_DSP_SETPLAYVOL, &level) < 0)
@@ -368,7 +358,7 @@ static int MuteSet (audio_output_t *aout, bool mute)
 
 static int DevicesEnum (audio_output_t *aout, char ***idp, char ***namep)
 {
-    aout_sys_t *sys = sys;
+    aout_sys_t *sys = aout->sys;
     int fd = sys->fd;
     oss_sysinfo si;