diff options
author | Nick Peskett <rockbox@peskett.co.uk> | 2022-04-07 09:08:50 +0000 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-04-07 20:10:19 -0400 |
commit | db55d30372a6f2f257f1c65948451db0854c34d4 (patch) | |
tree | 44cedafe57deb3fa1f8cf053351702c7a38eada9 | |
parent | d1be73cfc0a9029d5e4be9f780e7d3fb2a812d07 (diff) | |
download | rockbox-db55d30372a6f2f257f1c65948451db0854c34d4.tar.gz rockbox-db55d30372a6f2f257f1c65948451db0854c34d4.zip |
Allow cuesheet index offsets longer than 99 minutes.
While the track number is limited to 99, I know of no documented
constraint on the value of offset minutes to 99.
As we are storing the millisecond offset as unsigned long, assuming
32 bit, we can allow 70,000 minutes (2^32 / 60000).
However, I've been unable to generate a test audio file 48 days long
under 2GB, so I've set the limit to 30,000 minutes.
In addition, this change reduces the maximum number of seconds to 59,
and frames to 74.
I've generated some silent test files with the filenames being
cue_[minutes].mp3
http://peskett.co.uk/rockbox/test_cues/
Change-Id: I3ca4468ebc88ba134c4e785e9395f90bf76941ac
-rw-r--r-- | apps/cuesheet.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c index a9169d4494..98040f9992 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c | |||
@@ -123,6 +123,7 @@ static unsigned long parse_cue_index(const char *line) | |||
123 | /* assumes strncmp(line, "INDEX 01", 8) & NULL terminated string */ | 123 | /* assumes strncmp(line, "INDEX 01", 8) & NULL terminated string */ |
124 | /* INDEX 01 MM:SS:FF\0 (00:00:00\0 - 99:99:99\0)*/ | 124 | /* INDEX 01 MM:SS:FF\0 (00:00:00\0 - 99:99:99\0)*/ |
125 | const unsigned field_m[3] = {60 * 1000, 1000, 13}; /* MM:SS:~FF*/ | 125 | const unsigned field_m[3] = {60 * 1000, 1000, 13}; /* MM:SS:~FF*/ |
126 | const unsigned field_max[3] = {30000, 59, 74}; /* MM, SS, FF */ | ||
126 | const char f_sep = ':'; | 127 | const char f_sep = ':'; |
127 | int field = -1; | 128 | int field = -1; |
128 | unsigned long offset = 0; /* ms from start of track */ | 129 | unsigned long offset = 0; /* ms from start of track */ |
@@ -138,7 +139,7 @@ static unsigned long parse_cue_index(const char *line) | |||
138 | while (isdigit(*line)) | 139 | while (isdigit(*line)) |
139 | { | 140 | { |
140 | value = 10 * value + (*line - '0'); | 141 | value = 10 * value + (*line - '0'); |
141 | if (value > 99) /* Sanity check bail early */ | 142 | if (value > field_max[field]) /* Sanity check bail early */ |
142 | return 0; | 143 | return 0; |
143 | line++; | 144 | line++; |
144 | } | 145 | } |