Skip to main content

timed_metadata/
lib.rs

1//! Timed-metadata / DPI signalling conversion core.
2//!
3//! Translates SCTE-35 splice information to the carriages used in OTT
4//! delivery: HLS `EXT-X-DATERANGE` (RFC 8216 / draft-pantos-hls-rfc8216bis
5//! §4.4.5.1) and DASH `emsg` (ANSI/SCTE 214-3 §8.3.3, scheme
6//! `urn:scte:scte35:2013:bin`).
7//! The DASH `emsg` conversion is bidirectional (SCTE-35 to and from `emsg`);
8//! the HLS `EXT-X-DATERANGE` conversion is currently one-way (SCTE-35 to
9//! DATERANGE only) — the reverse edge is out of scope for now, see
10//! [`convert::scte35_to_daterange`] doc.
11//!
12//! Conversions are lossless: the original `splice_info_section` bytes are
13//! carried verbatim (DATERANGE `SCTE35-OUT` hex, emsg `message_data`).
14//!
15//! Pure functions live in [`convert`]; the stateful [`Timeline`] session adds a
16//! wall-clock [`TimeAnchor`] and 33-bit PTS wrap-unrolling.
17//!
18//! [`webvtt`] converts a different kind of timed metadata — CEA-608/708
19//! closed captions — to WebVTT cues (W3C WebVTT + RFC 8216 §3.5
20//! `X-TIMESTAMP-MAP`), feature `cc-data` for the CEA-608/708 extraction half.
21//! Lossy by design (see its module docs).
22#![no_std]
23#![forbid(unsafe_code)]
24#![cfg_attr(docsrs, feature(doc_cfg))]
25
26extern crate alloc;
27
28pub mod anchor;
29pub mod convert;
30pub mod daterange;
31pub mod error;
32pub mod event;
33pub mod timeline;
34pub mod webvtt;
35
36pub use anchor::TimeAnchor;
37pub use daterange::DateRange;
38pub use error::{Error, Result};
39pub use event::{EventKind, MediaDuration, MediaTime, SourcePayload, TimedEvent};
40pub use timeline::Timeline;
41
42/// 90 kHz — the SCTE-35 / MPEG-2 PTS clock.
43pub const PTS_HZ: u64 = 90_000;