diff options
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/cd.c | 23 |
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)); } /* |