summaryrefslogtreecommitdiff
path: root/sysutils/xcdroast/patches/patch-ac
blob: b510dfde93ad22489970f262df0c428c26199132 (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
$NetBSD: patch-ac,v 1.6 2002/10/27 21:46:12 martin Exp $

--- io.c.orig	Tue Jul 17 12:39:11 2001
+++ io.c
@@ -16,6 +16,14 @@
 #include <sys/wait.h>
 #include <signal.h>
 #include <time.h>
+#ifdef __NetBSD__
+# include <sys/ioctl.h>
+# ifdef HAVE_OSS
+#  include <soundcard.h>
+# else
+#  include <sys/audioio.h>
+# endif
+#endif
 #if defined(linux) || defined(__FreeBSD__)
 # include <sys/soundcard.h>
 # include <sys/ioctl.h>
@@ -996,22 +1004,22 @@ GList *get_dsp_devices() {
 GList *dsp;
 GList *loop;
 struct stat buf;
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 gchar *audiodev;
 #endif
 	dsp = NULL;
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 	/* for linux check if /dev/dsp or /dev/dsp1 exist */
 
-	if (stat("/dev/dsp",&buf) == 0) {
-		dsp = g_list_append(dsp,"/dev/dsp");
+	if (stat("@DEVOSSAUDIO@",&buf) == 0) {
+		dsp = g_list_append(dsp,"@DEVOSSAUDIO@");
 	}
 	if (stat("/dev/dsp1",&buf) == 0) {
 		dsp = g_list_append(dsp,"/dev/dsp1");
 	}
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 	/* check if the user has any special audio-hardware running,
 	   which set the AUDIODEV-environment-variable */
 	audiodev = getenv("AUDIODEV");
@@ -1066,15 +1074,15 @@ gchar *audiodev;
 gchar *gen_mix_from_dspdev(gchar *dsp, gchar *ret) {
 gchar tmp[MAXLINE];
 struct stat buf;
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 gchar tmp2[MAXLINE];
 #endif
 
 	strcpy(ret,"");
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
-	if (strncmp(dsp,"/dev/dsp",8) == 0) {
+	if (strncmp(dsp,"@DEVOSSAUDIO@",8) == 0) {
 		strcpy(tmp,dsp+8);
 		g_snprintf(tmp2,MAXLINE,"/dev/mixer%s",tmp);
 
@@ -1084,7 +1092,7 @@ gchar tmp2[MAXLINE];
 		}	
 	}	
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	g_snprintf(tmp,MAXLINE,"%s%s",dsp,"ctl");
 
@@ -2362,10 +2370,10 @@ gint count;
 
 gint query_mixer() {
 gint mix;
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 gint val;
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2380,7 +2388,7 @@ struct audio_gains again;
 		return -1;
 	}
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
 	dodebug(10,"quering mixer %s\n", setupdata.mix_device);
 	mix = open(setupdata.mix_device, O_RDWR);
@@ -2400,7 +2408,7 @@ struct audio_gains again;
 	return ((val & 0x7f) + ((val >> 8) & 0x7f))/2;
 
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	dodebug(10,"quering mixer %s\n", setupdata.mix_device);
 	mix = open(setupdata.mix_device, O_RDONLY);
@@ -2450,7 +2458,7 @@ struct audio_gains again;
 
 gint set_mixer(gint val) {
 gint mix;
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2464,7 +2472,7 @@ struct audio_gains again;
 		return -1;
 	}
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
 	dodebug(10,"setting mixer %s to %d\n", setupdata.mix_device, val);
 	mix = open(setupdata.mix_device, O_RDWR);
@@ -2482,7 +2490,7 @@ struct audio_gains again;
 	close(mix);
 
 #endif 
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	dodebug(10,"setting mixer %s to %d\n", setupdata.mix_device, val);
 	mix = open(setupdata.mix_device, O_WRONLY);
@@ -3275,6 +3283,9 @@ gint ret,found;
 		/* got the message that no medium is present?
 		   in this case, ignore return code */ 
 		if (strstr(line,"medium not present")) {
+			found = 1;
+		}
+		if (strstr(line,"Device not ready")) {
 			found = 1;
 		}
 	}