add digital audio extraction to the cdaudio input plugin (pinched from cdio)

ok robert@
This commit is contained in:
naddy 2009-02-11 15:44:04 +00:00
parent 14feb56f24
commit c4bf963d92
3 changed files with 60 additions and 5 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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 <sys/cdrio.h>
#endif
-#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE)
+#ifdef __OpenBSD__
+#include <sys/scsiio.h>
+#endif
+
+#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE) || defined(SCIOCCOMMAND)
# define CDDA_HAS_READAUDIO
#endif