pub struct TimedMicroDvdSubtitle { /* private fields */ }
Expand description

Timed version of MicroDVD (.sub) subtitle, using user-supplied framerate to calculate timings

When initialised without framerate, the default framerate is 24.

Implementations§

source§

impl TimedMicroDvdSubtitle

source

pub fn from_raw(raw: &MicroDvdSubtitle, framerate: Option<f32>) -> Self

Convert raw MicroDVD subtitle data to timed MicroDVD data, given the framerate the subtitles were created for. If no framerate is given, the default of 24 is used.

source

pub fn with_framerate( path: impl AsRef<Path>, framerate: f32 ) -> Result<Self, Error>

Create MicroDVD from path given and calculate its timings using the given framerate.

Errors

Returns Error::FileIoError if an error occurs while opening the file

source

pub fn framerate(&self) -> f32

Get framerate used to create timings

source

pub fn set_framerate(&mut self, framerate: f32)

Modify framerate associated with subtitle. Does not modify event timings at all.

source

pub fn update_framerate(&mut self, framerate: f32)

Modify framerate associated with subtitle

This will also recalculate and update all event timings to match the new framerate.

Trait Implementations§

source§

impl Debug for TimedMicroDvdSubtitle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for TimedMicroDvdSubtitle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&AssSubtitle> for TimedMicroDvdSubtitle

source§

fn from(value: &AssSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SsaSubtitle> for TimedMicroDvdSubtitle

source§

fn from(value: &SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SubRipSubtitle> for TimedMicroDvdSubtitle

source§

fn from(value: &SubRipSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&TimedMicroDvdSubtitle> for AssSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&TimedMicroDvdSubtitle> for MicroDvdSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&TimedMicroDvdSubtitle> for SsaSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&TimedMicroDvdSubtitle> for SubRipSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&TimedMicroDvdSubtitle> for WebVttSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&WebVttSubtitle> for TimedMicroDvdSubtitle

source§

fn from(value: &WebVttSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedMicroDvdSubtitle> for AssSubtitle

source§

fn from(value: TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedMicroDvdSubtitle> for SsaSubtitle

source§

fn from(value: TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedMicroDvdSubtitle> for SubRipSubtitle

source§

fn from(value: TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedMicroDvdSubtitle> for WebVttSubtitle

source§

fn from(value: TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl FromStr for TimedMicroDvdSubtitle

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Subtitle for TimedMicroDvdSubtitle

§

type Event = TimedMicroDvdEvent

Event type for the given subtitle format
source§

fn from_path_with_encoding( path: impl AsRef<Path>, encoding: Option<&'static Encoding> ) -> Result<Self, Error>

Load subtitle format from path using the given encoding Read more
source§

fn events(&self) -> &[Self::Event]

Get list of events as a slice
source§

fn events_mut(&mut self) -> &mut [Self::Event]

Get list of events as a mutable slice
source§

fn from_path(path: impl AsRef<Path>) -> Result<Self, Error>

Load subtitle from given path. Automatically attempts to detect the encoding to use from the file contents. Read more
source§

fn event(&self, index: usize) -> Option<&Self::Event>

Try to get event at given index
source§

fn event_mut(&mut self, index: usize) -> Option<&mut Self::Event>

Try to get mutable event at given index
source§

fn export(&self, path: impl AsRef<Path>) -> Result<(), Error>

Write subtitles to file at the given path Read more
source§

impl TextSubtitle for TimedMicroDvdSubtitle

source§

fn strip_formatting(&mut self)

Remove all styling/formatting information from the text and subtitle metadata
source§

impl TimedSubtitle for TimedMicroDvdSubtitle

source§

fn shift(&mut self, delta: TimeDelta)
where <Self as Subtitle>::Event: TimedEvent,

Shift all events in subtitle by given amount of time, in milliseconds.

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.