[SCM] morituri/master: * examples/ARcue.py: * morituri/common/checksum.py: * morituri/image/image.py: * morituri/image/toc.py: * examples/gtkchecksum.py (added): * examples/gtkcrc.py (deleted): More crc->checksum changes.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:08:47 UTC 2014


The following commit has been merged in the master branch:
commit 587f1a45ddda7f52282ad96f423c05f4790bc5c7
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Wed Apr 15 13:39:16 2009 +0000

    	* examples/ARcue.py:
    	* morituri/common/checksum.py:
    	* morituri/image/image.py:
    	* morituri/image/toc.py:
    	* examples/gtkchecksum.py (added):
    	* examples/gtkcrc.py (deleted):
    	  More crc->checksum changes.

diff --git a/ChangeLog b/ChangeLog
index 76a7dd0..cd40d10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,16 @@
 	* examples/ARcue.py:
 	* morituri/common/checksum.py:
 	* morituri/image/image.py:
+	* morituri/image/toc.py:
+	* examples/gtkchecksum.py (added):
+	* examples/gtkcrc.py (deleted):
+	  More crc->checksum changes.
+
+2009-04-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* examples/ARcue.py:
+	* morituri/common/checksum.py:
+	* morituri/image/image.py:
 	* morituri/test/test_image_image.py:
 	  Change crc to checksum everywhere.
 
diff --git a/examples/ARcue.py b/examples/ARcue.py
index 52dd2bc..28f9e1d 100644
--- a/examples/ARcue.py
+++ b/examples/ARcue.py
@@ -117,7 +117,8 @@ def main(argv):
                     response = r
                 else:
                     assert r == response, \
