From 139bb71285ed357d471b4af46e7f132b7045be6e Mon Sep 17 00:00:00 2001 From: bertrand Date: Wed, 4 Sep 2002 17:46:03 +0000 Subject: [PATCH] =?UTF-8?q?Applied=20patch=20for=20OpenBDS=20from=20Marc?= =?UTF-8?q?=20Espie=20(submitted=20by=20Bj=C3=B6rn=20Sandell=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7270 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 + libmpdemux/cddb.c | 58 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 2d3f88fdf5..1b1d3e4ed4 100755 --- a/configure +++ b/configure @@ -3238,6 +3238,7 @@ if test "$_cdparanoia" = yes ; then _def_cdparanoia='#define HAVE_CDDA' _inputmodules="cdda $_inputmodules" _ld_cdparanoia="$_ld_cdparanoia -lcdda_interface -lcdda_paranoia" + openbsd && _ld_cdparanoia="$_ld_cdparanoia -lutil" else _def_cdparanoia='#undef HAVE_CDDA' _noinputmodules="cdda $_noinputmodules" diff --git a/libmpdemux/cddb.c b/libmpdemux/cddb.c index cddde5cc2c..7c0f8764a1 100644 --- a/libmpdemux/cddb.c +++ b/libmpdemux/cddb.c @@ -28,14 +28,21 @@ #include #include -#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 + #include #elif defined(SYS_BSD) -#include + #include +#elif defined(SYS_OBSD) + #include + #include #endif #include "cdd.h" @@ -111,6 +118,49 @@ read_toc(void) { 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); + return tochdr.ending_track; +} #endif unsigned int