209 lines
5.4 KiB
Text
209 lines
5.4 KiB
Text
$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__ */
|
|
}
|
|
}
|
|
|