Commit Graph

50 Commits

Author SHA1 Message Date
rillig
7315869338 cdplay: remove redundant parentheses around return value
Purely cosmetic change.  The generated code stays exactly the same.
2020-10-18 21:58:32 +00:00
christos
afe59ce9dc more stray \n 2015-06-17 00:01:59 +00:00
christos
73da111b07 fix the rest of the lint warnings [pass 1] 2013-10-07 15:17:24 +00:00
dholland
603ad97a41 Merge some of the cleanup from PR 21894. Do a bit more of my own.
lint still squawks quite a bit, and it woudl probably be worthwhile
for someone to go through and make all the signedness consistent, but
I think I've got the valuable bits.
2013-10-07 00:16:19 +00:00
drochner
a438c2d1f9 -make digital mode work in non-interactive mode (init sighandler
earlier, sleep(3) until playing finished)
-also switch to digital mode if an audio device is given on the
 cmd line, or the (new) "CDPLAY_DIGITAL" env var is set

(The latter can be used to make digital mode default per system.
As I see it, analog mode is not dead yet - two of three external
DVD drives I looked at have a speaker output.)
2012-01-04 17:26:21 +00:00
drochner
5923e578df kill unnecessary srandom() call which crept in in rev. 1.33 2012-01-04 17:07:20 +00:00
christos
338bfe9851 If the ioctl to play tracks returned EINVAL, switch to digital mode and
try again.
XXX: Should we do this for the other ioctls? Should we default to digital mode?
Definitely the error message is completely unfriendly and should be fixed.
2011-11-26 23:20:41 +00:00
joerg
136ac38948 ANSIfy + static + __dead 2011-08-29 14:00:54 +00:00
lukem
39a8950629 fix -W sign-compare issues. 2009-04-11 11:52:35 +00:00
dholland
18eba7e824 fix a dud indent 2009-02-22 08:32:25 +00:00
christos
e00e628d41 handle 64 bit time_t 2008-12-29 00:50:06 +00:00
drochner
1f6364ac89 some improvements to digital play mode:
-use AUMODE_PLAY_ALL, from Sergey Svishchev -- this might cause
 stuttering if the write to audio can't keep up, but it avoids pauses
 if the audio buffer drains out on stop/resume
-The timeout for the raw SCSI command to read audio data
 was too small, causing complete failure for me.
-Since the itimer can't do faster than HZ, a too small buffer doesn't
 work. Try to calculate a sensible buffer size.
-While it makes sense to deliver data a bit faster than necessary,
 it should be not that much that the blocking in the signal handler
 hurts interactive response. Allow for 50ms.
-Comment out a sched_yield() in the signal handler - this doesn't
 look right.
This is far from being perfect, but it makes digital mode usable for me.
And for Jeremy C. Reed, the author of PR bin/38493.
2008-07-16 17:26:25 +00:00
abs
06ffa3913a if ioctl(fd, CDIOCPLAYMSF,...) fails, do not warn("ioctl(CDIOREADTOCENTRYS)"); 2007-01-24 10:36:33 +00:00
dogcow
0dbd865aab arg might be improperly initialized; fix that.
(also, since we check arg == NULL, s/arg = 0/arg = NULL/.)
2006-12-27 18:47:20 +00:00
alc
c6ea7a850f CID-4199: move the test (line != NULL) one line up to check the
return value of strdup()

ok christos@
2006-12-27 17:55:05 +00:00
chuck
92a710ed6c take into account the 150 frame start offset time when computing the
duration of a track.  call lba2msf like this:
	lba2msf(len - 150, &m, &s, &f);
                    ^^^^^
from rev 1.41 of FreeBSD usr.sbin/cdcontrol/cdcontrol.c, Dmitry Afanasiev.

XXX: note that this is a mis-use of lba2msf() because 'len' is the length
     of the track in frames, not a logical block address (lba).
2006-12-14 18:15:16 +00:00
christos
ccf5505f5c remove bogus assertion. 2006-10-22 16:13:23 +00:00
xtraeme
49627385cb Apply patch from PR bin/34545 sent by Sergey Svishchev to add support
for digital transfer mode, not enabled by default.

To use it: $ cdplay -a /dev/audio (otherwise /dev/sound will be used)
and type "digital" on the interactive mode.

Thank you very much Sergey, it's very useful.