-                        "CRC %s for %d matches wrong response %d, checksum %s" % (
+                        "checksum %s for %d matches wrong response %d, "\
+                        "checksum %s" % (
                             checksum, i + 1, j + 1, response.checksums[i])
                 status = 'rip accurate    '
                 archecksum = checksum
@@ -133,8 +134,8 @@ def main(argv):
                 if confidence < maxConfidence:
                     c = "(confidence %3d of %3d)" % (confidence, maxConfidence)
 
-            ar = " AR [%s]" % response.checksums[i]
-        print "Track %2d: %s %s mine [%08x] %s" % (
+            ar = ", AR [%s]" % response.checksums[i]
+        print "Track %2d: %s %s [%08x]%s" % (
             i + 1, status, c, checksum, ar)
 
 
diff --git a/examples/gtkcrc.py b/examples/gtkchecksum.py
similarity index 100%
rename from examples/gtkcrc.py
rename to examples/gtkchecksum.py
diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py
index ecb78a9..fe457c4 100644
--- a/morituri/common/checksum.py
+++ b/morituri/common/checksum.py
@@ -32,9 +32,9 @@ from morituri.common import task
 
 # checksums are not CRC's. a CRC is a specific type of checksum.
 
-FRAMES_PER_DISC_FRAME = 588
-SAMPLES_PER_DISC_FRAME = FRAMES_PER_DISC_FRAME * 4
-DISC_FRAMES_PER_SECOND = 75
+SAMPLES_PER_FRAME = 588
+BYTES_PER_FRAME = SAMPLES_PER_FRAME * 4
+FRAMES_PER_SECOND = 75
 
 class ChecksumTask(task.Task):
     """
@@ -104,8 +104,8 @@ class ChecksumTask(task.Task):
             gst.SEEK_TYPE_SET, self._frameStart,
             gst.SEEK_TYPE_SET, self._frameEnd + 1) # half-inclusive interval
         gst.debug('CRCing %s from sector %d to sector %d' % (
-            self._path, self._frameStart / FRAMES_PER_DISC_FRAME,
-            (self._frameEnd + 1) / FRAMES_PER_DISC_FRAME))
+            self._path, self._frameStart / SAMPLES_PER_FRAME,
+            (self._frameEnd + 1) / SAMPLES_PER_FRAME))
         # FIXME: sending it with frameEnd set screws up the seek, we don't get
         # everything for flac; fixed in recent -good
         result = sink.send_event(event)
@@ -143,9 +143,9 @@ class ChecksumTask(task.Task):
         # see http://bugzilla.gnome.org/show_bug.cgi?id=576505
         self._adapter.push(buffer)
 
-        while self._adapter.available() >= SAMPLES_PER_DISC_FRAME:
+        while self._adapter.available() >= BYTES_PER_FRAME:
             # FIXME: in 0.10.14.1, take_buffer leaks a ref
-            buffer = self._adapter.take_buffer(SAMPLES_PER_DISC_FRAME)
+            buffer = self._adapter.take_buffer(BYTES_PER_FRAME)
 
             self._checksum = self.do_checksum_buffer(buffer, self._checksum)
             self._bytes += len(buffer)
@@ -224,13 +224,13 @@ class AccurateRipChecksumTask(ChecksumTask):
             # ... on 5th frame, only use last value
             elif self._discFrameCounter == 5:
                 values = struct.unpack("<I", buffer[-4:])
-                checksum += FRAMES_PER_DISC_FRAME * 5 * values[0]
+                checksum += SAMPLES_PER_FRAME * 5 * values[0]
                 checksum &= 0xFFFFFFFF
                 return checksum
  
         # on last track, skip last 5 CD frames
         if self._trackNumber == self._trackCount:
-            discFrameLength = self._frameLength / FRAMES_PER_DISC_FRAME
+            discFrameLength = self._frameLength / SAMPLES_PER_FRAME
             if self._discFrameCounter > discFrameLength - 5:
                 self.debug('skipping frame %d' % self._discFrameCounter)
                 return checksum
@@ -242,9 +242,9 @@ class AccurateRipChecksumTask(ChecksumTask):
             sum += (self._bytes / 4 + i + 1) * value
             sum &= 0xFFFFFFFF
             # offset = self._bytes / 4 + i + 1
-            # if offset % FRAMES_PER_DISC_FRAME == 0:
+            # if offset % SAMPLES_PER_FRAME == 0:
             #    print 'THOMAS: frame %d, ends before %d, last value %08x, CRC %08x' % (
-            #        offset / FRAMES_PER_DISC_FRAME, offset, value, sum)
+            #        offset / SAMPLES_PER_FRAME, offset, value, sum)
 
         checksum += sum
         checksum &= 0xFFFFFFFF
diff --git a/morituri/image/image.py b/morituri/image/image.py
index dcc0a64..6ac0b36 100644
--- a/morituri/image/image.py
+++ b/morituri/image/image.py
@@ -171,8 +171,8 @@ class AccurateRipChecksumTask(MultiTask):
             path = image.getRealPath(file.path)
             checksumTask = checksum.AccurateRipChecksumTask(path,
                 trackNumber=trackIndex + 1, trackCount=len(cue.tracks),
-                frameStart=offset * checksum.FRAMES_PER_DISC_FRAME,
-                frameLength=length * checksum.FRAMES_PER_DISC_FRAME)
+                frameStart=offset * checksum.SAMPLES_PER_FRAME,
+                frameLength=length * checksum.SAMPLES_PER_FRAME)
             self.addTask(checksumTask)
 
     def stop(self):
@@ -252,8 +252,8 @@ class ImageVerifyTask(MultiTask):
             # print '%d has length %d' % (trackIndex, taskk.length)
             index = track._indexes[1]
             offset = index[0]
-            assert taskk.length % checksum.FRAMES_PER_DISC_FRAME == 0
-            end = taskk.length / checksum.FRAMES_PER_DISC_FRAME
+            assert taskk.length % checksum.SAMPLES_PER_FRAME == 0
+            end = taskk.length / checksum.SAMPLES_PER_FRAME
             self.lengths[trackIndex] = end - offset
 
         MultiTask.stop(self)
diff --git a/morituri/image/toc.py b/morituri/image/toc.py
index 3312ea2..92584fe 100644
--- a/morituri/image/toc.py
+++ b/morituri/image/toc.py
@@ -134,14 +134,14 @@ class TOC:
             # CD's have a standard lead-in time of 2 seconds
             # which gets added for CDDB disc id's
             offset = self.getTrackStart(track.number) + \
-                2 * checksum.DISC_FRAMES_PER_SECOND
-            seconds = offset / checksum.DISC_FRAMES_PER_SECOND
+                2 * checksum.FRAMES_PER_SECOND
+            seconds = offset / checksum.FRAMES_PER_SECOND
             n += self._cddbSum(seconds)
 
         last = self.tracks[-1]
         leadout = self.getTrackEnd(last.number)
         frameLength = leadout - self.getTrackStart(1)
-        t = frameLength / checksum.DISC_FRAMES_PER_SECOND
+        t = frameLength / checksum.FRAMES_PER_SECOND
 
         value = (n % 0xff) << 24 | t << 8 | len(self.tracks)
         

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list