diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-29 20:42:15 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-29 20:42:15 +0000 |
commit | 97506370eb3ec3381e55c87c4540d50e33dad483 (patch) | |
tree | fbc2ca06d0db1d059349a56378d31a21612b18a3 /libao2 | |
parent | 4298359af281fd4e5708ee8dc577f61c592aafb7 (diff) | |
download | mpv-97506370eb3ec3381e55c87c4540d50e33dad483.tar.bz2 mpv-97506370eb3ec3381e55c87c4540d50e33dad483.tar.xz |
nonblock open is not legal for OSS (see OSS api docs), and causes problems on freebsd (and maybe other OSs)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5908 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_oss.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index c7233733a8..ca8cfe108e 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -103,17 +103,23 @@ static int init(int rate,int channels,int format,int flags){ if (verbose) printf("audio_setup: using '%s' dsp device\n", dsp); +#ifdef __linux__ audio_fd=open(dsp, O_WRONLY | O_NONBLOCK); +#else + audio_fd=open(dsp, O_WRONLY); +#endif if(audio_fd<0){ printf("Can't open audio device %s: %s -> no sound\n", dsp, strerror(errno)); return 0; } +#ifdef __linux__ /* Remove the non-blocking flag */ if(fcntl(audio_fd, F_SETFL, 0) < 0) { printf("Can't make filedescriptor non-blocking: %s -> no sound\n", strerror(errno)); return 0; } +#endif ao_data.bps=channels*rate; if(format != AFMT_U8 && format != AFMT_S8) @@ -217,8 +223,13 @@ static void uninit(){ // stop playing and empty buffers (for seeking/pause) static void reset(){ uninit(); +#ifdef __linux__ audio_fd=open(dsp, O_WRONLY | O_NONBLOCK); if(audio_fd < 0 || fcntl(audio_fd, F_SETFL, 0) < 0){ +#else + audio_fd=open(dsp, O_WRONLY); + if(audio_fd < 0){ +#endif printf("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno)); return; } |