Function parse_bytes

Source
pub fn parse_bytes(
    format: SubtitleFormat,
    content: &[u8],
    encoding: Option<&'static Encoding>,
    fps: f64,
) -> Result<SubtitleFile>
Expand description

Parse all subtitle formats, invoking the right parser given by format.

§Mandatory format specific options

Some subtitle formats require additional parameters to work as expected. If you want to parse a specific format that has no additional parameters, you can use the parse function of the respective ***File struct.

encoding: to parse a text-based subtitle format, a character encoding is needed (use None for auto-detection by chardet)

fps: this parameter is used for MicroDVD .sub files. These files do not store timestamps in seconds/minutes/… but in frame numbers. So the timing 0 to 30 means “show subtitle for one second” for a 30fps video, and “show subtitle for half second” for 60fps videos. The parameter specifies how frame numbers are converted into timestamps.