Skip to main content

Crate ebustl_parser

Crate ebustl_parser 

Source
Expand description

Parser and writer for subtitle files in the EBU STL format, specified in EBU Tech 3264.

A file consists of a GsiBlock with general information, followed by TtiBlocks with the text and timing of the subtitles. A subtitle may span several TTI blocks, use Stl::subtitles to get the complete subtitles.

§Example

use ebustl_parser::parse_stl_from_file;

let stl = parse_stl_from_file("stls/test.stl").expect("Parse stl from file");
let dfc = stl.gsi.disk_format_code();
for subtitle in stl.subtitles() {
    let header = subtitle.header_block();
    println!(
        "{:?} --> {:?}: {}",
        header.time_code_in(dfc),
        header.time_code_out(dfc),
        subtitle.text()
    );
}

Re-exports§

pub use crate::parser::ParseError;

Modules§

parser
Parsing of STL data in memory.

Structs§

Date
A date in the GSI block (CD, RD), stored as YYMMDD.
GsiBlock
General Subtitle Information (GSI) block, the first 1024 bytes of an STL file.
InvalidFieldValue
A field value that is invalid according to the spec, with the value as stored in the file.
LanguageCode
Language code of the subtitle list (LC), Tech 3264 Appendix 3.
Stl
A subtitle list in the EBU STL format: a GSI block followed by TTI blocks.
Subtitle
A subtitle made up of one or more consecutive TTI blocks.
Subtitles
Iterator over the subtitles of an Stl, see Stl::subtitles.
Time
A time code: hours, minutes, seconds and frames.
TtiBlock
Text and Timing Information (TTI) block, 128 bytes with the text and timing of a subtitle.
TtiFormat
Presentation of a subtitle created with Stl::add_sub or TtiBlock::new.
ValidationIssue
A deviation from the spec, found by Stl::validate.

Enums§

CharacterCodeTable
Character Code Table (CCT), the character set of the Text Fields in the TTI blocks.
CodePageNumber
Code Page Number (CPN), the code page of the text in the GSI block.
Color
A teletext color, used by TeletextControl::AlphaColor and TeletextControl::MosaicColor.
CumulativeStatus
Cumulative Status (CS), whether a subtitle is part of a cumulative set of subtitles.
DiskFormatCode
Disk Format Code (DFC), the frame rate of the time codes.
DisplayStandardCode
Display Standard Code (DSC).
Justification
Justification Code (JC), the horizontal alignment of a subtitle.
OpenControl
A control code for open (in-vision) subtitles (80h-85h).
TeletextControl
A teletext control code (00h-1Fh), Tech 3264 Appendix 2, reproduced from EBU Tech 3240.
TextElement
A part of the decoded Text Field of a subtitle.
TimeCodeStatus
Time Code: Status (TCS), whether the time codes in the GSI and TTI blocks are intended for use.

Functions§

parse_stl_from_file
Reads and parses an STL file.