class final
#include <identifier.hpp>
v_1_0_0::TOC Table of contents of a compact disc.
A TOC contains the total number of tracks, their offsets and optionally their lengths, their filenames and the index of the leadout frame. Offsets and lengths are represented in LBA frames.
A TOC is an object constructed from parsed data. It is therefore not modifiable.
TOCs can exclusively be built by build functions called make_
Although an existing TOC is therefore always valid it might not be complete() i.e. it may lack information about the absolute size of the audio part and therefore no leadout information.
In some cases it may be reasonable to construct an incomplete TOC, i.e. a TOC without a leadout offset. Some toc formats (as for example CueSheet) may not provide the leadout but the parsed metadata is required. In this case, the leadout can be obtained from the actual audio data. However, also an incomplete TOC may never be inconsistent.
Constructors, destructors, conversion operators
Public functions
- auto complete() const -> bool noexcept
- Return
TRUE
iff TOC information is complete, otherwise FALSE. - auto filename(const TrackNo idx) const -> std::string
- Return the file of the 1-based specified track, i.e.
file(i)
is the offset for tracki
iffi
is a valid track number in this TOC. -
auto leadout() const -> lba_
count_ t noexcept - Return the leadout frame LBA address.
-
auto offset(const TrackNo idx) const -> lba_
count_ t - Return the offset of the 1-based specified track in frames, i.e.
offsets(i)
is the offset for tracki
iffi
is a valid track number in this TOC, otherwise 0. -
auto parsed_length(const TrackNo idx) const -> lba_
count_ t - Return the length of the 1-based specified track in frames as parsed from the toc metadata input.
- auto total_tracks() const -> int noexcept
- Return the total number of tracks.
-
void update(const lba_
count_ t leadout) - Updates the leadout iff
leadout
validates.
Function documentation
std::string arcstk:: v_1_0_0:: TOC:: filename(const TrackNo idx) const
Return the file of the 1-based specified track, i.e. file(i)
is the offset for track i
iff i
is a valid track number in this TOC.
Parameters | |
---|---|
idx in | 1-based track number |
Returns | File of specified track |
If all tracks are part of the same file, a call of file(i)
will yield a string with identical content for any i
.
If the file for this track is not specified, an empty string is returned.
lba_ count_ t arcstk:: v_1_0_0:: TOC:: leadout() const noexcept
Return the leadout frame LBA address.
Returns | The leadout frame index |
---|
Should be either 0 if unknown, or, if known, equal to the sum of offset(total_tracks())
and length(total_tracks())
.
lba_ count_ t arcstk:: v_1_0_0:: TOC:: offset(const TrackNo idx) const
Return the offset of the 1-based specified track in frames, i.e. offsets(i)
is the offset for track i
iff i
is a valid track number in this TOC, otherwise 0.
Parameters | |
---|---|
idx in | 1-based track number |
Returns | Offset of specified track |
lba_ count_ t arcstk:: v_1_0_0:: TOC:: parsed_length(const TrackNo idx) const
Return the length of the 1-based specified track in frames as parsed from the toc metadata input.
Parameters | |
---|---|
idx in | 1-based track number |
Returns | Length of specified track |
If the length for this track is not known, 0 is returned.
int arcstk:: v_1_0_0:: TOC:: total_tracks() const noexcept
Return the total number of tracks.
Returns | Number of tracks |
---|
void arcstk:: v_1_0_0:: TOC:: update(const lba_ count_ t leadout)
Updates the leadout iff leadout
validates.
Parameters | |
---|---|
leadout in | The new leadout to update the TOC with |
Exceptions | |
InvalidMetadateException | iff validation fails |
If leadout
does not validate against the existing values, an InvalidMetadataException is thrown.