pkgsrc/audio/cdparanoia/patches/patch-cd
itohy 03fef19591 An attempt to port cdparanoia-III-alpha9.7.
CD-DA extraction tool with excessive data corrections,
such as jitter, loss of data, etc.

This will soon be obsoleted by cdparanoia IV, I hope....

Most SCSI/ATAPI CD-ROM drives should work fine.
However, the ATAPI stuff is totally untested, and
if it happened to work, it was a miracle. :-)

Currently,
  - the feature to search for CD-ROM device is not
    implemented and the -g option is required,
  - the libraries are not installed.
2000-01-19 08:03:00 +00:00

89 lines
2.2 KiB
Text

$NetBSD: patch-cd,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
--- interface/common_interface.c.orig Tue Dec 14 13:28:00 1999
+++ interface/common_interface.c Sat Jan 15 16:55:18 2000
@@ -13,19 +13,29 @@
#include "utils.h"
#include "smallft.h"
+#ifdef __linux__
#include <linux/hdreg.h>
+#endif
/* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
int ioctl_ping_cdrom(int fd){
+#ifdef __linux__
struct cdrom_volctrl volctl;
if (ioctl(fd, CDROMVOLREAD, &volctl))
return(1); /* failure */
+#endif
+#ifdef __NetBSD__
+ struct ioc_vol volctl;
+ if (ioctl(fd, CDIOCGETVOL, &volctl))
+ return(1); /* failure */
+#endif
return(0);
/* success! */
}
+#ifdef __linux__
/* Use the ioctl thingy above ping the cdrom; this will get model info */
char *atapi_drive_info(int fd){
/* Work around the fact that the struct grew without warning in
@@ -46,6 +56,7 @@
free(id);
return(ret);
}
+#endif
int data_bigendianp(cdrom_drive *d){
float lsb_votes=0;
@@ -171,7 +182,9 @@
knows the leasoud/leadin size. */
int FixupTOC(cdrom_drive *d,int tracks){
+#ifdef __linux__
struct cdrom_multisession ms_str;
+#endif
int j;
/* First off, make sure the 'starting sector' is >=0 */
@@ -209,13 +222,24 @@
CDROM device, not the generic device. */
if (d->ioctl_fd != -1) {
+#ifdef __linux__
int result;
ms_str.addr_format = CDROM_LBA;
result = ioctl(d->ioctl_fd, CDROMMULTISESSION, &ms_str);
if (result == -1) return -1;
+# define ms_addr (ms_str.addr.lba)
+#endif
+
+#ifdef __NetBSD__
+ int ms_addr;
+
+ ms_addr = 0; /* last session */
+ if (ioctl(d->ioctl_fd, CDIOREADMSADDR, &ms_addr) == -1)
+ return -1;
+#endif
- if (ms_str.addr.lba > 100) {
+ if (ms_addr > 100) {
/* This is an odd little piece of code --Monty */
@@ -223,8 +247,8 @@
/* adjust end of last audio track to be in the first session */
for (j = tracks-1; j >= 0; j--) {
if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) {
- if (d->disc_toc[j].dwStartSector > ms_str.addr.lba - 11400)
- d->disc_toc[j].dwStartSector = ms_str.addr.lba - 11400;
+ if (d->disc_toc[j].dwStartSector > ms_addr - 11400)
+ d->disc_toc[j].dwStartSector = ms_addr - 11400;
break;
}
}