Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 31 Jul 2007 00:47:55 +0000 (00:47 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 31 Jul 2007 00:47:55 +0000 (00:47 +0000)
doc/html/changelog.html
doc/html/format.html
src/share/grabbag/cuesheet.c

index d4a7604..4859224 100644 (file)
@@ -67,7 +67,7 @@
                        <li>
                                FLAC format:
                                <ul>
                        <li>
                                FLAC format:
                                <ul>
-                                       <li>(none)</li>
+                                       <li>The lead-out track number for non-CDDA cuesheets now must be 255.</li>
                                </ul>
                        </li>
                        <li>
                                </ul>
                        </li>
                        <li>
                                <ul>
                                        <li>Added a new option <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_utf8_convert">--no-utf8-convert</a></span> which works like it does in <span class="commandname">metaflac</span> (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=973740&amp;group_id=13478&amp;atid=363478">SF #973740</a>).</li>
                                        <li>Fixed bug where using <span class="argument">--replay-gain</span> without any padding option caused only a small PADDING block to be created (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1760790&amp;group_id=13478&amp;atid=113478">SF #1760790</a>).</li>
                                <ul>
                                        <li>Added a new option <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_utf8_convert">--no-utf8-convert</a></span> which works like it does in <span class="commandname">metaflac</span> (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=973740&amp;group_id=13478&amp;atid=363478">SF #973740</a>).</li>
                                        <li>Fixed bug where using <span class="argument">--replay-gain</span> without any padding option caused only a small PADDING block to be created (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1760790&amp;group_id=13478&amp;atid=113478">SF #1760790</a>).</li>
+                                       <li>Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1764105&amp;group_id=13478&amp;atid=113478">SF #1764105</a>).</li>
                                </ul>
                        </li>
                        <li>
                                metaflac:
                                <ul>
                                </ul>
                        </li>
                        <li>
                                metaflac:
                                <ul>
-                                       <li>(none)</li>
+                                       <li>Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1764105&amp;group_id=13478&amp;atid=113478">SF #1764105</a>).</li>
                                </ul>
                        </li>
                        <li>
                                </ul>
                        </li>
                        <li>
index e70ba1a..2a80ef0 100644 (file)
                                &lt;8&gt;
                        </td>
                        <td>
                                &lt;8&gt;
                        </td>
                        <td>
-                               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).
                        </td>
                </tr>
                <tr>
                        </td>
                </tr>
                <tr>
                                <a href="#cuesheet_track"><i>CUESHEET_TRACK</i></a>+
                        </td>
                        <td>
                                <a href="#cuesheet_track"><i>CUESHEET_TRACK</i></a>+
                        </td>
                        <td>
-                               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.
                        </td>
                </tr>
        </table>
                        </td>
                </tr>
        </table>
                                &lt;8&gt;
                        </td>
                        <td>
                                &lt;8&gt;
                        </td>
                        <td>
-                               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.
                        </td>
                </tr>
                <tr>
                        </td>
                </tr>
                <tr>
index e521552..03f7cda 100644 (file)
@@ -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;
                                }
                                        *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";
                                }
                                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) {
        }
 
        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)) {
                forced_leadout_track_offset = lead_out_offset;
        }
        if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) {