summaryrefslogtreecommitdiff
path: root/media-sound/shntool/files/shntool-3.0.10-fix_24bits.patch
blob: 4c3e5a21d7bdfaf60725ee2e7c1b6d1130b479c9 (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
patch from upstream
https://github.com/bayun/shntool/commit/4ca41f4.patch
Fix for mm:ss:ff on non-CD-quality files
fix also https://bugs.gentoo.org/965875
--- a/src/core_mode.c
+++ b/src/core_mode.c
@@ -346,7 +346,7 @@ static wlong is_m_ss_ff(unsigned char *buf,wave_info *info)
   *dot = 0;
 
   if (PROB_NOT_CD(info))
-    st_error("m:ss.ff format can only be used with CD-quality files");
+    st_warning("m:ss.ff format can only be used with CD-quality files");
 
   min = atoi((const char *)buf);
   sec = atoi((const char *)(colon+1));
@@ -358,10 +358,10 @@ static wlong is_m_ss_ff(unsigned char *buf,wave_info *info)
   if (frames >= 75)
     st_error("invalid value for frames: [%d]",frames);
 
-  bytes = (wlong)(min * CD_RATE * 60) +
-          (wlong)(sec * CD_RATE) +
-          (wlong)(frames * CD_BLOCK_SIZE);
-
+  int rate = info->bits_per_sample / 8 * info->channels * info->samples_per_sec;
+  bytes = (wlong)(min * rate * 60) +
+          (wlong)(sec * rate) +
+          (wlong)(frames * rate / 75);
   return bytes;
 }