changeset 392:86c4cd37b812 trunk

[svn] Support for FreeBSD 6.x CD Audio DAE.
author nenolod
date Thu, 05 Jan 2006 00:07:44 -0800
parents aeb6aa8ae8d1
children 7189b4e61548
files Plugins/Input/cdaudio/cdaudio.c Plugins/Input/cdaudio/cdaudio.h
diffstat 2 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/cdaudio/cdaudio.c	Wed Jan 04 12:26:59 2006 -0800
+++ b/Plugins/Input/cdaudio/cdaudio.c	Thu Jan 05 00:07:44 2006 -0800
@@ -71,8 +71,10 @@
 
 #ifndef CDDA_DEVICE
 # ifdef HAVE_SYS_CDIO_H
-#  ifdef __FreeBSD__
+#  if defined(__FreeBSD__) && !defined(CDIOCREADAUDIO)
 #   define CDDA_DEVICE "/dev/acd0c"
+#  elif defined __FreeBSD__
+#   define CDDA_DEVICE "/dev/acd0"
 #  elif defined __OpenBSD__
 #   define CDDA_DEVICE "/dev/cd0c"
 #  else
@@ -411,9 +413,22 @@
     }
 }
 
+#if defined(__FreeBSD__) && !defined(CDIOCREADAUDIO)
+int
+read_audio_data(int fd, int pos, int num, void *buf)
+{
+    int bs = CD_FRAMESIZE_RAW;
+
+    if (ioctl(fd, CDRIOCSETBLOCKSIZE, &bs) == -1)
+	return -1;
+    if (pread(fd, buf, num * bs, (pos - 150) * bs) != num * bs)
+	return -1;
+
+    return num;
+}
+#endif
 
 #if defined(CDIOCREADAUDIO)
-#ifdef __FreeBSD__
 int
 read_audio_data(int fd, int pos, int num, void *buf)
 {
@@ -429,9 +444,6 @@
 
     return cdra.nframes;
 }
-#else
-#error Please test on other <sys/cdio.h> platforms.
-#endif
 #endif                          /* CDIOCREADAUDIO */
 
 #ifdef BEEP_CDROM_BSD_NETBSD    /* NetBSD, OpenBSD */
--- a/Plugins/Input/cdaudio/cdaudio.h	Wed Jan 04 12:26:59 2006 -0800
+++ b/Plugins/Input/cdaudio/cdaudio.h	Thu Jan 05 00:07:44 2006 -0800
@@ -56,7 +56,7 @@
 #include <sys/cdio.h>
 #endif
 
-#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA)
+#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE)
 # define CDDA_HAS_READAUDIO
 #endif