diff options
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/afmt.h | 4 | ||||
-rw-r--r-- | libao2/ao_oss.c | 2 | ||||
-rw-r--r-- | libao2/ao_sun.c | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/libao2/afmt.h b/libao2/afmt.h index 29f2de1912..1772606554 100644 --- a/libao2/afmt.h +++ b/libao2/afmt.h @@ -3,6 +3,10 @@ #ifdef HAVE_SYS_SOUNDCARD_H #include <sys/soundcard.h> /* For AFMT_* on linux */ +#else +#ifdef HAVE_SOUNDCARD_H +#include <soundcard.h> /* OpenBSD have this instead of <sys/soundcard> */ +#endif #endif /* standard, old OSS audio formats */ diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 17e6fc4fd5..c7233733a8 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -292,9 +292,11 @@ static int audio_delay_method=2; static float get_delay(){ /* Calculate how many bytes/second is sent out */ if(audio_delay_method==2){ +#ifdef SNDCTL_DSP_GETODELAY int r=0; if(ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &r)!=-1) return ((float)r)/(float)ao_data.bps; +#endif audio_delay_method=1; // fallback if not supported } if(audio_delay_method==1){ diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c index f4d94edb41..16dbf23865 100644 --- a/libao2/ao_sun.c +++ b/libao2/ao_sun.c @@ -440,9 +440,11 @@ static int get_space(){ } #endif +#ifndef __OpenBSD__ ioctl(audio_fd, AUDIO_GETINFO, &info); if (queued_bursts - info.play.eof > 2) return 0; +#endif return ao_data.outburst; } @@ -500,9 +502,13 @@ static int play(void* data,int len,int flags){ static float get_delay(){ audio_info_t info; ioctl(audio_fd, AUDIO_GETINFO, &info); +#ifdef __OpenBSD__ + return (float) info.play.seek/ (float)byte_per_sec ; +#else if (info.play.samples && enable_sample_timing == RTSC_ENABLED) return (float)(queued_samples - info.play.samples) / (float)byte_per_sec; else return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec; +#endif } |