summaryrefslogtreecommitdiff
path: root/audio/xmms-fmradio/patches/patch-ab
blob: 413e70ea57f90d3bfcb94616ca310d44555b159c (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
$NetBSD: patch-ab,v 1.1.1.1 2002/01/06 06:50:35 jmcneill Exp $

--- radio.c.orig	Sun Jan  6 02:28:50 2002
+++ radio.c	Sun Jan  6 02:34:04 2002
@@ -25,9 +25,9 @@
 #include "radio.h"
 
 #include <errno.h>
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 #include <err.h>
-#endif /* __OpenBSD__ */
+#endif /* __OpenBSD__ || __NetBSD__ */
 
 static void radio_init(void);
 static int is_our_file(char *filename);
@@ -72,10 +72,10 @@
 
 gint radio_fd = -1;
 gint freq,volume;
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 struct radio_info ri;
 static mixer_ctrl_t volctl;
-#endif /* __OpenBSD__ */
+#endif /* __OpenBSD__ || defined(__NetBSD__) */
 gboolean is_paused,tuned;
 
 
@@ -110,16 +110,16 @@
   if (!radio_cfg.device)
 #ifdef linux
     radio_cfg.device = g_strdup("/dev/radio0");
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
     radio_cfg.device = g_strdup("/dev/radio");
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
   if (!radio_cfg.directory)
     radio_cfg.directory = g_strdup(g_get_home_dir());
   
   volume=FMR_VOL_DEFAULT;
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
   SetGetRadioInfo(GET_INFO);
-#endif /* __OpenBSD__ */
+#endif /* __OpenBSD__ || defined(__NetBSD__) */
 }
 
 static int is_our_file(char *filename)
@@ -161,7 +161,7 @@
     return .016;
   return 16;
 }
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
 int
 SetGetRadioInfo(int setinfo) {
 	int rd;
@@ -182,7 +182,7 @@
 
 	return 0;
 }
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
 
 
 static void play_file(char *filename)
@@ -268,7 +268,7 @@
       return ;
     }
     tuned = ((v.signal != 0) ? TRUE : FALSE);
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
     ri.freq = (unsigned long)freq;
     ri.mute = 0;
     ri.volume = volume * (255/(FMR_VOL_MAX - FMR_VOL_MIN));
@@ -276,7 +276,7 @@
     usleep(50000);
     SetGetRadioInfo(GET_INFO);
     tuned = ri.info ? TRUE : FALSE;
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
     
     if (radioname==NULL)
       tmp = g_strdup_printf("FM Radio %6.2fMHz", (float)freq/1000.0);
@@ -316,7 +316,7 @@
       return ;
     }
     tuned = ((v.signal != 0) ? TRUE : FALSE);
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
     ri.freq = (unsigned long)freq;
     ri.mute = 0;
     ri.volume = volume * (255/(FMR_VOL_MAX - FMR_VOL_MIN));
@@ -324,7 +324,7 @@
     usleep(50000);
     SetGetRadioInfo(GET_INFO);
     tuned = ri.info ? TRUE : FALSE;
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
 
     if (radioname==NULL)
       tmp = g_strdup_printf("FM Radio (undefined)");
@@ -350,10 +350,10 @@
   ioctl (radio_fd, VIDIOCSAUDIO, &va);
   close(radio_fd);
   radio_fd = -1;
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
   ri.mute = 1;
   SetGetRadioInfo(SET_INFO);
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
 }
 
 static void radio_pause(short p)
@@ -380,7 +380,7 @@
   is_paused = (p ? TRUE : FALSE);
   close(radio_fd);
   radio_fd = -2;
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
   if (p) {
 	  ri.mute = 1;
 	  is_paused = TRUE;
@@ -389,7 +389,7 @@
 	  is_paused = FALSE;
   }
   SetGetRadioInfo(SET_INFO);
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
 }
 
 static void get_song_info(char *filename, char **title, int *len)
@@ -453,9 +453,9 @@
 
 static void get_volume(int *l, int *r)
 {
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 	mixer_devinfo_t devinfo;
-#endif /* __OpenBSD__ */
+#endif /* __OpenBSD__ || __NetBSD__ */
   int fd, devs, cmd, v;
 
 #if defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H)
@@ -490,7 +490,7 @@
 	} else {
 	  printf( "Cannot open /dev/mixer %ld\n", errno );
 	}
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
 	cmd = 1;
 	fd = open("/dev/mixer", O_RDWR);
 	if (fd < 0) {
@@ -537,7 +537,7 @@
 
 	if (close(fd) < 0)
 		warn("/dev/mixer close error");
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || defined(__NetBSD__) */
     }
   else
 #endif
@@ -555,9 +555,9 @@
 {
 #ifdef linux
   struct video_audio va;
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
   mixer_devinfo_t devinfo;
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || defined(__NetBSD__) */
   int fd, devs, cmd, v;
   
 #if defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H)
@@ -590,7 +590,7 @@
 	} else {
 	  printf( "Cannot open /dev/mixer %ld\n", errno );
 	}
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
 	cmd = 1;
 	fd = open("/dev/mixer", O_RDWR);
 	if (fd < 0) {
@@ -639,7 +639,7 @@
 
 	if (close(fd) < 0)
 		warn("/dev/mixer close error");
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
     }
   else
 #endif
@@ -676,11 +676,11 @@
       }
       close(radio_fd);
       radio_fd = -2;
-#elif defined __OpenBSD__
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
     ri.volume = volume * (255 / (FMR_VOL_MAX - FMR_VOL_MIN));
     ri.mute = is_paused ? 1 : 0;
     SetGetRadioInfo(SET_INFO);
-#endif /* linux || __OpenBSD__ */
+#endif /* linux || __OpenBSD__ || __NetBSD__ */
     }
 }