]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/alsa-audio-common.c
Add missing overflow checks in av_image_fill_pointers() and
[ffmpeg] / libavdevice / alsa-audio-common.c
index 98127249a68bf5b4c16d70ea77cac711cd32536d..38cb0de0eff1bb17ce6f0daca1de2292811ab5a0 100644 (file)
  */
 
 /**
- * @file libavdevice/alsa-audio-common.c
+ * @file
  * ALSA input and output: common code
  * @author Luca Abeni ( lucabe72 email it )
  * @author Benoit Fouet ( benoit fouet free fr )
  * @author Nicolas George ( nicolas george normalesup org )
  */
 
-#include "libavformat/avformat.h"
 #include <alsa/asoundlib.h>
+#include "libavformat/avformat.h"
 
 #include "alsa-audio.h"
 
@@ -43,9 +43,9 @@ static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id)
     }
 }
 
-av_cold int ff_alsa_open(AVFormatContext *ctx, int mode,
+av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
                          unsigned int *sample_rate,
-                         int channels, int *codec_id)
+                         int channels, enum CodecID *codec_id)
 {
     AlsaData *s = ctx->priv_data;
     const char *audio_device;
@@ -74,7 +74,7 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, int mode,
     if (res < 0) {
         av_log(ctx, AV_LOG_ERROR, "cannot open audio device %s (%s)\n",
                audio_device, snd_strerror(res));
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
 
     res = snd_pcm_hw_params_malloc(&hw_params);
@@ -153,7 +153,7 @@ fail:
     snd_pcm_hw_params_free(hw_params);
 fail1:
     snd_pcm_close(h);
-    return AVERROR_IO;
+    return AVERROR(EIO);
 }
 
 av_cold int ff_alsa_close(AVFormatContext *s1)
@@ -175,7 +175,7 @@ int ff_alsa_xrun_recover(AVFormatContext *s1, int err)
         if (err < 0) {
             av_log(s1, AV_LOG_ERROR, "cannot recover from underrun (snd_pcm_prepare failed: %s)\n", snd_strerror(err));
 
-            return AVERROR_IO;
+            return AVERROR(EIO);
         }
     } else if (err == -ESTRPIPE) {
         av_log(s1, AV_LOG_ERROR, "-ESTRPIPE... Unsupported!\n");