Expand description
Text and subtitle format parsers for the revelo media-analysis library.
Each public function has the signature fn(&mut FileAnalyze) -> bool.
It inspects the byte content of a stream, returns false if the format
is not recognised, or fills the
FileAnalyze stream graph with format,
encoding, and timing fields and returns true.
§Supported formats
| Function | Format |
|---|---|
parse_sub_rip | SubRip (SRT) — plain-text timed subtitles |
parse_webvtt | WebVTT — W3C Web Video Text Tracks |
parse_ttml | TTML / DFXP — Timed Text Markup Language |
parse_timed_text | 3GPP Timed Text (TX3G / QuickTime tx3g) |
parse_cmml | CMML — Continuous Media Markup Language |
parse_kate | Kate — Ogg Kate overlay stream |
parse_pgs | PGS — Presentation Graphic Stream (Blu-ray) |
parse_dvb_subtitle | DVB subtitle (ETSI EN 300 743) |
parse_teletext | Teletext subtitle (ETSI EN 300 472) |
parse_arib_std_b24_b37 | ARIB STD-B24 / STD-B37 (Japanese digital broadcast) |
parse_eia608 | EIA-608 / CEA-608 (Line 21 closed captions) |
parse_eia708 | EIA-708 / CEA-708 (DTV closed captions) |
parse_dtvcc_transport | DTVCC transport layer (CEA-708 packetisation) |
parse_scc | SCC — Scenarist Closed Captions |
parse_scte20 | SCTE-20 — closed captions in MPEG-2 user data |
parse_cdp | CDP — Caption Distribution Packet (SMPTE ST 334) |
parse_n19 | N19 / STL — EBU Subtitling Data Exchange Format |
parse_pac | PAC — Cheetah caption file |
parse_pdf | PDF — format identification for PDF documents |
parse_sdp | SDP — Session Description Protocol |
parse_other_text | Generic text-stream fallback |
§Normal use
Prefer the revelo facade, which
auto-detects formats and dispatches to the correct parser:
use revelo_parsers_text::parse_sub_rip;
use revelo_core::FileAnalyze;
let data = std::fs::read("subtitles.srt").unwrap();
let mut fa = FileAnalyze::new(&data);
if parse_sub_rip(&mut fa) {
// fa contains a Text stream with format and encoding fields
}§Safety
#![deny(unsafe_code)] — zero unsafe blocks in this crate.
Re-exports§
pub use arib_std_b24_b37::parse_arib_std_b24_b37;pub use cdp::parse_cdp;pub use cmml::parse_cmml;pub use dvb_subtitle::parse_dvb_subtitle;pub use eia608::parse_eia608;pub use eia708::parse_eia708;pub use kate::parse_kate;pub use n19::parse_n19;pub use other_text::parse_other_text;pub use pgs::parse_pgs;pub use sub_rip::parse_sub_rip;pub use dtvcc_transport::parse_dtvcc_transport;pub use pac::parse_pac;pub use pdf::parse_pdf;pub use scc::parse_scc;pub use scte20::parse_scte20;pub use sdp::parse_sdp;pub use teletext::parse_teletext;pub use timed_text::parse_timed_text;pub use ttml::parse_ttml;pub use webvtt::parse_webvtt;
Modules§
- arib_
std_ b24_ b37 - ARIB STD-B24 / STD-B37 caption data parser (Japanese broadcast).
- cdp
- CDP (Closed-caption Data Packet, SMPTE 334-2) parser.
- cmml
- CMML (Continuous Media Markup Language) parser.
- dtvcc_
transport - dvb_
subtitle - DVB Subtitle parser — PES payload sync (ETSI EN 300 743).
- eia608
- EIA-608 (CEA-608) closed caption parser.
- eia708
- EIA-708 (CEA-708) digital closed caption parser.
- kate
- Kate (Ogg-Kate) subtitle/karaoke identification-header parser.
- n19
- EBU Tech 3264 (N19) / STL subtitle file parser.
- other_
text - Catch-all subtitle/text detector mirroring
File_OtherTextin MediaInfoLib (Source/MediaInfo/Text/File_OtherText.cpp). - pac
- pgs
- PGS (Blu-ray Presentation Graphic Stream) subtitle parser.
- scc
- scte20
- sdp
- sub_rip
- SubRip (.srt) subtitle parser.
- teletext
- timed_
text - ttml
- TTML (Timed Text Markup Language) parser.
- webvtt