[vlc-commits] OSS: use vlc_strerror_c()

Rémi Denis-Courmont git at videolan.org
Sun Dec 29 15:16:27 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 28 19:53:36 2013 +0200| [cfc2e7185e20e67bc257625bfc086b869ecbce0f] | committer: Rémi Denis-Courmont

OSS: use vlc_strerror_c()

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

 modules/access/oss.c       |   18 ++++++++++++------
 modules/audio_output/oss.c |   26 ++++++++++++++++----------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/modules/access/oss.c b/modules/access/oss.c
index 04d06d0..40e78c1 100644
--- a/modules/access/oss.c
+++ b/modules/access/oss.c
@@ -339,7 +339,8 @@ static int OpenAudioDevOss( demux_t *p_demux )
 
     if( i_fd < 0 )
     {
-        msg_Err( p_demux, "cannot open OSS audio device (%m)" );
+        msg_Err( p_demux, "cannot open OSS audio device (%s)",
+                 vlc_strerror_c(errno) );
         goto adev_fail;
     }
 
@@ -348,21 +349,24 @@ static int OpenAudioDevOss( demux_t *p_demux )
         || i_format != AFMT_S16_LE )
     {
         msg_Err( p_demux,
-                 "cannot set audio format (16b little endian) (%m)" );
+                 "cannot set audio format (16b little endian) (%s)",
+                 vlc_strerror_c(errno) );
         goto adev_fail;
     }
 
     if( ioctl( i_fd, SNDCTL_DSP_STEREO,
                &p_demux->p_sys->b_stereo ) < 0 )
     {
-        msg_Err( p_demux, "cannot set audio channels count (%m)" );
+        msg_Err( p_demux, "cannot set audio channels count (%s)",
+                 vlc_strerror_c(errno) );
         goto adev_fail;
     }
 
     if( ioctl( i_fd, SNDCTL_DSP_SPEED,
                &p_demux->p_sys->i_sample_rate ) < 0 )
     {
-        msg_Err( p_demux, "cannot set audio sample rate (%m)" );
+        msg_Err( p_demux, "cannot set audio sample rate (%s)",
+                 vlc_strerror_c(errno) );
         goto adev_fail;
     }
 
@@ -415,14 +419,16 @@ static bool ProbeAudioDevOss( demux_t *p_demux, const char *psz_device )
 
     if( i_fd < 0 )
     {
-        msg_Err( p_demux, "cannot open device %s for OSS audio (%m)", psz_device );
+        msg_Err( p_demux, "cannot open device %s for OSS audio (%s)",
+                 psz_device, vlc_strerror_c(errno) );
         goto open_failed;
     }
 
     /* this will fail if the device is video */
     if( ioctl( i_fd, SNDCTL_DSP_GETCAPS, &i_caps ) < 0 )
     {
-        msg_Err( p_demux, "cannot get audio caps (%m)" );
+        msg_Err( p_demux, "cannot get audio caps (%s)",
+                 vlc_strerror_c(errno) );
         goto open_failed;
     }
 
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 940718f..97d7c73 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -29,6 +29,7 @@
 
 #include <stdlib.h>
 #include <math.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
@@ -98,7 +99,8 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     int fd = vlc_open (device, O_WRONLY);
     if (fd == -1)
     {
-        msg_Err (aout, "cannot open OSS device %s: %m", device);
+        msg_Err (aout, "cannot open OSS device %s: %s", device,
+                 vlc_strerror_c(errno));
         return VLC_EGENERIC;
     }
     sys->fd = fd;
@@ -140,7 +142,8 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     if (ioctl (fd, SNDCTL_DSP_SETFMT, &format) < 0)
     {
-        msg_Err (aout, "cannot set audio format 0x%X: %m", format);
+        msg_Err (aout, "cannot set audio format 0x%X: %s", format,
+                 vlc_strerror_c(errno));
         goto error;
     }
 
@@ -167,7 +170,8 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     int channels = spdif ? 2 : aout_FormatNbChannels (fmt);
     if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) < 0)
     {
-        msg_Err (aout, "cannot set %d channels: %m", channels);
+        msg_Err (aout, "cannot set %d channels: %s", channels,
+                 vlc_strerror_c(errno));
         goto error;
     }
 
@@ -187,7 +191,8 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     int rate = spdif ? 48000 : fmt->i_rate;
     if (ioctl (fd, SNDCTL_DSP_SPEED, &rate) < 0)
     {
-        msg_Err (aout, "cannot set %d Hz sample rate: %m", rate);
+        msg_Err (aout, "cannot set %d Hz sample rate: %s", rate,
+                 vlc_strerror_c(errno));
         goto error;
     }
 
@@ -226,7 +231,7 @@ static int TimeGet (audio_output_t *aout, mtime_t *restrict pts)
 
     if (ioctl (sys->fd, SNDCTL_DSP_GETODELAY, &delay) < 0)
     {
-        msg_Warn (aout, "cannot get delay: %m");
+        msg_Warn (aout, "cannot get delay: %s", vlc_strerror_c(errno));
         return -1;
     }
 
@@ -252,7 +257,7 @@ static void Play (audio_output_t *aout, block_t *block)
             block->i_buffer -= bytes;
         }
         else
-            msg_Err (aout, "cannot write samples: %m");
+            msg_Err (aout, "cannot write samples: %s", vlc_strerror_c(errno));
     }
     block_Release (block);
 
@@ -329,7 +334,7 @@ static int VolumeSet (audio_output_t *aout, float vol)
         level |= level << 8;
     if (!sys->mute && ioctl (fd, SNDCTL_DSP_SETPLAYVOL, &level) < 0)
     {
-        msg_Err (aout, "cannot set volume: %m");
+        msg_Err (aout, "cannot set volume: %s", vlc_strerror_c(errno));
         return -1;
     }
 
@@ -348,7 +353,7 @@ static int MuteSet (audio_output_t *aout, bool mute)
     int level = mute ? 0 : (sys->level | (sys->level << 8));
     if (ioctl (fd, SNDCTL_DSP_SETPLAYVOL, &level) < 0)
     {
-        msg_Err (aout, "cannot mute: %m");
+        msg_Err (aout, "cannot mute: %s", vlc_strerror_c(errno));
         return -1;
     }
 
@@ -368,7 +373,7 @@ static int DevicesEnum (audio_output_t *aout)
 
     if (ioctl (fd, SNDCTL_SYSINFO, &si) < 0)
     {
-        msg_Err (aout, "cannot get system infos: %m");
+        msg_Err (aout, "cannot get system infos: %s", vlc_strerror(errno));
         goto out;
     }
 
@@ -381,7 +386,8 @@ static int DevicesEnum (audio_output_t *aout)
 
         if (ioctl (fd, SNDCTL_AUDIOINFO, &ai) < 0)
         {
-            msg_Warn (aout, "cannot get device %d infos: %m", i);
+            msg_Warn (aout, "cannot get device %d infos: %s", i,
+                      vlc_strerror_c(errno));
             continue;
         }
         if (ai.caps & (PCM_CAP_HIDDEN|PCM_CAP_MODEM))



More information about the vlc-commits mailing list