[xiph-commits] r15220 - in trunk/cdparanoia: interface paranoia

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sat Aug 30 02:06:34 PDT 2008


Author: xiphmont
Date: 2008-08-30 02:06:33 -0700 (Sat, 30 Aug 2008)
New Revision: 15220

Modified:
   trunk/cdparanoia/interface/cdda_interface.h
   trunk/cdparanoia/interface/interface.c
   trunk/cdparanoia/interface/low_interface.h
   trunk/cdparanoia/paranoia/cachetest.c
Log:
correct speed setting bug in cache testing



Modified: trunk/cdparanoia/interface/cdda_interface.h
===================================================================
--- trunk/cdparanoia/interface/cdda_interface.h	2008-08-30 08:13:11 UTC (rev 15219)
+++ trunk/cdparanoia/interface/cdda_interface.h	2008-08-30 09:06:33 UTC (rev 15220)
@@ -123,6 +123,7 @@
 
 extern char *cdda_version();
 extern int cdda_speed_set(cdrom_drive *d, int speed);
+extern int cdda_speed_get(cdrom_drive *d);
 extern void cdda_verbose_set(cdrom_drive *d,int err_action, int mes_action);
 extern char *cdda_messages(cdrom_drive *d);
 extern char *cdda_errors(cdrom_drive *d);

Modified: trunk/cdparanoia/interface/interface.c
===================================================================
--- trunk/cdparanoia/interface/interface.c	2008-08-30 08:13:11 UTC (rev 15219)
+++ trunk/cdparanoia/interface/interface.c	2008-08-30 09:06:33 UTC (rev 15220)
@@ -101,12 +101,21 @@
 int cdda_speed_set(cdrom_drive *d, int speed)
 {
   if(d->set_speed)
-    if(!d->set_speed(d,speed)) return 0;
+    if(!d->set_speed(d,speed)){
+      d->private->speed=speed;
+      return 0;
+    }
       
   cderror(d,"405: Option not supported by drive\n");
   return -405;
 }
 
+/* -1 is 'full speed', 0 is 'unknown' */
+int cdda_speed_get(cdrom_drive *d)
+{
+  return d->private->speed;
+}
+
 long cdda_read(cdrom_drive *d, void *buffer, long beginsector, long sectors){
   if(d->opened){
     if(sectors>0){

Modified: trunk/cdparanoia/interface/low_interface.h
===================================================================
--- trunk/cdparanoia/interface/low_interface.h	2008-08-30 08:13:11 UTC (rev 15219)
+++ trunk/cdparanoia/interface/low_interface.h	2008-08-30 09:06:33 UTC (rev 15220)
@@ -102,6 +102,7 @@
   unsigned char *sg_buffer; /* points into sg_hd */
   clockid_t clock;
   int last_milliseconds;
+  int speed;
 
   int  (*cache_clear)  (struct cdrom_drive *d, int lba, int sectors);
 };

Modified: trunk/cdparanoia/paranoia/cachetest.c
===================================================================
--- trunk/cdparanoia/paranoia/cachetest.c	2008-08-30 08:13:11 UTC (rev 15219)
+++ trunk/cdparanoia/paranoia/cachetest.c	2008-08-30 09:06:33 UTC (rev 15220)
@@ -78,6 +78,8 @@
   int rollbehind;
   int cachegran;
   float waypoint[10]={-1,-1,-1,-1, -1,-1,-1,-1, -1,-1};
+  int speed = cdda_speed_get(d);
+  if(speed<=0)speed=-1;
 
   /* set up a default pessimal take on drive behavior */
   //d->private->cache_backseekflush=0;
@@ -313,7 +315,18 @@
     reportC("\tDrive does not cache nonlinear access                            \n");
     return 0;
   }
-   
+  
+  if(speed==-1){
+    logC("\tAttempting to reset read speed to full... ");
+  }else{
+    logC("\tAttempting to reset read speed to %d... ",speed);
+  }
+  if(cdda_speed_set(d,speed)){
+    logC("failed.\n");
+  }else{
+    logC("drive said OK\n");
+  }
+
   /* The readahead cache size ascertained above is likely qualified by
      background 'rollahead'; that is, the drive's readahead process is
      often working ahead of our actual linear reads, and if reads stop



More information about the commits mailing list