AccurateRip IDs module

Calculate and manage AccurateRip identifier.

ARId is an AccurateRip identifier. It determines the request URL for an album and as well its canonical savefile name. ARIds are constructed by other IDs and metadata like offsets and track count. As a convenience, functions make_arid() construct the ARId of an album by its ToC.

Classes

class arcstk::v_1_0_0::ARId
AccurateRip-Identifier of a compact disc.

Functions

auto make_arid(const std::vector<AudioSize>& offsets, const AudioSize& leadout) -> std::unique_ptr<ARId>
Create an ARId from the toc data.
auto make_arid(const ToC& toc) -> std::unique_ptr<ARId>
Create an ARId from a complete() ToC.
auto make_arid(const ToC& toc, const AudioSize& leadout) -> std::unique_ptr<ARId>
Create an ARId from a ToC and a specified leadout.
auto make_empty_arid() -> std::unique_ptr<ARId> noexcept
Safely create an empty() ARId.

Variables

const ARId EmptyARId
Global instance of an empty ARId.

Function documentation

std::unique_ptr<ARId> make_arid(const std::vector<AudioSize>& offsets, const AudioSize& leadout)

Create an ARId from the toc data.

Parameters
offsets in Offsets
leadout in Leadout
Returns ARId

std::unique_ptr<ARId> make_arid(const ToC& toc)

Create an ARId from a complete() ToC.

Parameters
toc in ToC to use
Returns ARId corresponding to the input ToC
Exceptions
InvalidMetadataException If toc is not complete().

The toc is validated.

std::unique_ptr<ARId> make_arid(const ToC& toc, const AudioSize& leadout)

Create an ARId from a ToC and a specified leadout.

Parameters
toc in ToC to use
leadout in Leadout LBA frame
Returns ARId
Exceptions
InvalidMetadataException If toc and leadout are inconsistent

The input is validated.

Parameter toc is allowed to be non-complete(). Parameter leadout is intended to provide the value possibly missing in toc.

If leadout is 0, toc.leadout() is used and leadout is ignored. If leadout is not 0, toc.leadout() is ignored. If both values are 0 an InvalidMetadataException is thrown.

If leadout is 0 and toc cannot be validated, an InvalidMetadataException is thrown. If leadout is not 0 and leadout and toc cannot be validated as consistent with each other, an InvalidMetadataException is thrown.

std::unique_ptr<ARId> make_empty_arid() noexcept

Safely create an empty() ARId.

Returns An empty ARId

The implementation of make_empty_arid() defines emptiness for ARIds.

An empty ARId has the invalid value 0 for the track count and also 0 for disc id 1, disc id 2 and cddb id. An empty ARId is not a valid description of a CDDA medium.

Building an empty ARId also provides the possibility to just provide an ARId on sites where an ARId is required without having to test for null.

It may help provide an uniforming implementation of cases where an ARId in fact is expected but cannot be provided due to missing data, e.g. when processing single tracks without knowing the offset.

Variable documentation

const ARId EmptyARId

Global instance of an empty ARId.

This is for convenience since in most cases, the creation of an empty ARId can be avoided when a reference instance is at hand.

The instance is created using make_empty_arid().