summaryrefslogtreecommitdiff
path: root/src/input/input_cdda.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_cdda.c')
-rw-r--r--src/input/input_cdda.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 0b1f046e8..5f830a1d3 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -15,12 +15,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Compact Disc Digital Audio (CDDA) Input Plugin
* by Mike Melanson (melanson@pcisys.net)
- *
- * $Id: input_cdda.c,v 1.94 2007/03/10 00:48:59 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -614,7 +612,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
return 0;
}
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#include <sys/cdio.h>
@@ -625,7 +623,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
static int read_cdrom_toc(int fd, cdrom_toc *toc) {
struct ioc_toc_header tochdr;
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
struct ioc_read_toc_single_entry tocentry;
#elif defined(__NetBSD__)
struct ioc_read_toc_entry tocentry;
@@ -656,7 +654,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
memset(&tocentry, 0, sizeof(tocentry));
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
tocentry.track = i;
tocentry.address_format = CD_MSF_FORMAT;
if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) {
@@ -675,7 +673,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
}
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
toc->toc_entries[i-1].track_mode = (tocentry.entry.control & 0x04) ? 1 : 0;
toc->toc_entries[i-1].first_frame_minute = tocentry.entry.addr.msf.minute;
toc->toc_entries[i-1].first_frame_second = tocentry.entry.addr.msf.second;
@@ -699,7 +697,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
/* fetch the leadout as well */
memset(&tocentry, 0, sizeof(tocentry));
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
tocentry.track = CD_LEADOUT_TRACK;
tocentry.address_format = CD_MSF_FORMAT;
if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) {
@@ -718,7 +716,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
}
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
toc->leadout_track.track_mode = (tocentry.entry.control & 0x04) ? 1 : 0;
toc->leadout_track.first_frame_minute = tocentry.entry.addr.msf.minute;
toc->leadout_track.first_frame_second = tocentry.entry.addr.msf.second;
@@ -747,8 +745,8 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
int fd = this_gen->fd;
while( num_frames ) {
-#if defined(__FreeBSD__)
-#if __FreeBSD_version < 501106
+#if defined(__FreeBSD_kernel__)
+#if __FreeBSD_kernel_version < 501106
struct ioc_read_audio cdda;
cdda.address_format = CD_MSF_FORMAT;
@@ -757,13 +755,10 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
cdda.address.msf.frame = frame % CD_FRAMES_PER_SECOND;
cdda.nframes = 1;
cdda.buffer = data;
-#endif
-
-#if __FreeBSD_version >= 501106
- if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) {
-#else
/* read a frame */
if(ioctl(fd, CDIOCREADAUDIO, &cdda) < 0) {
+#else
+ if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) {
#endif
perror("CDIOCREADAUDIO");
return -1;