From c4bf963d9251ee2700016356a5a243562ad7a4f7 Mon Sep 17 00:00:00 2001 From: naddy Date: Wed, 11 Feb 2009 15:44:04 +0000 Subject: [PATCH] add digital audio extraction to the cdaudio input plugin (pinched from cdio) ok robert@ --- audio/xmms/Makefile | 4 +- .../patches/patch-Input_cdaudio_cdaudio_c | 45 +++++++++++++++++-- .../patches/patch-Input_cdaudio_cdaudio_h | 16 +++++++ 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 audio/xmms/patches/patch-Input_cdaudio_cdaudio_h diff --git a/audio/xmms/Makefile b/audio/xmms/Makefile index 5e9e519df68..b7e57af2f72 100644 --- a/audio/xmms/Makefile +++ b/audio/xmms/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.61 2009/01/16 04:15:46 jakemsr Exp $ +# $OpenBSD: Makefile,v 1.62 2009/02/11 15:44:04 naddy Exp $ COMMENT-main= Multimedia player for the X Window System COMMENT-vorbis= Ogg Vorbis input plugin for XMMS @@ -9,7 +9,7 @@ SHARED_ONLY= Yes VERSION= 1.2.11 DISTNAME= xmms-${VERSION} -PKGNAME-main= xmms-${VERSION}p4 +PKGNAME-main= xmms-${VERSION}p5 PKGNAME-vorbis= xmms-vorbis-${VERSION}p0 PKGNAME-mikmod= xmms-mikmod-${VERSION}p0 PKGNAME-mp3= xmms-mp3-${VERSION}p0 diff --git a/audio/xmms/patches/patch-Input_cdaudio_cdaudio_c b/audio/xmms/patches/patch-Input_cdaudio_cdaudio_c index 47e591b60b8..1042e00c09e 100644 --- a/audio/xmms/patches/patch-Input_cdaudio_cdaudio_c +++ b/audio/xmms/patches/patch-Input_cdaudio_cdaudio_c @@ -1,6 +1,6 @@ -$OpenBSD: patch-Input_cdaudio_cdaudio_c,v 1.4 2007/12/08 21:54:57 ajacoutot Exp $ ---- Input/cdaudio/cdaudio.c.orig Fri Nov 23 16:18:35 2007 -+++ Input/cdaudio/cdaudio.c Fri Nov 23 16:20:02 2007 +$OpenBSD: patch-Input_cdaudio_cdaudio_c,v 1.5 2009/02/11 15:44:04 naddy Exp $ +--- Input/cdaudio/cdaudio.c.orig Fri Nov 16 22:51:24 2007 ++++ Input/cdaudio/cdaudio.c Sat Feb 7 23:13:08 2009 @@ -819,6 +819,10 @@ static int get_current_frame(void) { struct ioc_read_subchannel subchnl; @@ -12,3 +12,42 @@ $OpenBSD: patch-Input_cdaudio_cdaudio_c,v 1.4 2007/12/08 21:54:57 ajacoutot Exp subchnl.address_format = CD_MSF_FORMAT; subchnl.data_format = CD_CURRENT_POSITION; subchnl.track = 0; +@@ -891,6 +895,38 @@ int read_audio_data(int fd, int pos, int num, void *bu + return num; + } + # endif /* CDIOCREADAUDIO */ ++#endif ++ ++#ifdef __OpenBSD__ ++int read_audio_data(int fd, int pos, int num, void *buf) ++{ ++ scsireq_t scr; ++ int lba; ++ ++ memset(&scr, 0, sizeof(scr)); ++ ++ lba = pos - CDDA_MSF_OFFSET; ++ scr.cmd[0] = 0xbe; /* READ CD */ ++ scr.cmd[2] = (lba >> 24) & 0xff; ++ scr.cmd[3] = (lba >> 16) & 0xff; ++ scr.cmd[4] = (lba >> 8) & 0xff; ++ scr.cmd[5] = lba & 0xff; ++ scr.cmd[6] = (num >> 16) & 0xff; ++ scr.cmd[7] = (num >> 8) & 0xff; ++ scr.cmd[8] = num & 0xff; ++ scr.cmd[9] = 0x10; ++ ++ scr.flags = SCCMD_ESCAPE | SCCMD_READ; ++ scr.databuf = buf; ++ scr.datalen = num * CD_FRAMESIZE_RAW; ++ scr.cmdlen = 12; ++ scr.timeout = 120000; ++ scr.senselen = SENSEBUFLEN; ++ ++ if (ioctl(fd, SCIOCCOMMAND, &scr) == -1 || scr.retsts != SCCMD_OK) ++ return 0; ++ return num; ++} + #endif + + #ifdef XMMS_CDROM_BSD_NETBSD /* NetBSD, OpenBSD */ diff --git a/audio/xmms/patches/patch-Input_cdaudio_cdaudio_h b/audio/xmms/patches/patch-Input_cdaudio_cdaudio_h new file mode 100644 index 00000000000..27bf2fc9a10 --- /dev/null +++ b/audio/xmms/patches/patch-Input_cdaudio_cdaudio_h @@ -0,0 +1,16 @@ +$OpenBSD: patch-Input_cdaudio_cdaudio_h,v 1.1 2009/02/11 15:44:04 naddy Exp $ +--- Input/cdaudio/cdaudio.h.orig Sat Feb 7 22:44:27 2009 ++++ Input/cdaudio/cdaudio.h Sat Feb 7 22:56:20 2009 +@@ -65,7 +65,11 @@ + #include + #endif + +-#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE) ++#ifdef __OpenBSD__ ++#include ++#endif ++ ++#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE) || defined(SCIOCCOMMAND) + # define CDDA_HAS_READAUDIO + #endif +