From 29008f4fb5d55571d5260538dbd5024f9f7a19b3 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 31 Jul 2007 00:47:55 +0000 Subject: [PATCH] Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number; also add requirement for non-CDDA lead-out track number to be 255 (SF#1764105: https://sourceforge.net/tracker/index.php?func=detail&aid=1764105&group_id=13478&atid=113478). --- doc/html/changelog.html | 5 +++-- doc/html/format.html | 6 +++--- src/share/grabbag/cuesheet.c | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/doc/html/changelog.html b/doc/html/changelog.html index d4a7604..4859224 100644 --- a/doc/html/changelog.html +++ b/doc/html/changelog.html @@ -67,7 +67,7 @@
  • FLAC format:
  • @@ -81,12 +81,13 @@
  • metaflac:
  • diff --git a/doc/html/format.html b/doc/html/format.html index e70ba1a..2a80ef0 100644 --- a/doc/html/format.html +++ b/doc/html/format.html @@ -790,7 +790,7 @@ <8> - The number of tracks. For CD-DA, this number must be no more than 100 (99 regular tracks and one leadout track). + The number of tracks. Must be at least 1 (because of the requisite lead-out track). For CD-DA, this number must be no more than 100 (99 regular tracks and one lead-out track). @@ -798,7 +798,7 @@ CUESHEET_TRACK+ - One or more tracks. A CUESHEET block is required to have a lead-out track; it is always the last track in the CUESHEET. For CD-DA, the lead-out track number must be 170 as specified by the Red Book. + One or more tracks. A CUESHEET block is required to have a lead-out track; it is always the last track in the CUESHEET. For CD-DA, the lead-out track number must be 170 as specified by the Red Book, otherwise is must be 255. @@ -828,7 +828,7 @@ <8> - Track number. A track number of 0 is not allowed to avoid conflicting with the CD-DA spec, which reserves this for the lead-in. For CD-DA the number must be 1-99, or 170 for the lead-out. It is not required but encouraged to start with track 1 and increase sequentially. Track numbers must be unique within a CUESHEET. + Track number. A track number of 0 is not allowed to avoid conflicting with the CD-DA spec, which reserves this for the lead-in. For CD-DA the number must be 1-99, or 170 for the lead-out; for non-CD-DA, the track number must for 255 for the lead-out. It is not required but encouraged to start with track 1 and increase sequentially. Track numbers must be unique within a CUESHEET. diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c index e521552..03f7cda 100644 --- a/src/share/grabbag/cuesheet.c +++ b/src/share/grabbag/cuesheet.c @@ -398,9 +398,21 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "TRACK number must be greater than 0"; return false; } - if(is_cdda && in_track_num > 99) { - *error_message = "CD-DA TRACK number must be between 1 and 99, inclusive"; - return false; + if(is_cdda) { + if(in_track_num > 99) { + *error_message = "CD-DA TRACK number must be between 1 and 99, inclusive"; + return false; + } + } + else { + if(in_track_num == 255) { + *error_message = "TRACK number 255 is reserved for the lead-out"; + return false; + } + else if(in_track_num > 255) { + *error_message = "TRACK number must be between 1 and 254, inclusive"; + return false; + } } if(is_cdda && cs->num_tracks > 0 && in_track_num != cs->tracks[cs->num_tracks-1].number + 1) { *error_message = "CD-DA TRACK numbers must be sequential"; @@ -503,7 +515,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, } if(!has_forced_leadout) { - forced_leadout_track_num = is_cdda? 170 : cs->num_tracks; + forced_leadout_track_num = is_cdda? 170 : 255; forced_leadout_track_offset = lead_out_offset; } if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) { -- 2.7.4