summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-01-17 04:30:07 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-01-17 04:30:07 +0000
commit958feb8fa03130c5ea6ead05031923995c1b8e7b (patch)
tree88b5ad84e43a49bfa424df926ffc40d658d66a39 /sys/scsi
parent3b55609cee3ce45a940e86979f47c40b6d1c690b (diff)
The end of the track is one frame before the first frame of the next track
(and right before the leadout track in the case of the last track). Some CDROM's are evidentally picky about being asked to play the first frame of the leadout.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 495c2172119..2829df4a120 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.66 2003/01/05 22:33:23 deraadt Exp $ */
+/* $OpenBSD: cd.c,v 1.67 2003/01/17 04:30:06 jason Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -1406,6 +1406,7 @@ cd_play_tracks(cd, strack, sindex, etrack, eindex)
int strack, sindex, etrack, eindex;
{
struct cd_toc toc;
+ u_char endf, ends, endm;
int error;
if (!etrack)
@@ -1424,12 +1425,26 @@ cd_play_tracks(cd, strack, sindex, etrack, eindex)
if (strack < 0)
return (EINVAL);
+ /*
+ * The track ends one frame before the next begins. The last track
+ * is taken care of by the leadoff track.
+ */
+ endm = toc.entries[etrack].addr.msf.minute;
+ ends = toc.entries[etrack].addr.msf.second;
+ endf = toc.entries[etrack].addr.msf.frame;
+ if (endf-- == 0) {
+ endf = CD_FRAMES - 1;
+ if (ends-- == 0) {
+ ends = CD_SECS - 1;
+ if (endm-- == 0)
+ return (EINVAL);
+ }
+ }
+
return (cd_play_msf(cd, toc.entries[strack].addr.msf.minute,
toc.entries[strack].addr.msf.second,
toc.entries[strack].addr.msf.frame,
- toc.entries[etrack].addr.msf.minute,
- toc.entries[etrack].addr.msf.second,
- toc.entries[etrack].addr.msf.frame));
+ endm, ends, endf));
}
/*