Skip to main content

VobSubParser

Struct VobSubParser 

Source
pub struct VobSubParser { /* private fields */ }
Expand description

VobSub subtitle parser and renderer.

Implementations§

Source§

impl VobSubParser

Source

pub fn new() -> Self

Create a new VobSub parser.

Source

pub fn load_from_data(&mut self, idx_content: &str, sub_data: Vec<u8>)

Load VobSub from IDX content and SUB data.

Source

pub fn load_from_mks(&mut self, mks_data: &[u8]) -> Result<(), String>

Load VobSub from a Matroska subtitle container with embedded S_VOBSUB tracks.

Source

pub fn load_from_sub_only(&mut self, sub_data: Vec<u8>)

Load VobSub from SUB file only (scans for timestamps).

Source

pub fn dispose(&mut self)

Dispose of all resources.

Source

pub fn last_render_issue(&self) -> String

Get the last non-fatal render issue for diagnostics.

Source

pub fn count(&self) -> usize

Get the number of subtitle entries.

Source

pub fn screen_width(&self) -> u16

Get the presentation width for this subtitle track.

Source

pub fn screen_height(&self) -> u16

Get the presentation height for this subtitle track.

Source

pub fn language(&self) -> String

Get the declared language code from IDX metadata.

Source

pub fn track_id(&self) -> String

Get the declared subtitle track ID from IDX metadata.

Source

pub fn has_idx_metadata(&self) -> bool

Check whether IDX metadata was used to load the parser.

Source

pub fn get_timestamps(&self) -> Vec<f64>

Get all timestamps in milliseconds.

Source

pub fn find_index_at_timestamp(&mut self, time_ms: f64) -> i32

Find the subtitle index for a given timestamp in milliseconds. Returns -1 if no subtitle should be displayed at this time.

Source

pub fn get_cue_start_time(&self, index: usize) -> f64

Get the cue start time in milliseconds.

Source

pub fn get_cue_end_time(&mut self, index: usize) -> f64

Get the cue end time in milliseconds.

Source

pub fn get_cue_duration(&mut self, index: usize) -> f64

Get the cue duration in milliseconds.

Source

pub fn get_cue_file_position(&self, index: usize) -> f64

Get the cue file position in the SUB file.

Source

pub fn render_at_index(&mut self, index: usize) -> Option<VobSubFrame>

Render subtitle at the given index and return RGBA data.

Source

pub fn clear_cache(&mut self)

Clear the internal cache.

Source

pub fn set_deband_enabled(&mut self, enabled: bool)

Enable or disable debanding.

Source

pub fn set_deband_threshold(&mut self, threshold: f32)

Set the deband threshold (0.0-255.0, default: 64.0).

Source

pub fn set_deband_range(&mut self, range: u32)

Set the deband sample range in pixels (default: 15).

Source

pub fn deband_enabled(&self) -> bool

Check if debanding is enabled.

Trait Implementations§

Source§

impl Default for VobSubParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.