summaryrefslogtreecommitdiff
path: root/audio/mad123/patches/patch-ab
blob: d32eb100c6129c09ea9c8bed8e492751a2fa0f99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$NetBSD: patch-ab,v 1.4 2012/06/28 08:18:43 sbd Exp $

--- audio_dev.c.orig	2004-09-22 09:23:43.000000000 +0000
+++ audio_dev.c
@@ -22,7 +22,11 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/fcntl.h>
+#ifndef __linux__
 #include <sys/filio.h>
+#else
+#include <stdint.h>
+#endif
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
@@ -35,6 +39,10 @@
 #include <unistd.h>
 #include <mad.h>
 
+#ifdef __sun
+#include <sys/stropts.h>
+#endif
+
 #include "audio_dev.h"
 
 #if (BYTE_ORDER == BIG_ENDIAN)
@@ -43,6 +51,10 @@
 #undef WORDS_BIGENDIAN
 #endif
 
+#ifdef __DragonFly__
+typedef unsigned int nfds_t;
+#endif
+
 #define PCM_BUFFSIZE	((sizeof(((struct mad_pcm *)0)->samples) / \
 			    sizeof(mad_fixed_t)) * 2)
 struct pcm_data {
@@ -58,7 +70,7 @@ struct pcm_data {
 #define PCM_LOW_WATER   32
 struct pcm_buffer {
 	volatile int	pb_command;
-	u_int64_t	pb_playsamples;
+	uint64_t	pb_playsamples;
 	int		pb_rate;
 	int		pb_nchannels;
 	volatile int	pb_purge;
@@ -74,7 +86,7 @@ struct audio_dev_ctx {
 	int		ac_paused;
 	int		ac_peerread;
 	int		ac_peerwrite;
-	u_int64_t	ac_buffersamples;
+	uint64_t	ac_buffersamples;
 	void		(*ac_readcallback)(void *);
 	void		*ac_cbarg;
 	struct pcm_buffer *ac_pcm;
@@ -97,8 +109,12 @@ static void	audio_convert_dither(unsigne
 
 
 static const struct audio_dev_backend *audio_dev_backends[] = {
+#ifndef NOSUN
 	&audio_dev_sun,
+#endif
+#ifndef NOOSS
 	&audio_dev_pcm,
+#endif
 #ifndef NOARTS
 	&audio_dev_arts,
 #endif
@@ -326,7 +342,7 @@ audio_dev_output(struct audio_dev_ctx *a
 	pd->pd_len = len;
 
 	written /= pd->pd_nchannels;
-	written /= sizeof(u_int16_t);
+	written /= sizeof(uint16_t);
 	ac->ac_pcm->pb_playsamples += written;
 
 	return ((rv >= 0) ? 0 : -1);