checkimg, distill: A couple of scripts useful for testing and debugging.
[dvdrip] / distill
diff --git a/distill b/distill
new file mode 100755 (executable)
index 0000000..31793fd
--- /dev/null
+++ b/distill
@@ -0,0 +1,17 @@
+#! /usr/bin/perl
+
+use autodie;
+
+my $ZERO = "\0" x 2048;
+for my $f (@ARGV) {
+  open my $fh, "<", $f; binmode $fh;
+  my $buf;
+  my $i = 0;
+  SECTOR: for (;;) {
+    my $n = read $fh, $buf, 2048; last SECTOR if $n < 2048;
+    my $head;
+    if ($buf eq $ZERO) { $head = "---"; }
+    else { $head = unpack "H*", substr $buf, 0, 16; }
+    printf "%8d: %s\n", $i++, $head;
+  }
+}