summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-03-12 00:17:11 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-03-12 00:17:11 +0000
commit08765c20628cd7a38b53871390b91b16f30e8f9c (patch)
treef76a9747845e27243ccf118efba53026400f7ebf
parentfc0b8f3dcb51da6a0b1293c561cd46792c3047ad (diff)
downloadxine-lib-08765c20628cd7a38b53871390b91b16f30e8f9c.tar.gz
xine-lib-08765c20628cd7a38b53871390b91b16f30e8f9c.tar.bz2
Cope with NetBSD, which apparently doesn't have SNDCTL_DSP_GETODELAY.
(Fall back on SNDCTL_DSP_GETOPTR.)
-rw-r--r--src/audio_out/audio_oss_out.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index a6e0fe494..40d5bcfdc 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -405,6 +405,18 @@ static int ao_oss_delay(ao_driver_t *this_gen) {
if (bytes_left<=0) /* buffer ran dry */
bytes_left = 0;
break;
+ case OSS_SYNC_GETODELAY:
+#ifdef SNDCTL_DSP_GETODELAY
+ if (ioctl (this->audio_fd, SNDCTL_DSP_GETODELAY, &bytes_left)) {
+ perror ("audio_oss_out: DSP_GETODELAY ioctl():");
+ }
+ if (bytes_left<0)
+ bytes_left = 0;
+
+ lprintf ("%d bytes left\n", bytes_left);
+
+ break;
+#endif
case OSS_SYNC_GETOPTR:
if (ioctl (this->audio_fd, SNDCTL_DSP_GETOPTR, &info)) {
perror ("audio_oss_out: SNDCTL_DSP_GETOPTR failed:");
@@ -424,16 +436,6 @@ static int ao_oss_delay(ao_driver_t *this_gen) {
}
this->last_getoptr = info.bytes;
break;
- case OSS_SYNC_GETODELAY:
- if (ioctl (this->audio_fd, SNDCTL_DSP_GETODELAY, &bytes_left)) {
- perror ("audio_oss_out: DSP_GETODELAY ioctl():");
- }
- if (bytes_left<0)
- bytes_left = 0;
-
- lprintf ("%d bytes left\n", bytes_left);
-
- break;
}
return bytes_left / this->bytes_per_frame;
@@ -840,10 +842,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
* check if SNDCTL_DSP_GETODELAY works. if so, using it is preferred.
*/
+#ifdef SNDCTL_DSP_GETODELAY
if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) {
xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n");
this->sync_method = OSS_SYNC_GETODELAY;
- } else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) {
+ } else
+#endif
+ if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) {
xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n");
this->sync_method = OSS_SYNC_GETOPTR;
} else {