$NetBSD: patch-ac,v 1.2 2004/03/11 17:26:02 jmmv Exp $ --- src/audio_out/audio_sun_out.c.orig 2003-12-14 23:13:22.000000000 +0100 +++ src/audio_out/audio_sun_out.c @@ -41,6 +41,11 @@ #ifdef __svr4__ #include #endif +#include + +#if (defined(BSD) && BSD >= 199306) +typedef unsigned uint_t; +#endif #include "xine_internal.h" #include "xineutils.h" @@ -89,7 +94,9 @@ typedef struct sun_driver_s { uint32_t num_channels; int bytes_per_frame; +#ifndef __NetBSD__ uint32_t frames_in_buffer; /* number of frames writen to audio hardware */ +#endif enum { RTSC_UNKNOWN = 0, @@ -113,12 +120,14 @@ typedef struct sun_driver_s { unsigned buf_len; #endif +#ifndef __NetBSD__ #if SW_SAMPLE_COUNT struct timeval tv0; uint_t sample0; #endif uint_t last_samplecnt; +#endif } sun_driver_t; @@ -128,6 +137,7 @@ typedef struct sun_driver_s { */ static int realtime_samplecounter_available(xine_t *xine, char *dev) { +#ifndef __NetBSD__ int fd = -1; audio_info_t info; int rtsc_ok = RTSC_DISABLED; @@ -246,6 +256,9 @@ error: } return rtsc_ok; +#else + return RTSC_ENABLED; +#endif } @@ -429,7 +442,9 @@ static int ao_sun_open(ao_driver_t *this this->mode = mode; this->input_sample_rate = rate; +#ifndef __NetBSD__ this->frames_in_buffer = 0; +#endif /* * open audio device @@ -461,6 +476,9 @@ static int ao_sun_open(ao_driver_t *this info.play.sample_rate = this->input_sample_rate; info.play.eof = 0; info.play.samples = 0; +#ifdef __NetBSD__ + info.blocksize = 1024; +#endif this->convert_u8_s8 = 0; @@ -522,7 +540,9 @@ static int ao_sun_open(ao_driver_t *this return 0; } +#ifndef __NetBSD__ this->last_samplecnt = 0; +#endif this->output_sample_rate = info.play.sample_rate; this->num_channels = info.play.channels; @@ -563,6 +583,7 @@ static int ao_sun_delay(ao_driver_t *thi sun_driver_t *this = (sun_driver_t *) this_gen; audio_info_t info; +#ifndef __NetBSD__ if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0 && (this->frames_in_buffer == 0 || info.play.samples > 0)) { @@ -609,6 +630,10 @@ static int ao_sun_delay(ao_driver_t *thi } #endif } +#else + if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0) + return info.play.seek / this->bytes_per_frame; +#endif return NOT_REAL_TIME; } @@ -717,7 +742,9 @@ static int ao_sun_write(ao_driver_t *thi if (num_written > 0) { int buffered_samples; +#ifndef __NetBSD__ this->frames_in_buffer += num_written / this->bytes_per_frame; +#endif /* * Avoid storing too much data in the sound driver's buffers.