Expand description
SegmentTemplate identifier scanning and substitution (ISO/IEC 23009-1
5.3.9.4.4, Table 21).
The scan is strict: a $ that does not enclose a known identifier makes
the whole template invalid, which the spec resolves by dropping the
containing Representation (5.3.9.4.4 step 2). Format tags are %0<width>d
only. Substitution reads the same scanned parts the validator builds, so a
width is clamped once (to MAX_FORMAT_WIDTH) and $$ is read once.
Structs§
- Template
Match - The identifiers a URL was matched against a template: the exact inverse of
substitute. - Template
Use - Which identifiers a template contains.
Enums§
- Template
Error - Why
substitutecould not render a URL. - Template
Fault - Why a template is invalid.
Constants§
- MAX_
FORMAT_ WIDTH - Cap on the
%0Ndzero-padding width in a$Number$,$Time$or$Bandwidth$substitution. Au64in decimal has at most 20 digits, so a wider padding is meaningless and a hostile$Number%9999999999d$would allocate or loop unboundedly.
Functions§
- format_
width nzero-padded towidthdigits (5.3.9.4.4%0<width>d), the width clamped to1..=MAX_FORMAT_WIDTH.- match_
url - Recover the identifiers that
substitutewould have rendered asurl. - scan
- Scan
templateand report the identifiers it uses. - scan_
initialization - Validate an initialization template: neither
$Number$nor$Time$. - scan_
media - Validate a media/index template: exactly one of
$Number$/$Time$. - substitute
- Substitute the identifiers of an already scanned template.