edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBbede77eTahinli2 months ago3534 commits
| 1 | //! Text subtitles: SubRip and WebVTT into one cue IR ([`ir`]). |
| 2 | //! |
| 3 | //! Both formats are read the same way and for the same reason: what a timeline |
| 4 | //! wants is *when* a line is on screen and *what it says*, and the markup |
| 5 | //! around that ranges from `<i>` to a dozen dialects of override tag. So a |
| 6 | //! parse answers with a [`ir::SubtitleTrack`] — cues of time ranges and |
| 7 | //! [`ir::Segment`] runs — and a caller that draws nothing yet takes |
| 8 | //! [`ir::plain_text`] and drops the rest. |
| 9 | //! |
| 10 | //! Tolerance is the point. Subtitle files are hand-edited, machine-translated, |
| 11 | //! re-encoded and truncated; a parser that refuses one is a parser that refuses |
| 12 | //! the file the user actually has. BOMs (UTF-8 and UTF-16), CRLF and lone CR, |
| 13 | //! invalid UTF-8, missing or wrong indices, dotted fractions, overlapping and |
| 14 | //! backwards cues all parse. A block this cannot read is skipped and counted |
| 15 | //! ([`ir::SubtitleTrack::skipped`]); only a document with no timing line in it |
| 16 | //! at all is an error, because that is a document of another kind. |
| 17 | //! |
| 18 | //! ASS/SSA is the same IR from `ec-ass`, and PGS bitmaps from `ec-pgs`. |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | pub use |
| 28 | |
| 29 | |
| 30 | ; |
| 31 | /// The byte-level tolerances every subtitle format needs, shared with `ec-ass`: |
| 32 | /// BOM and line-ending normalisation, and the clock every one of them writes. |
| 33 | pub use ; |