[Paranoia-dev] [patch] cdparanoia sample offset inconsistency

Eric Lesage erl-dev at altus.qc.ca
Fri Dec 11 00:31:40 PST 2009


Hello,

Apologies if this is a duplicate. I've sent a previous version to the list 
but it appears it did not get through. The version of the patch included 
herein is better anyway.

I've encountered a problem when using the -O (--sample-offset) option. 
Currently, the code checks whether the specified offset is more than 588 
samples, and if so biases the sectors in the (internal) TOC so that the 
offset becomes less than 588.

However, this creates an inconsistency when the span is analyzed: the span 
might both refer to (corrected) values from the TOC (e.g. end of disk) and 
uncorrected values (e.g. absolute sector positions).

E.g.: [.2000]- (read from sector 2000 to end of disk).

The included patch fixes this by adding the offset in sectors specified 
using absolute positions.

Best regards,

-- 
Eric Lesage
-------------- next part --------------
Index: interface/cdda_interface.h
===================================================================
--- interface/cdda_interface.h	(revision 16745)
+++ interface/cdda_interface.h	(working copy)
@@ -66,6 +66,8 @@
   long audio_first_sector;
   long audio_last_sector;
 
+  long manual_sector_offset; /* Offset in sectors specified by user with -O */
+
   int errordest;
   int messagedest;
   char *errorbuf;
Index: interface/toc.c
===================================================================
--- interface/toc.c	(revision 16745)
+++ interface/toc.c	(working copy)
@@ -23,7 +23,9 @@
       return(-401);
     }
     else {
-      return 0; /* pre-gap of first track always starts at lba 0 */
+      return d->manual_sector_offset; /* pre-gap of first track always starts
+	                               * at lba 0 (but we need to account for
+				       * manual correction) */
     }
   }
 
@@ -45,7 +47,7 @@
   for(i=0;i<d->tracks;i++)
     if(cdda_track_audiop(d,i+1)==1) {
       if (i == 0) /* disc starts at lba 0 if first track is an audio track */
-       return 0;
+       return d->manual_sector_offset; /* account for manual correction */
       else
        return(cdda_track_firstsector(d,i+1));
     }
Index: main.c
===================================================================
--- main.c	(revision 16745)
+++ main.c	(working copy)
@@ -1087,6 +1087,9 @@
     }
   }
 
+  /* Save it to report correct offsets later. */
+  d->manual_sector_offset = toc_offset;
+
   if(toc_bias){
     toc_offset=-cdda_track_firstsector(d,1);
   }


More information about the Paranoia-dev mailing list