edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane/asskara: ASS karaoke override tags
Finding: ec-ass only parses
It does not render. Nothing to compare against ffmpeg -vf ass=, so the parsed model now carries what a renderer needs, and the parse is tested.
Done
ec_subs::Segment::Karaokeis now{ cs, start_cs, mode, secondary, children }(breaking for exhaustive matches).start_cs: syllable start in cs from the cue start. It accumulates across\ktags, including empty ones, as libass does.\ktsets it absolutely for the next\k.mode: newec_subs::KaraokeMode.Fillis\k(secondary to primary switch at start),Sweepis\kf/\K(left-to-right),Outlineis\ko(outline-only switch).secondary:\2coverride;Nonemeans the style's secondary.- A style block inside one syllable repeats the same
(start_cs, cs)on the split runs; group by that pair.
SubtitleStyle::secondary_color(RGBA) is parsed fromSecondaryColour.- Fixes:
\Kwas dropped to Raw,\ktand\2cwere unknown, and\rdid not reset overrides.\rNameis reset and also kept as Raw{\rName}.
Audit (parse level; all kept verbatim as Segment::Raw, text unaffected, tested)
\t with accel, \fad, \fade, \clip, \iclip (rect and vector), \org, \frx/y/z, \fax/fay, \be, \blur, \q, \fsp, \bord, \shad.
\an, \a, \pos and the start of \move fill CuePosition; the full \move stays as Raw. \p becomes Raw drawing text (existing).
Not modelled structurally (cheap only for a renderer): these Raw strings still need parsing by the renderer.
What edith needs (text.rs, not touched)
Per frame at time t (cs since cue start = (t - cue.start_us)/10000), for each Segment::Karaoke (group runs by (start_cs, cs)):
- Secondary colour:
secondaryelsestyle.secondary_color; primary is the enclosingColororstyle.primary_color. Fill: t < start_cs -> secondary, else primary.Sweep: t <= start -> secondary; t >= start+cs -> primary; between, the syllable's glyph box is split at x = left + width*(t-start)/cs, left part primary, right part secondary.Outline: fill is primary always; the outline is drawn only from start_cs (libass\kohides the outline before it).- Text outside any Karaoke segment is plain primary.
Match the pattern with
..or add the new fields whereSegment::Karaokeis built or destructured.
Gates
cargo clippy --workspace --all-targets -- -D warnings clean; EC_REQUIRE_FIXTURES=1 cargo test -p ec-ass --release passes (new tests: karaoke modes/timing/colours/\kt/\r, and the override audit). cargo test -p ec-subs shows a_real_pgs_stream_decodes_to_plausible_bitmaps failing in real_library.rs; PGS, unrelated to this change (not checked on main).