aboutsummaryrefslogtreecommitdiff
path: root/audio/xcdplayer/files/patch-internals.c
blob: 618a26fc496c6112e4b8c5e3f7e54199976d18fa (plain) (blame)
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
--- internals.c.orig	Tue Jan 12 19:59:45 1993
+++ internals.c	Wed May 30 19:20:48 2007
@@ -22,6 +22,9 @@
 
 # include "debug.h"
 # include "cdrom_globs.h"
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+# include "cdrom_freebsd.h"
+#endif
 #ifdef sun
 # include "cdrom_sun.h"
 #endif
@@ -29,13 +32,14 @@
 # include "cdrom_sgi.h"
 #endif
 
-
+static void     scan_update();
 static XtIntervalId	ivid			= -1;
 static XtIntervalId	scanivid		= -1;
 static XtIntervalId	stativid		= -1;
 static unsigned int	timer_mod		= 1000 / TIMER_PERIOD;
 unsigned int		timer_fsecs;
 
+extern AppData app_data;
 
 int
 cdrom_get_curtime() {
@@ -46,7 +50,7 @@
 
 	if (cdrom_open() == -1) {
 		debug_printf(1, "cdrom_get_curtime: error from cdrom_open\n");
-		return;
+		return 0;
 	}
 
 	switch (cdrom_status()) {
@@ -54,7 +58,7 @@
 	case CDROM_PLAYING:
 	    if (cdrom_get_curmsf(&curmsf) == -1) {
 		debug_printf(1, "get_curtime: error reading location\n");
-		return;
+		return 0;
 	    }
 
 	    if (((curtrack = cdrom_get_curtrack()) == -1) ||
@@ -76,6 +80,7 @@
 	}
 }
 
+static void	update_track();
 
 /*
  * we poll the cd-rom drive every TIMER_PERIOD milliseconds to see where 
@@ -83,7 +88,6 @@
  */
 void
 cdrom_timer_on() {
-	static void	update_track();
 
 	if (cdi.state & CDROM_STATE_PLAY)
 		ivid = XtAppAddTimeOut(appc, TIMER_PERIOD, update_track, NULL);
@@ -170,7 +174,6 @@
 	struct msf	track_start;
         struct msf	start_addr, end_addr;
 	int		curtrack;
-	extern void 	scan_update();
 
 	if (cdrom_get_curmsf(&start_addr) == -1) {
 		debug_printf(1, "rew: error reading location\n");
@@ -196,11 +199,11 @@
 	    if (((cdi.state & CDROM_STATE_PLAY) && 
 		 ((track_start.minute * 60) + track_start.second) >=
 		 ((start_addr.minute * 60) + start_addr.second - 
-		  scanSkipInterval)) ||
+		  app_data.scanSkipInterval)) ||
 		((cdi.state & CDROM_STATE_PAUSE) &&
 		 ((track_start.minute * 60) + track_start.second) >=
 		 ((start_addr.minute * 60) + start_addr.second -
-		  pauseSkipInterval)))
+		  app_data.pauseSkipInterval)))
 	    {
 	        start_addr = track_start;
 	        start_addr.second++; /* guarantee we never back up too far */
@@ -208,9 +211,9 @@
 	    else
 	    {
 		if (cdi.state & CDROM_STATE_PAUSE) {
-			start_addr.second -= pauseSkipInterval; 
+			start_addr.second -= app_data.pauseSkipInterval; 
 		} else if (cdi.state & CDROM_STATE_PLAY) {
-			start_addr.second -= scanSkipInterval; 
+			start_addr.second -= app_data.scanSkipInterval; 
 		}
 	        if ((char) start_addr.second < 0)
 	        {
@@ -223,9 +226,9 @@
 	else /* normal case */
 	{
 		if (cdi.state & CDROM_STATE_PAUSE) {
-			start_addr.second -= pauseSkipInterval; 
+			start_addr.second -= app_data.pauseSkipInterval; 
 		} else if (cdi.state & CDROM_STATE_PLAY) {
-			start_addr.second -= scanSkipInterval; 
+			start_addr.second -= app_data.scanSkipInterval; 
 		}
 		if ((char) start_addr.second < 0)
 		{
@@ -274,7 +277,7 @@
 	{
 	    if (scanivid == -1)
 		scanivid = XtAppAddTimeOut(appc, 
-			(int)(pausePauseInterval * 1000.0), 
+			(int)(app_data.pausePauseInterval * 1000.0), 
 			scan_update, NULL);
 
 	    cdi.state &= ~CDROM_STATE_PAUSE;	/* allow timer to change */
@@ -304,7 +307,6 @@
         struct msf	start_addr, end_addr,  next_start;
 	char		t;
 	int		curtrack;
-	extern void 	scan_update();
 
 	if (cdrom_get_curmsf(&start_addr) == -1) {
 		debug_printf(1, "ff: error reading location\n");
@@ -332,11 +334,11 @@
 	    if (((cdi.state & CDROM_STATE_PLAY) && 
 		 ((next_start.minute * 60) + next_start.second) <=
 		 ((start_addr.minute * 60) + start_addr.second +
-		  scanSkipInterval)) ||
+		  app_data.scanSkipInterval)) ||
 		((cdi.state & CDROM_STATE_PAUSE) &&
 		 ((next_start.minute * 60) + next_start.second) <=
 		 ((start_addr.minute * 60) + start_addr.second +
-		  pauseSkipInterval)))
+		  app_data.pauseSkipInterval)))
 	    {
 	    
 	        /* start at end of current track */
@@ -346,9 +348,9 @@
 	    else
 	    {
 		    if (cdi.state & CDROM_STATE_PAUSE) {
-			    start_addr.second += pauseSkipInterval; 
+			    start_addr.second += app_data.pauseSkipInterval; 
 		    } else if (cdi.state & CDROM_STATE_PLAY) {
-			    start_addr.second += scanSkipInterval; 
+			    start_addr.second += app_data.scanSkipInterval; 
 		    }
 		    if (start_addr.second >= 60)
 		    {
@@ -360,9 +362,9 @@
 	else
 	{
 	    if (cdi.state & CDROM_STATE_PAUSE) {
-		start_addr.second += pauseSkipInterval; 
+		start_addr.second += app_data.pauseSkipInterval; 
 	    } else if (cdi.state & CDROM_STATE_PLAY) {
-		start_addr.second += scanSkipInterval; 
+		start_addr.second += app_data.scanSkipInterval; 
 	    }
 	    if (start_addr.second >= 60)
 	    {
@@ -413,7 +415,7 @@
 	{
 	    if (scanivid == -1)
 		scanivid = XtAppAddTimeOut(appc, 
-			(int)(pausePauseInterval * 1000.0), 
+			(int)(app_data.pausePauseInterval * 1000.0), 
 			scan_update, NULL);
 
 	    cdi.state &= ~CDROM_STATE_PAUSE;	/* allow timer to change */
@@ -557,7 +559,7 @@
 				 cdi.state &= ~CDROM_STATE_STOP;
 		}
 	        ivid = XtAppAddTimeOut(appc, 
-			(int)(scanPauseInterval * 1000.0), 
+			(int)(app_data.scanPauseInterval * 1000.0), 
 			scan_update, NULL);
 	}
 	else
@@ -574,7 +576,7 @@
 			}
 
 			ivid = XtAppAddTimeOut(appc,
-				(int)(scanPauseInterval * 1000.0),
+				(int)(app_data.scanPauseInterval * 1000.0),
 				scan_update, NULL);
 		}
 		else if (scanivid != -1) {
@@ -662,7 +664,7 @@
 				 cdi.state &= ~CDROM_STATE_STOP;
 		}
 	        ivid = XtAppAddTimeOut(appc, 
-			(int)(scanPauseInterval * 1000.0), 
+			(int)(app_data.scanPauseInterval * 1000.0), 
 			update_track, NULL);
 	}
 	else
@@ -679,7 +681,7 @@
 			}
 
 			ivid = XtAppAddTimeOut(appc,
-				(int)(scanPauseInterval * 1000.0),
+				(int)(app_data.scanPauseInterval * 1000.0),
 				update_track, NULL);
 		}
 		else