pub struct Cea708Decoder { /* private fields */ }decode only.Expand description
CEA-708 (DTVCC) caption decoder.
Feed it CcTriplets (or raw cc_data byte pairs) from the DTVCC stream
(cc_type 2/3); read decoded window text per service via
service_text / windows.
use cc_data::decode::Cea708Decoder;
let mut dec = Cea708Decoder::new();
// A CCP (header + service-1 block) carrying the DefineWindow worked example
// for window 2: 0x9A 38 4A D1 8B 0F 11.
dec.push_packet(&[0x05, 0x27, 0x9A, 0x38, 0x4A, 0xD1, 0x8B, 0x0F, 0x11]);
let w = &dec.windows(1)[2];
assert!(w.is_some());Implementations§
Source§impl Cea708Decoder
impl Cea708Decoder
Sourcepub fn push_triplets<'a, I>(&mut self, triplets: I)where
I: IntoIterator<Item = &'a CcTriplet>,
pub fn push_triplets<'a, I>(&mut self, triplets: I)where
I: IntoIterator<Item = &'a CcTriplet>,
Feed the decoder the 708 (DTVCC) triplets of a crate::CcData.
A cc_type == Dtvcc708Start triplet begins a new Caption Channel Packet;
Dtvcc708Data triplets continue it. Invalid triplets are skipped.
Sourcepub fn push_packet(&mut self, ccp: &[u8])
pub fn push_packet(&mut self, ccp: &[u8])
Feed one complete Caption Channel Packet (the CCP header byte followed by its data bytes). Useful for testing / when packets are pre-assembled.
Sourcepub fn windows(&self, service_number: usize) -> &[Option<Window>; 8]
pub fn windows(&self, service_number: usize) -> &[Option<Window>; 8]
Read the windows of a service (1–6). Returns an empty array view for
an out-of-range service number.
Sourcepub fn service_text(&self, service_number: usize) -> String
pub fn service_text(&self, service_number: usize) -> String
All decoded text for a service (1–6), visible-window text joined with
\n in window-priority order (0 = highest first), then by window ID.
Trait Implementations§
Source§impl Clone for Cea708Decoder
impl Clone for Cea708Decoder
Source§fn clone(&self) -> Cea708Decoder
fn clone(&self) -> Cea708Decoder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more