Skip to main content

cc_data/decode/
mod.rs

1//! CEA-608 / CEA-708 caption **decode** — the meaning of the caption byte pairs
2//! that the [`crate::CcData`] carriage demuxes out of `cc_data()`.
3//!
4//! This layer sits above the carriage ([ETSI TS 101 154 Table B.9](crate)) and
5//! interprets the line-21 (CEA-608) and DTVCC (CEA-708) byte streams into a
6//! caption screen / window model whose displayed text can be extracted.
7//!
8//! - [`Cea608Decoder`] — fed the 608 byte-pairs (`cc_type` 0 = field 1, 1 =
9//!   field 2). Decodes the line-21 control-code state machine per ANSI/CTA-608-E
10//!   (`cc-data/docs/decode/cea608-decode.md`): pop-on (RCL/EOC), roll-up
11//!   (RU2/RU3/RU4/CR), paint-on (RDC), PACs, mid-row codes, the standard /
12//!   special / extended Western-European character sets, tab offsets, the four
13//!   data channels CC1–CC4, with control-code doubling and field-2 XDS skip.
14//! - [`Cea708Decoder`] — fed the DTVCC `cc_data` bytes. Reassembles caption
15//!   channel packets, parses service blocks, and runs the C0/C1/G0/G1/G2/G3
16//!   command interpreter — the window and pen model — per ANSI/CTA-708-E
17//!   (`cc-data/docs/decode/cea708-decode.md`) and the 47 CFR §79.102 conformance
18//!   model (`cea708-conformance.md`). Exposes the six services' window text.
19//!
20//! The shared caption display model — typed colour / opacity / edge / font
21//! enumerations ([`Color`], [`Opacity`], [`EdgeType`], [`FontStyle`], …) — is
22//! re-exported here, per the conformance model.
23//!
24//! Decoders are **one-way** (bytes → caption state) and **panic-free** on
25//! arbitrary input: malformed / truncated / over-length byte streams are ignored
26//! rather than panicking.
27
28mod cea608;
29mod cea708;
30mod screen;
31
32pub use cea608::{
33    Cea608Channel, Cea608Color, Cea608Decoder, Cea608Mode, Cea608Row, Cea608Screen,
34    Cea608StyledChar,
35};
36pub use cea708::{AnchorPoint, Cea708Decoder, Window, WindowState};
37pub use screen::{
38    Color, EdgeType, FontStyle, Justify, Opacity, PenOffset, PenSize, PrintDirection,
39    ScrollDirection,
40};