[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cdio(1)'s relative play feature is broken



cdio's relative play feature is haywire.

If you want to play 1:00 of track 2 you have to specify

	cdio> 1 1:00

furthermore you can't play a relative offset of track 1.

In addition all of the length checks are broken as well.

Here's one of many possible fixes (I'm assuming that lba2msf
behaves the same way as toc_buffer so that it's the logic that's
broken, not toc_buffer):

Index: cdio.c
===================================================================
RCS file: /cvs/src/usr.bin/cdio/cdio.c,v
retrieving revision 1.17
diff -u -r1.17 cdio.c
--- cdio.c	2001/08/14 00:01:56	1.17
+++ cdio.c	2001/08/26 20:10:07
@@ -555,6 +555,9 @@
 		else if (tr1 > n)
 			tr1 = n;
 
+		/* set offset to beginning */
+		tr1--;
+
 		if (msf) {
 			tm = toc_buffer[tr1].addr.msf.minute;
 			ts = toc_buffer[tr1].addr.msf.second;
@@ -562,16 +565,6 @@
 		} else
 			lba2msf(ntohl(toc_buffer[tr1].addr.lba),
 				&tm, &ts, &tf);
-		if ((m1 > tm)
-		    || ((m1 == tm)
-		    && ((s1 > ts)
-		    || ((s1 == ts)
-		    && (f1 > tf))))) {
-			printf ("Track %d is not that long.\n", tr1);
-			return (0);
-		}
-
-		tr1--;
 
 		f1 += tf;
 		if (f1 >= 75) {
@@ -586,6 +579,26 @@
 		}
 
 		m1 += tm;
+
+		/* set offset to end */
+		tr1++;
+
+		if (msf) {
+			tm = toc_buffer[tr1].addr.msf.minute;
+			ts = toc_buffer[tr1].addr.msf.second;
+			tf = toc_buffer[tr1].addr.msf.frame;
+		} else
+			lba2msf(ntohl(toc_buffer[tr1].addr.lba),
+				&tm, &ts, &tf);
+
+		if ((m1 > tm)
+		    || ((m1 == tm)
+		    && ((s1 > ts)
+		    || ((s1 == ts)
+		    && (f1 > tf))))) {
+			printf ("Track %d is not that long.\n", tr1);
+			return (0);
+		}
 
 		if (! tr2) {
 			if (m2 || s2 || f2) {



Visit your host, monkey.org