SubtitleTypesetter
A typesetting engine for ASS and SSA subtitles, libass in practice.
The Kotlin dialogue tier in kiteplayer-subtitles reads styles and the common override tags and hands text cues to a platform rasterizer. Full typesetting is a different job: a sign that moves with the camera, a karaoke line filling syllable by syllable, rotated and clipped text. That needs the whole script, every event, and a render per video frame. This interface is that job, expressed in the engine's own vocabulary: events go in, positioned overlay images come out.
Threading
The engine calls every member from one serial lane and never concurrently. An implementation needs no lock of its own. close is also called on that lane, after the last render.
Lifetime of the pixels
The images returned by render are owned by the caller from that moment on. An implementation must not reuse or mutate their bytes afterwards, because a renderer reads them on its own thread for as long as that overlay is on screen.
Functions
Adds one container event in the Matroska packet form: ReadOrder,Layer,Style,Name,MarginL, MarginR,MarginV,Effect,Text. Timing is the packet's, in milliseconds on the media timeline. Events are deduplicated by ReadOrder, so re-feeding after a seek is safe.
Drops every event of the open track. The header and the fonts stay. Called on a seek.
Starts a fresh track from a whole script, header and events together. This is how an external .ass file is loaded. Any earlier track is discarded; fonts survive.
Renders the open track at timeMillis for frame.