[Mplayer-cvslog] CVS: main/libmpdemux cddb.c,1.3,1.4

Bertrand Baudet bertrand at mplayerhq.hu
Wed Sep 4 19:46:06 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv25538/libmpdemux

Modified Files:
	cddb.c 
Log Message:
Applied patch for OpenBDS from Marc Espie (submitted by Björn Sandell <biorn at dce.chalmers.se>)


Index: cddb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cddb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cddb.c	10 Jul 2002 08:51:11 -0000	1.3
+++ cddb.c	4 Sep 2002 17:46:03 -0000	1.4
@@ -28,14 +28,21 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)
-#define SYS_BSD 1
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+	#define SYS_BSD 1
+#endif
+
+#if defined(__OpenBSD__)
+	#define SYS_OBSD 1
 #endif
 
 #if defined(__linux__)
-#include <linux/cdrom.h>
+	#include <linux/cdrom.h>
 #elif defined(SYS_BSD)
-#include <sys/cdio.h>
+	#include <sys/cdio.h>
+#elif defined(SYS_OBSD)
+	#include <util.h>
+	#include <sys/cdio.h>
 #endif
 
 #include "cdd.h"
@@ -106,6 +113,49 @@
 	cdtoc[tochdr.ending_track].min = tocentry.entry.addr.msf.minute;
 	cdtoc[tochdr.ending_track].sec = tocentry.entry.addr.msf.second;
 	cdtoc[tochdr.ending_track].frame = tocentry.entry.addr.msf.frame;
+	cdtoc[tochdr.ending_track].frame += cdtoc[tochdr.ending_track].min*60*75;
+	cdtoc[tochdr.ending_track].frame += cdtoc[tochdr.ending_track].sec*75;
+	close(drive);
+	return tochdr.ending_track;
+}
+
+#elif defined(SYS_OBSD)
+int 
+read_toc(void) {
+	int drive;
+	struct ioc_toc_header tochdr;
+	struct ioc_read_toc_entry tocentry;
+	int i;
+	char *drivename;
+	char *realdev;
+	struct cd_toc_entry toc_buffer;
+
+	drivename = getenv("CDROM");
+	if (!drivename)
+		drivename = "cd0";
+	drive = opendev(drivename, O_RDONLY, OPENDEV_PART, &realdev);
+	if (!drive)
+		return -1;
+
+	ioctl(drive, CDIOREADTOCHEADER, &tochdr);
+	for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
+		tocentry.starting_track = i;
+		tocentry.address_format = CD_MSF_FORMAT;
+		tocentry.data = &toc_buffer;
+		tocentry.data_len = sizeof(toc_buffer);
+		ioctl(drive, CDIOREADTOCENTRYS, &tocentry);
+		cdtoc[i-1].min = toc_buffer.addr.msf.minute;
+		cdtoc[i-1].sec = toc_buffer.addr.msf.second;
+		cdtoc[i-1].frame = toc_buffer.addr.msf.frame;
+		cdtoc[i-1].frame += cdtoc[i-1].min*60*75;
+		cdtoc[i-1].frame += cdtoc[i-1].sec*75;
+	}
+	tocentry.starting_track = 0xAA;
+	tocentry.address_format = CD_MSF_FORMAT;
+	ioctl(drive, CDIOREADTOCENTRYS, &tocentry);
+	cdtoc[tochdr.ending_track].min = toc_buffer.addr.msf.minute;
+	cdtoc[tochdr.ending_track].sec = toc_buffer.addr.msf.second;
+	cdtoc[tochdr.ending_track].frame = toc_buffer.addr.msf.frame;
 	cdtoc[tochdr.ending_track].frame += cdtoc[tochdr.ending_track].min*60*75;
 	cdtoc[tochdr.ending_track].frame += cdtoc[tochdr.ending_track].sec*75;
 	close(drive);




More information about the MPlayer-cvslog mailing list