Compact Disc and Audio Metadata module

ToC metadata and input size of the audio files.

A ToC is the table of content information from a compact disc. It contains the track offsets and optionally the leadout of the compact disc. ToCs that contain not only the offsets but also the leadout are complete.

ToCData is a minimalistic version of a ToC: an aggregate that contains the leadout at index 0 and on the subsequent index positions 1..n the offets of the respective tracks. Hence, ToCData contains all and only the data that is required to calculate AccurateRip checksums.

AudioSize is a representation of an amount of audio information that can be evaluated as frames, samples or bytes. Passing AudioSize objects helps to avoid accidentally calculating with the wrong unit, e.g. w/ samples when frames are required.

CDDA provides a set of cdda related constants that are used on validating and parsing audio information.

An InvalidMetadataException indicates that no valid ToC can be constructed from the input provided.

A NonstandardMetadataException indicates that the input is not conforming to the redbook standard.

Namespaces

namespace arcstk::v_1_0_0::toc
Functions for managing ToCData instances.

Classes

class arcstk::v_1_0_0::AudioSize
Uniform access to the size of the input audio information.
struct arcstk::v_1_0_0::CDDA
Constants related to the CDDA format.
class arcstk::v_1_0_0::InvalidMetadataException
Reports invalid metadata for constructing a ToC.
class arcstk::v_1_0_0::ToC
Table of contents of a compact disc.

Enums

enum class UNIT: int { FRAMES = 1, SAMPLES = CDDA::SAMPLES_PER_FRAME, BYTES = CDDA::BYTES_PER_FRAME }
Represents an audio unit.

Typedefs

using ToCData = std::vector<AudioSize>
ToC data from a file, e.g. offsets and leadout.

Functions

template<enum UNIT F, enum UNIT T>
auto convert(const int32_t amount) -> int32_t constexpr
Convert from UNIT F to UNIT T.
template<enum UNIT U>
auto convert(const std::vector<AudioSize>& values) -> std::vector<int32_t>
Convert a vector of AudioSize instances to the specified UNIT.
template<enum UNIT U>
auto convert_to(const AudioSize& v) -> int32_t
Convert an AudioSize to the specified UNIT.
auto make_toc(const int32_t leadout, const std::vector<int32_t>& offsets) -> std::unique_ptr<ToC>
Create a ToC from leadout and offsets.
auto make_toc(const int32_t leadout, const std::vector<int32_t>& offsets, const std::vector<std::string>& filenames) -> std::unique_ptr<ToC>
Create a ToC from leadout, offsets and filenames.
auto make_toc(const std::vector<int32_t>& offsets) -> std::unique_ptr<ToC>
Create a ToC from offsets.
auto make_toc(const std::vector<int32_t>& offsets, const std::vector<std::string>& filenames) -> std::unique_ptr<ToC>
Create a ToC from offsets and filenames.

Variables

template<enum UNIT U>
int32_t cdda_max constexpr
Maximum value for the specified UNIT according to CDDA.
const AudioSize EmptyAudioSize
Empty AudioSize.

Enum documentation

enum class UNIT: int

Represents an audio unit.

Units are frames, samples or bytes.

Typedef documentation

typedef std::vector<AudioSize> ToCData

ToC data from a file, e.g. offsets and leadout.

Leadout is on index 0, followed by the sequence of offsets. Offset indices therefore correspond to track numbers, i.e. index 7 is offset of track 7.

It is guaranteed to be iterable and accessible by operator [].

Function documentation

template<enum UNIT F, enum UNIT T>
int32_t convert(const int32_t amount) constexpr

Convert from UNIT F to UNIT T.

Template parameters
F The UNIT of amount to be converted
T The UNIT to convert to
Parameters
amount in The amount to convert
Returns The equivalent amount in UNIT T

Convert an amount auf UNIT F to the equivalent amount of UNIT T.

template<enum UNIT U>
std::vector<int32_t> convert(const std::vector<AudioSize>& values)

Convert a vector of AudioSize instances to the specified UNIT.

Template parameters
U The UNIT to convert to
Parameters
values in The values to convert
Returns Converted values of the specified unit

template<enum UNIT U>
int32_t convert_to(const AudioSize& v)

Convert an AudioSize to the specified UNIT.

Template parameters
U The UNIT to convert to
Parameters
in The object to convert
Returns Value of the specified unit

std::unique_ptr<ToC> make_toc(const int32_t leadout, const std::vector<int32_t>& offsets)

Create a ToC from leadout and offsets.

Parameters
leadout in Leadout frame
offsets in Offset frames

std::unique_ptr<ToC> make_toc(const int32_t leadout, const std::vector<int32_t>& offsets, const std::vector<std::string>& filenames)

Create a ToC from leadout, offsets and filenames.

Parameters
leadout in Leadout frame
offsets in Offset frames
filenames in Audio filenames

std::unique_ptr<ToC> make_toc(const std::vector<int32_t>& offsets)

Create a ToC from offsets.

Parameters
offsets in Offset frames

std::unique_ptr<ToC> make_toc(const std::vector<int32_t>& offsets, const std::vector<std::string>& filenames)

Create a ToC from offsets and filenames.

Parameters
offsets in Offset frames
filenames in Audio filenames

Variable documentation

template<enum UNIT U>
int32_t cdda_max constexpr

Maximum value for the specified UNIT according to CDDA.

Template parameters
U The UNIT the determine the maximum legal CDDA value of

const AudioSize EmptyAudioSize

Empty AudioSize.

Not necessary to create it again in your code.