aboutsummaryrefslogtreecommitdiff
path: root/audio/mkcue/fix_msf_offset.diff
blob: ccebb70b02d957256f047fae38d3e33e130214b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: Don't assume MSF offset is always 150 (#439790)
Author: Martin Michlmayr <tbm@cyrius.com>
Last-Update: 2007-10-21
Index: mkcue-1/mkcue.cc
===================================================================
--- mkcue-1.orig/mkcue.cc	2004-10-27 07:20:30.000000000 +0100
+++ mkcue-1/mkcue.cc	2012-11-10 13:34:34.986131069 +0000
@@ -12,6 +12,9 @@
 
 #include "diskid.h"
 
+/* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439790 */
+#define MSF_OFFSET 150
+
 void
 DiskId::ReportError(char *err)
 {
@@ -54,16 +57,12 @@
     }
 
     puts("FILE \"dummy.wav\" WAVE");
-    puts("  TRACK 01 AUDIO");
-    puts("    INDEX 01 00:00:00");
 
 #define min(x, y) ((x) < (y) ? (x) : (y))
-    for (track = cdinfo.FirstTrack + 1;
+    for (track = cdinfo.FirstTrack;
          track <= min(trackcount, cdinfo.LastTrack);
          track++) {
-        /* There is frequently (always?) an offset of 150 sectors, so
-         * subtract the first track's offset. */
-        cdinfo.FrameOffset[track] -= cdinfo.FrameOffset[1];
+        cdinfo.FrameOffset[track] -= MSF_OFFSET;
 
         minutes = seconds = sectors = 0;
         sectors = cdinfo.FrameOffset[track] % 75;
@@ -76,6 +75,9 @@
         }
 
         printf("  TRACK %02d AUDIO\n", track);
+        if (track == 1 && cdinfo.FrameOffset[track] > 0) {
+            printf("    INDEX 00 00:00:00\n");
+        }
         printf("    INDEX 01 %02d:%02d:%02d\n", minutes, seconds, sectors);
     }