Skip to main content

Module decode

Module decode 

Source
Available on crate feature decode only.
Expand description

CEA-608 / CEA-708 caption decode — the meaning of the caption byte pairs that the crate::CcData carriage demuxes out of cc_data().

This layer sits above the carriage (ETSI TS 101 154 Table B.9) and interprets the line-21 (CEA-608) and DTVCC (CEA-708) byte streams into a caption screen / window model whose displayed text can be extracted.

  • Cea608Decoder — fed the 608 byte-pairs (cc_type 0 = field 1, 1 = field 2). Decodes the line-21 control-code state machine per ANSI/CTA-608-E (cc-data/docs/decode/cea608-decode.md): pop-on (RCL/EOC), roll-up (RU2/RU3/RU4/CR), paint-on (RDC), PACs, mid-row codes, the standard / special / extended Western-European character sets, tab offsets, the four data channels CC1–CC4, with control-code doubling and field-2 XDS skip.
  • Cea708Decoder — fed the DTVCC cc_data bytes. Reassembles caption channel packets, parses service blocks, and runs the C0/C1/G0/G1/G2/G3 command interpreter — the window and pen model — per ANSI/CTA-708-E (cc-data/docs/decode/cea708-decode.md) and the 47 CFR §79.102 conformance model (cea708-conformance.md). Exposes the six services’ window text.

The shared caption display model — typed colour / opacity / edge / font enumerations (Color, Opacity, EdgeType, FontStyle, …) — is re-exported here, per the conformance model.

Decoders are one-way (bytes → caption state) and panic-free on arbitrary input: malformed / truncated / over-length byte streams are ignored rather than panicking.

Structs§

Cea608Decoder
CEA-608 (line-21) caption decoder.
Cea608Row
One row of a 608 caption screen.
Cea608Screen
A 608 caption screen — SCREEN_ROWS rows of styled cells.
Cea608StyledChar
A styled character cell on a 608 caption screen.
Cea708Decoder
CEA-708 (DTVCC) caption decoder.
Color
A CEA-708 colour: 2 bits per RGB component (R, G, B each 0–3), 64 colours total (§8.8, Tables 30/31).
Window
A decoded CEA-708 caption window (§8.4 window model).

Enums§

AnchorPoint
Anchor point of a CEA-708 window — which corner / edge / centre the anchor coordinates refer to (CTA-708-E §8.4.6, 4-bit ap field, values 0–8).
Cea608Channel
A line-21 caption data channel (Table 1, §4.1): the eight CC/Text logical services keyed by field + data-channel.
Cea608Color
Foreground colour of a line-21 caption cell (CTA-608-E Tables 51/53).
Cea608Mode
The caption mode (§6.1, §7).
EdgeType
Character edge type (§79.102 (p) / SPA edge-type field; 3-bit). 0–5 defined.
FontStyle
Font style (§79.102 (k) / SPA font-style field; 3-bit, 0–7).
Justify
Text justification (SWA justify field; 2-bit).
Opacity
Opacity of a foreground / background / fill (§8.8; SPC/SWA opacity field, cea708-decode.md). 2-bit field.
PenOffset
Pen vertical offset (§79.102 (l) / SPA offset field; 2-bit).
PenSize
Pen size (§79.102 (j) / SPA pen-size field; 2-bit). Value 3 is reserved.
PrintDirection
Print direction (SWA print-direction field; 2-bit).
ScrollDirection
Scroll direction (SWA scroll-direction field; 2-bit). Same wire mapping as PrintDirection.
WindowState
State of a window’s display (§8.10.5 DisplayWindows / HideWindows / Toggle).