]>
Commit | Line | Data |
---|---|---|
0a0c4aaf | 1 | --- amp-0.7.6.orig/audio.c |
2 | +++ amp-0.7.6/audio.c | |
3 | @@ -46,6 +46,8 @@ | |
4 | typedef int bool; | |
5 | #endif | |
6 | ||
7 | +int rt = 0; | |
8 | + | |
9 | void statusDisplay(struct AUDIO_HEADER *header, int frameNo) | |
10 | { | |
11 | int minutes,seconds; | |
12 | @@ -72,18 +74,20 @@ | |
13 | uid_t my_uid = getuid(); | |
14 | ||
15 | #ifdef LINUX_REALTIME | |
16 | - set_realtime_priority(); | |
17 | - | |
18 | - setreuid(my_uid, my_uid); | |
19 | + if (rt) { | |
20 | + set_realtime_priority(); | |
21 | ||
22 | - prefetch_initial_fill(); | |
23 | + setreuid(my_uid, my_uid); | |
24 | + | |
25 | + prefetch_initial_fill(); | |
26 | + } | |
27 | #endif /* LINUX_REALTIME */ | |
28 | ||
29 | initialise_globals(); | |
30 | ||
31 | -#ifndef LINUX_REALTIME | |
32 | + //#ifndef LINUX_REALTIME | |
33 | if (A_FORMAT_WAVE) wav_begin(); | |
34 | -#endif /* LINUX_REALTIME */ | |
35 | + //#endif /* LINUX_REALTIME */ | |
36 | ||
37 | if ((g=gethdr(&header))!=0) { | |
38 | report_header_error(g); | |
39 | @@ -93,10 +97,17 @@ | |
40 | if (header.protection_bit==0) getcrc(); | |
41 | ||
42 | #ifdef LINUX_REALTIME | |
43 | - if (setup_fancy_audio(&header)!=0) { | |
44 | - warn("Cannot set up direct-to-DMA audio. Exiting\n"); | |
45 | - return -1; | |
46 | + if (rt) { | |
47 | + if (setup_fancy_audio(&header)!=0) { | |
48 | + warn("Cannot set up direct-to-DMA audio. Exiting\n"); | |
49 | + return -1; | |
50 | + } | |
51 | } | |
52 | + else | |
53 | + if (setup_audio(&header)!=0) { | |
54 | + warn("Cannot set up audio. Exiting\n"); | |
55 | + return -1; | |
56 | + } | |
57 | #else | |
58 | if (setup_audio(&header)!=0) { | |
59 | warn("Cannot set up audio. Exiting\n"); | |
60 | @@ -119,9 +130,11 @@ | |
61 | } | |
62 | ||
63 | #ifdef LINUX_REALTIME | |
64 | - if (start_fancy_audio(&header)!=0) { | |
65 | - warn("Cannot start direct-to-DMA audio. Exiting\n"); | |
66 | - return -1; | |
67 | + if (rt) { | |
68 | + if (start_fancy_audio(&header)!=0) { | |
69 | + warn("Cannot start direct-to-DMA audio. Exiting\n"); | |
70 | + return -1; | |
71 | + } | |
72 | } | |
73 | #endif /* LINUX_REALTIME */ | |
74 | ||
75 | @@ -136,7 +149,12 @@ | |
76 | if ((g=gethdr(&header))!=0) { | |
77 | report_header_error(g); | |
78 | #ifdef LINUX_REALTIME | |
79 | - cleanup_fancy_audio(); | |
80 | + if (rt) { | |
81 | + cleanup_fancy_audio(); | |
82 | + } | |
83 | + else { | |
84 | + if (g==GETHDR_EOF && A_FORMAT_WAVE) wav_end(&header); | |
85 | + } | |
86 | #else | |
87 | if (g==GETHDR_EOF && A_FORMAT_WAVE) wav_end(&header); | |
88 | #endif /* LINUX_REALTIME */ | |
89 | @@ -161,16 +179,20 @@ | |
90 | cnt++; | |
91 | } | |
92 | #ifdef LINUX_REALTIME | |
93 | - if (block_fancy_audio(snd_eof)!=0) { | |
94 | - warn("Problems with direct-to-DMA audio\n"); | |
95 | - return -1; | |
96 | + if (rt) { | |
97 | + if (block_fancy_audio(snd_eof)!=0) { | |
98 | + warn("Problems with direct-to-DMA audio\n"); | |
99 | + return -1; | |
100 | + } | |
101 | } | |
102 | #endif | |
103 | } | |
104 | #ifdef LINUX_REALTIME | |
105 | - if (stop_fancy_audio()!=0) { | |
106 | - warn("Cannot stop direct-to-DMA audio. Exiting\n"); | |
107 | - return -1; | |
108 | + if (rt) { | |
109 | + if (stop_fancy_audio()!=0) { | |
110 | + warn("Cannot stop direct-to-DMA audio. Exiting\n"); | |
111 | + return -1; | |
112 | + } | |
113 | } | |
114 | #endif | |
115 | return 0; | |
116 | @@ -179,6 +201,7 @@ | |
117 | int main(int argc,char **argv) | |
118 | { | |
119 | int argPos; | |
120 | +struct stat st; | |
121 | ||
122 | argPos=args(argc,argv); /* process command line arguments */ | |
123 | ||
124 | @@ -194,11 +217,27 @@ | |
125 | if (argPos<argc) | |
126 | for(;argPos<argc;argPos++) { | |
127 | #ifdef LINUX_REALTIME | |
128 | - if (geteuid() != 0) | |
129 | - die("effective UID not root, cannot use realtime buffering\n"); | |
130 | - rt_play(argv[argPos]); | |
131 | + if (stat(argv[argPos], &st) < 0) { | |
132 | + warn("Could not stat file: %s\n",argv[argPos]); | |
133 | + continue; | |
134 | + } | |
135 | + if (S_ISREG(st.st_mode)) { | |
136 | + rt = 1; | |
137 | + } | |
138 | + if (geteuid() != 0) { | |
139 | + rt = 0; | |
140 | + } | |
141 | + if (rt) { | |
142 | +// if (geteuid() != 0) | |
143 | +// die("effective UID not root, cannot use realtime buffering\n"); | |
144 | + rt_play(argv[argPos]); | |
145 | + } | |
146 | + else { | |
147 | + play(argv[argPos],0); | |
148 | + } | |
149 | + | |
150 | #else /* LINUX_REALTIME */ | |
151 | - play(argv[argPos],0); | |
152 | + play(argv[argPos],0); | |
153 | #endif /* LINUX_REALTIME */ | |
154 | } | |
155 | else | |
156 | @@ -288,7 +327,12 @@ | |
157 | int ready_audio(void) | |
158 | { | |
159 | #ifdef LINUX_REALTIME | |
160 | - return ready_fancy_audio(); | |
161 | + if (rt) { | |
162 | + return ready_fancy_audio(); | |
163 | + } | |
164 | + else { | |
165 | + return 1; | |
166 | + } | |
167 | #else | |
168 | return 1; | |
169 | #endif | |
170 | @@ -298,8 +342,9 @@ | |
171 | */ | |
172 | void play(char *inFileStr, char *outFileStr) | |
173 | { | |
174 | - if (strcmp(inFileStr,"-")==0) | |
175 | + if (strcmp(inFileStr,"-")==0) { | |
176 | in_file=stdin; | |
177 | + } | |
178 | else { | |
179 | if ((in_file=fopen(inFileStr,"r"))==NULL) { | |
180 | warn("Could not open file: %s\n",inFileStr); | |
181 | --- amp-0.7.6.orig/getbits.c | |
182 | +++ amp-0.7.6/getbits.c | |
183 | @@ -14,6 +14,8 @@ | |
184 | #define GETBITS | |
185 | #include "getbits.h" | |
186 | ||
187 | +extern int rt; | |
188 | + | |
189 | /* | |
190 | * buffer and bit manipulation functions *************************************** | |
191 | */ | |
192 | @@ -256,7 +258,15 @@ | |
193 | static inline int get_input(unsigned char* bp, unsigned int size) | |
194 | { | |
195 | #ifdef LINUX_REALTIME | |
196 | - return prefetch_get_input(bp,size); | |
197 | + if (rt) { | |
198 | + return prefetch_get_input(bp,size); | |
199 | + } | |
200 | + else { | |
201 | + if ( fread( bp , 1, size, in_file) != size) | |
202 | + if (feof(in_file)) return GETHDR_EOF; | |
203 | + else return GETHDR_ERR; | |
204 | + return 0; | |
205 | + } | |
206 | #else /* LINUX_REALTIME */ | |
207 | if ( fread( bp , 1, size, in_file) != size) | |
208 | if (feof(in_file)) return GETHDR_EOF; | |
209 | --- amp-0.7.6.orig/rtbuf.c | |
210 | +++ amp-0.7.6/rtbuf.c | |
211 | @@ -431,7 +431,7 @@ | |
212 | int block_fancy_audio(int snd_eof) | |
213 | { | |
214 | int i; | |
215 | -struct fd_set wmask; | |
216 | +fd_set wmask; | |
217 | struct timeval tm; | |
218 | ||
219 | do { | |
220 | --- amp-0.7.6.orig/buffer.c | |
221 | +++ amp-0.7.6/buffer.c | |
222 | @@ -29,6 +29,8 @@ | |
223 | #include "audioIO.h" | |
224 | #include "audio.h" | |
225 | ||
226 | +extern int rt; | |
227 | + | |
228 | struct ringBuffer { /* A ring buffer to store the data in */ | |
229 | char *bufferPtr; /* buffer pointer */ | |
230 | int inPos, outPos; /* positions for reading and writing */ | |
231 | @@ -75,7 +77,15 @@ | |
232 | ||
233 | if (A_AUDIO_PLAY) { | |
234 | #ifdef LINUX_REALTIME | |
235 | - rt_printout((short*) sample_buffer, j * sizeof(short)); | |
236 | + if (rt) { | |
237 | + rt_printout((short*) sample_buffer, j * sizeof(short)); | |
238 | + } | |
239 | + else { | |
240 | + if (AUDIO_BUFFER_SIZE==0) | |
241 | + audioWrite((char*)sample_buffer, j * sizeof(short)); | |
242 | + else | |
243 | + audioBufferWrite((char*)sample_buffer, j * sizeof(short)); | |
244 | + } | |
245 | #else /* LINUX_REALTIME */ | |
246 | if (AUDIO_BUFFER_SIZE==0) | |
247 | audioWrite((char*)sample_buffer, j * sizeof(short)); | |
248 | --- amp-0.7.6.orig/debian/README.Debian | |
249 | +++ amp-0.7.6/debian/README.Debian | |
250 | @@ -0,0 +1,11 @@ | |
251 | +amp for Debian | |
252 | +---------------------- | |
253 | + | |
254 | +amp (Audio Mpeg Player) is a realtime MPEG compressed audio file | |
255 | +player. | |
256 | + | |
257 | +amp works with both MPEG1 and MPEG2 audio files, layers 2 and 3. | |
258 | + | |
259 | +Ed Boraas <ed@debian.org>, Sun Jun 13 01:19:41 MDT 1999 | |
260 | + | |
261 | + | |
262 | --- amp-0.7.6.orig/debian/changelog | |
263 | +++ amp-0.7.6/debian/changelog | |
264 | @@ -0,0 +1,57 @@ | |
265 | +amp (0.7.6-7) frozen unstable; urgency=low | |
266 | + | |
267 | + * Do not install with setuid root. (closes: #62519) | |
268 | + | |
269 | + -- Fredrik Hallenberg <hallon@debian.org> Mon, 17 Apr 2000 09:43:32 +0200 | |
270 | + | |
271 | +amp (0.7.6-6) unstable; urgency=low | |
272 | + | |
273 | + * Forgot to change maintainer in control. | |
274 | + * Updated standards version to 3.0.0. | |
275 | + | |
276 | + -- Fredrik Hallenberg <hallon@debian.org> Sun, 17 Oct 1999 01:15:45 +0200 | |
277 | + | |
278 | +amp (0.7.6-5) unstable; urgency=low | |
279 | + | |
280 | + * New maintainer. | |
281 | + * Use dh_suidregister. | |
282 | + * Fixed realtime stuff so it is only used when playing regular files. | |
283 | + (closes: #41900, #44493) | |
284 | + | |
285 | + -- Fredrik Hallenberg <hallon@debian.org> Sat, 16 Oct 1999 12:00:57 +0200 | |
286 | + | |
287 | +amp (0.7.6-4) unstable; urgency=low | |
288 | + | |
289 | + * Now /really/ runs suid root :) | |
290 | + * Removed deprecated dh_du from debian/rules | |
291 | + | |
292 | + -- Ed Boraas <ed@debian.org> Mon, 14 Jun 1999 23:55:40 -0600 | |
293 | + | |
294 | + | |
295 | +amp (0.7.6-3) unstable; urgency=low | |
296 | + | |
297 | + * Fixed upstream realtime support bug in rtbuf.c and compiled | |
298 | + with realtime support enabled. (Closes: #25346) | |
299 | + * amp now runs suid root (required for realtime support). | |
300 | + * All non-wishlist bugs are now fixed. | |
301 | + | |
302 | + -- Ed Boraas <ed@debian.org> Mon, 14 Jun 1999 11:31:04 -0600 | |
303 | + | |
304 | + | |
305 | +amp (0.7.6-2) unstable; urgency=low | |
306 | + | |
307 | + * New maintainer. | |
308 | + | |
309 | + -- Ed Boraas <ed@debian.org> Sun, 13 Jun 1999 01:19:11 -0600 | |
310 | + | |
311 | + | |
312 | +amp (0.7.6-1) unstable; urgency=low | |
313 | + | |
314 | + * Initial release. | |
315 | + | |
316 | + -- Ben Gertzfield <che@debian.org> Sun, 25 Jan 1998 01:50:28 -0800 | |
317 | + | |
318 | +Local variables: | |
319 | +mode: debian-changelog | |
320 | +add-log-mailing-address: "hallon@debian.org" | |
321 | +End: | |
322 | --- amp-0.7.6.orig/debian/control | |
323 | +++ amp-0.7.6/debian/control | |
324 | @@ -0,0 +1,14 @@ | |
325 | +Source: amp | |
326 | +Priority: optional | |
327 | +Section: non-free/sound | |
328 | +Maintainer: Fredrik Hallenberg <hallon@debian.org> | |
329 | +Standards-Version: 3.0.0 | |
330 | + | |
331 | +Package: amp | |
332 | +Architecture: any | |
333 | +Section: non-free/sound | |
334 | +Depends: ${shlibs:Depends} | |
335 | +Description: The Audio MPEG Player | |
336 | + amp is an MPEG audio file player. | |
337 | + . | |
338 | + amp can play MPEG1 or MPEG2 files, layers 2 and 3. | |
339 | --- amp-0.7.6.orig/debian/copyright | |
340 | +++ amp-0.7.6/debian/copyright | |
341 | @@ -0,0 +1,31 @@ | |
342 | +This package was Debianized by Ed Boraas <ed@debian.org> | |
343 | + | |
344 | +It was downloaded from ftp://ftp.rasip.fer.hr/pub/mpeg/ | |
345 | + | |
346 | +Copyright: | |
347 | + | |
348 | +This software can be used freely for any purpose. It can be distributed | |
349 | +freely, as long as it is not sold commercially without permission from | |
350 | +Tomislav Uzelac <tuzelac@rasip.fer.hr>. However, including this software | |
351 | +on CD_ROMs containing other free software is explicitly permitted even | |
352 | +when a modest distribution fee is charged for the CD, as long as this | |
353 | +software is not a primary selling argument for the CD. | |
354 | + | |
355 | +Building derived versions of this software is permitted, as long as they | |
356 | +are not sold commercially without permission from Tomislav Uzelac | |
357 | +<tuzelac@rasip.fer.hr>. Any derived versions must be clearly marked as | |
358 | +such, and must be called by a name other than amp. Any derived versions | |
359 | +must retain this copyright notice. | |
360 | + | |
361 | +/* This license is itself copied from Tatu Ylonen's ssh package. It does | |
362 | + * not mention being copyrighted itself :) | |
363 | + */ | |
364 | + | |
365 | +THERE IS NO WARRANTY FOR THIS PROGRAM - whatsoever. You use it entirely | |
366 | +at your risk, and neither Tomislav Uzelac, nor FER will be liable for | |
367 | +any damages that might occur to your computer, software, etc. in | |
368 | +consequence of you using this freeware program. | |
369 | + | |
370 | + | |
371 | +Tomislav Uzelac | |
372 | +<tuzelac@rasip.fer.hr> | |
373 | --- amp-0.7.6.orig/debian/rules | |
374 | +++ amp-0.7.6/debian/rules | |
375 | @@ -0,0 +1,58 @@ | |
376 | +#!/usr/bin/make -f | |
377 | +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. | |
378 | + | |
379 | +# Uncomment this to turn on verbose mode. | |
380 | +#export DH_VERBOSE=1 | |
381 | + | |
382 | +build: build-stamp | |
383 | +build-stamp: | |
384 | + dh_testdir | |
385 | + | |
386 | + ./configure --prefix=/usr --enable-realtime | |
387 | + $(MAKE) | |
388 | + | |
389 | + touch build-stamp | |
390 | + | |
391 | +clean: | |
392 | + dh_testdir | |
393 | + dh_testroot | |
394 | + rm -f build-stamp | |
395 | + | |
396 | + -$(MAKE) distclean | |
397 | + | |
398 | + dh_clean | |
399 | + | |
400 | +# Build architecture-independent files here. | |
401 | +binary-indep: build | |
402 | +# We have nothing to do by default. | |
403 | + | |
404 | +# Build architecture-dependent files here. | |
405 | +binary-arch: build amp | |
406 | + | |
407 | +amp: build | |
408 | + dh_testdir | |
409 | + dh_testroot | |
410 | + dh_clean | |
411 | + dh_installdirs usr/bin usr/share/man/man1 | |
412 | + # Add here commands to install the files into debian/tmp | |
413 | + cp amp debian/tmp/usr/bin | |
414 | + cp amp.1 debian/tmp/usr/share/man/man1 | |
415 | + dh_installdocs README | |
416 | + dh_installchangelogs | |
417 | + dh_strip | |
418 | + dh_compress | |
419 | + dh_fixperms | |
420 | +# chmod u+s debian/tmp/usr/bin/amp | |
421 | +# dh_suidregister | |
422 | + dh_installdeb | |
423 | + dh_shlibdeps | |
424 | + dh_gencontrol | |
425 | + dh_makeshlibs | |
426 | + dh_md5sums | |
427 | + dh_builddeb | |
428 | + | |
429 | +source diff: | |
430 | + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false | |
431 | + | |
432 | +binary: binary-indep binary-arch | |
433 | +.PHONY: build clean binary-indep binary-arch binary |