Commit 83760570 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'b7c77912'

* commit 'b7c77912':
  oss_audio: use a macro to simplify ioctl() error checking

Conflicts:
	libavdevice/oss_audio.c

See: 69c7aad4Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 85cf049d b7c77912
...@@ -49,6 +49,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output, ...@@ -49,6 +49,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
int audio_fd; int audio_fd;
int tmp, err; int tmp, err;
char *flip = getenv("AUDIO_FLIP_LEFT"); char *flip = getenv("AUDIO_FLIP_LEFT");
char errbuff[128];
if (is_output) if (is_output)
audio_fd = avpriv_open(audio_device, O_WRONLY); audio_fd = avpriv_open(audio_device, O_WRONLY);
...@@ -74,14 +75,15 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output, ...@@ -74,14 +75,15 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
#define CHECK_IOCTL_ERROR(event) \ #define CHECK_IOCTL_ERROR(event) \
if (err < 0) { \ if (err < 0) { \
av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno)); \ av_strerror(AVERROR(errno), errbuff, sizeof(errbuff)); \
av_log(s1, AV_LOG_ERROR, #event ": %s\n", errbuff); \
goto fail; \ goto fail; \
} }
/* select format : favour native format /* select format : favour native format
* We don't CHECK_IOCTL_ERROR here because even if failed OSS still may be * We don't CHECK_IOCTL_ERROR here because even if failed OSS still may be
* usable. If OSS is not usable the SNDCTL_DSP_SETFMTS later is going to * usable. If OSS is not usable the SNDCTL_DSP_SETFMTS later is going to
* fail anyway. `err =` kept to eliminate compiler warning. */ * fail anyway. */
err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp); err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
if (err < 0) { if (err < 0) {
av_log(s1, AV_LOG_WARNING, "SNDCTL_DSP_GETFMTS: %s\n", strerror(errno)); av_log(s1, AV_LOG_WARNING, "SNDCTL_DSP_GETFMTS: %s\n", strerror(errno));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment