pub struct PgsParser { /* private fields */ }Expand description
PGS subtitle parser and renderer.
Implementations§
Source§impl PgsParser
impl PgsParser
Sourcepub fn parse(&mut self, data: &[u8]) -> usize
pub fn parse(&mut self, data: &[u8]) -> usize
Parse a PGS file from binary data. Returns the number of display sets parsed.
Sourcepub fn screen_width(&self) -> u16
pub fn screen_width(&self) -> u16
Get the presentation width for this subtitle track.
Sourcepub fn screen_height(&self) -> u16
pub fn screen_height(&self) -> u16
Get the presentation height for this subtitle track.
Sourcepub fn get_timestamps(&self) -> Vec<f64>
pub fn get_timestamps(&self) -> Vec<f64>
Get all timestamps in milliseconds.
Sourcepub fn find_index_at_timestamp(&self, time_ms: f64) -> i32
pub fn find_index_at_timestamp(&self, time_ms: f64) -> i32
Find the display set index for a given timestamp in milliseconds.
Sourcepub fn get_cue_start_time(&self, index: usize) -> f64
pub fn get_cue_start_time(&self, index: usize) -> f64
Get the cue start time in milliseconds.
Sourcepub fn get_cue_end_time(&self, index: usize) -> f64
pub fn get_cue_end_time(&self, index: usize) -> f64
Get the cue end time in milliseconds.
Sourcepub fn get_cue_composition_count(&self, index: usize) -> u32
pub fn get_cue_composition_count(&self, index: usize) -> u32
Get the number of composition objects in a cue.
Sourcepub fn get_cue_palette_id(&self, index: usize) -> i32
pub fn get_cue_palette_id(&self, index: usize) -> i32
Get the cue palette ID.
Sourcepub fn get_cue_composition_state(&self, index: usize) -> i32
pub fn get_cue_composition_state(&self, index: usize) -> i32
Get the cue composition state.
Sourcepub fn render_at_index(&mut self, index: usize) -> Option<SubtitleFrame>
pub fn render_at_index(&mut self, index: usize) -> Option<SubtitleFrame>
Render subtitle at the given index and return RGBA data. Returns null if index is invalid or no subtitle data.
Sourcepub fn last_render_issue(&self) -> String
pub fn last_render_issue(&self) -> String
Get the last non-fatal render issue for diagnostics.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the internal cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PgsParser
impl RefUnwindSafe for PgsParser
impl Send for PgsParser
impl Sync for PgsParser
impl Unpin for PgsParser
impl UnsafeUnpin for PgsParser
impl UnwindSafe for PgsParser
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