Reviewed and ok by christos@.
2006-09-22 18:20:53 +00:00
garbled
f9abebf063 Applied patch from PR bin/14505 Tested on i386-current. Fixes inability of
cdplay to properly play a cd immediately following an eject command in
interactive mode.  Patch supplied by Sergey Svishchev.
2006-01-12 18:15:59 +00:00
garbled
fd2134d98b Add repeat mode to cdplay(1) per PR bin/13970
Applied the second patch in the PR, with minor tweaking, and adjusted
manpage for change.
2006-01-02 21:29:53 +00:00
lukem
658ed3362c appease gcc -Wuninitialized 2005-06-02 01:35:57 +00:00
dsl
3145a29f62 Add (unsigned char) cast to ctype functions 2004-10-30 17:08:12 +00:00
itojun
1ce764ab35 use arc4random 2004-09-10 05:34:54 +00:00
christos
c7360d4269 eliminate unneeded use of sigcontext. 2003-09-12 00:39:38 +00:00
itojun
6d415bc4b0 use bounded string op 2003-07-14 11:54:06 +00:00
itojun
24c1ca6e35 use bounded string op as much as possible 2003-07-14 09:18:22 +00:00
matt
80623b55d4 Remove unused printf argument. 2003-02-28 05:48:58 +00:00
simonb
81dc935e33 Show the last "track" as the start of the lead-out area instead of a
bogus track number.  Remove a magic number and (slightly) simplify the
TOC entry display function a little.
2003-02-19 12:55:58 +00:00
is
591f5c7964 Fix PR 18444 and a few other corner cases in cdplay.c. 2003-01-30 21:23:57 +00:00
is
78a5ad1963 0 is a valid value for the absolute minute to stop playing. Initialize
to UINT_MAX before scanning, and check for UINT_MAX to detect whether it
was set.
Without this, it is not possible to play the first less than a minute of
a CD using absolute msf addresses.
2002-09-28 21:48:35 +00:00
itojun
f51456c273 err/errx/warn/warnx do not need \n at the end 2002-06-11 06:06:18 +00:00
thorpej
e05ba164ef Need <sys/types.h> early on. 2002-01-23 01:09:15 +00:00
ad
64905538d6 Fix typo. 2001-08-20 13:44:08 +00:00
ad
195345977b warn() -> warnx() in one place. 2001-08-20 12:37:21 +00:00
ad
767bd4a3fa - Implement shuffle play and some other goodies. Mostly from a patch
submitted by Sergey Svishchev <svs@ropnet.ru> in PR 13682.
- More tidying.
2001-08-20 11:24:57 +00:00
ad
a76db7786e Cleanup. 2001-08-20 09:50:10 +00:00
ad
d78020d1bf Use getrawpartition(). 2001-08-20 08:21:09 +00:00
gmcgarry
61e39db8f0 Add support for skipping to the previous and next tracks. 2001-07-01 05:04:26 +00:00
cgd
a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00
lukem
c3b1f98e93 replace guts of opencd() with call to opendisk(). prevents coredump
when a device with a leading / (e.g, `/dev/cd0') is given, as well as
promotes code reuse ;-)
2000-12-16 01:36:00 +00:00
is
135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
abs
9cf3724e46 Allow a single argument to 'volume' to set both channels. 2000-08-30 10:13:52 +00:00
msaitoh
e6af398b37 use play_track() instead of play_blocks() when play whole disk
(because the xfer length field of the PLAY command (0x45) is 2 bytes.
It's too short to play whole disk)
2000-06-15 21:07:37 +00:00
ad
1904914b75 Apply patch supplied in PR 8561 from URA Hiroshi: fixes LBA mode display on
little endian machines.
2000-06-14 13:51:45 +00:00
ad
3553879fc2 Use my proper name. 2000-06-13 13:36:42 +00:00
ad
26966d13f4 - ntohl() -> be32toh().
- Dispence with some of the idiocy in run().
- Couple of nits.
2000-01-05 18:15:20 +00:00
msaitoh
6f52aeb8d1 cdplay now uses libedit! 1999-11-26 18:34:58 +00:00
ad
a74cd67dcf Some cleanup [Fixes to follow as soon as I get a CD-ROM drive at home] 1999-09-18 21:15:23 +00:00
ad
424d2bb005 KNF 1999-06-05 14:03:32 +00:00
ad
dff6953739 'cdplay', a simple utility for playing compact disks with both a command line
and an interactive mode.
1999-06-05 13:21:59 +00:00