From e7c93ac6b71cdf1a373abd145d5b37c43c8d3587 Mon Sep 17 00:00:00 2001 From: jakemsr Date: Sat, 14 Jul 2007 09:21:15 +0000 Subject: [PATCH] - use AUDIO_WSEEK instead of AUDIO_GETINFO to get the number of bytes in the audio write buffer. noticibly more efficient. - allow the audio write buffer to be flushed. - if initializing the audio device with a sample rate of 44.1kHz fails, try initializing with a sample rate of 48kHz. some audio drivers only support 48kHz. from Alexey Suslikov - bump PKGNAME (goes with Makefile commit ... frickin cvs ...) --- .../patch-src_audio_out_audio_sun_out_c | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 multimedia/xine-lib/patches/patch-src_audio_out_audio_sun_out_c diff --git a/multimedia/xine-lib/patches/patch-src_audio_out_audio_sun_out_c b/multimedia/xine-lib/patches/patch-src_audio_out_audio_sun_out_c new file mode 100644 index 00000000000..f5267062851 --- /dev/null +++ b/multimedia/xine-lib/patches/patch-src_audio_out_audio_sun_out_c @@ -0,0 +1,60 @@ +$OpenBSD: patch-src_audio_out_audio_sun_out_c,v 1.5 2007/07/14 09:21:15 jakemsr Exp $ +--- src/audio_out/audio_sun_out.c.orig Fri Jul 13 23:42:54 2007 ++++ src/audio_out/audio_sun_out.c Fri Jul 13 23:42:54 2007 +@@ -584,9 +584,9 @@ static int ao_sun_bytes_per_frame(ao_driver_t *this_ge + static int ao_sun_delay(ao_driver_t *this_gen) + { + sun_driver_t *this = (sun_driver_t *) this_gen; ++#ifdef __svr4__ + audio_info_t info; + +-#ifdef __svr4__ + if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0 && + (this->frames_in_buffer == 0 || info.play.samples > 0)) { + +@@ -634,8 +634,9 @@ static int ao_sun_delay(ao_driver_t *this_gen) + #endif + } + #else +- if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0) +- return info.play.seek / this->bytes_per_frame; ++ u_long bytes; ++ if (ioctl(this->audio_fd, AUDIO_WSEEK, &bytes) == 0) ++ return bytes / this->bytes_per_frame; + #endif + return NOT_REAL_TIME; + } +@@ -890,8 +891,7 @@ static int ao_sun_ctrl(ao_driver_t *this_gen, int cmd, + + this->frames_in_buffer = 0; + this->last_samplecnt = 0; +-#endif +-#ifdef __NetBSD__ ++#else + ioctl(this->audio_fd, AUDIO_FLUSH); + #endif + break; +@@ -966,11 +966,20 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_c + status = ioctl(this->audio_fd, AUDIO_SETINFO, &info); + + if (status < 0) { +- xprintf(this->xine, XINE_VERBOSITY_LOG, ++ /* some devices are 48kHz only */ ++ AUDIO_INITINFO(&info); ++ info.play.encoding = AUDIO_ENCODING_LINEAR; ++ info.play.precision = AUDIO_PRECISION_16; ++ info.play.sample_rate = 48000; ++ status = ioctl(this->audio_fd, AUDIO_SETINFO, &info); ++ ++ if (status < 0) { ++ xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_sun_out: audio ioctl on device %s failed: %s\n"), devname, strerror(errno)); + +- free (this); +- return NULL; ++ free (this); ++ return NULL; ++ } + } + + /*