pub struct Cea608CueExtractor { /* private fields */ }Available on crate feature
cc-data only.Expand description
Extracts Cues from a single CEA-608 data channel (CTA-608-E),
wrapping a cc-data cc_data::decode::Cea608Decoder.
Feed it one access unit’s CEA-608 triplets at a time, tagged with that
access unit’s raw (non-unrolled) 33-bit PTS, via push_frame; call
finalize at end of stream to close any still-open cue.
use timed_metadata::webvtt::Cea608CueExtractor;
use cc_data::{CcTriplet, CcType};
use cc_data::decode::Cea608Channel;
fn pair(pts: u64, b1: u8, b2: u8) -> (u64, CcTriplet) {
(
pts,
CcTriplet { cc_valid: true, cc_type: CcType::Ntsc608Field1, cc_data_1: b1, cc_data_2: b2 },
)
}
let mut ex = Cea608CueExtractor::new(Cea608Channel::Cc1);
let frames = [
pair(0, 0x14, 0x20), // RCL
pair(1, 0x14, 0x70), // PAC row 15
pair(2, b'H', b'I'), // "HI"
pair(3, 0x14, 0x2F), // EOC -> commits "HI"
pair(4, 0x14, 0x2C), // EDM -> erases
];
for (pts, t) in frames {
ex.push_frame(pts, core::slice::from_ref(&t));
}
let cues = ex.cues();
assert_eq!(cues.len(), 1);
assert_eq!(cues[0].text, "HI");Implementations§
Source§impl Cea608CueExtractor
impl Cea608CueExtractor
Sourcepub fn new(channel: Cea608Channel) -> Self
pub fn new(channel: Cea608Channel) -> Self
A new extractor tracking the given CEA-608 data channel (e.g. Cc1).
Sourcepub fn push_frame(&mut self, pts33: u64, triplets: &[CcTriplet])
pub fn push_frame(&mut self, pts33: u64, triplets: &[CcTriplet])
Feed one access unit’s CEA-608 triplets (already demuxed from its
cc_data()), tagged with that access unit’s raw 33-bit PTS. Non-608
triplets in triplets are ignored.
Auto Trait Implementations§
impl Freeze for Cea608CueExtractor
impl RefUnwindSafe for Cea608CueExtractor
impl Send for Cea608CueExtractor
impl Sync for Cea608CueExtractor
impl Unpin for Cea608CueExtractor
impl UnsafeUnpin for Cea608CueExtractor
impl UnwindSafe for Cea608CueExtractor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more