forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 2c8e3aa151eb0ab655f319f6cdc69a4f66f2b3ffFiltered to crates/engine/src/subtitle.rsClear filter

2026-08-12

✨ feat(subtitles): as many tracks as you want, embedded in the exportAhmet Kaan Gümüş · 28e2853
✨ feat(subtitles): as many tracks as you want, embedded in the export

Subtitle tracks now work the way audio and video tracks do: add as many
as you like, remove any of them, and every track with cues on the
timeline is written into the exported file.

Add and remove
- "+ S" beside "+ V"/"+ A" imports every subtitle track in a picked
  file; each row carries its own "x". Pointer and keyboard doors share
  one implementation and refuse identically, before any chooser opens.
- Project::remove_subtitles / PlaybackSession::remove_subtitles, with
  the index fixup in one place so a removal cannot repoint the overlay.

Embedded in the output
- ExportSettings.subtitles is a list; the Matroska muxer writes N tracks
  from number 3 up, ceiling derived from the encoding (0x7F -
  SUB_TRACK_FIRST) because track 127 is the all-ones VINT our own reader
  maps to "unknown" and would silently lose.
- mp4 carries them too, as real tx3g timed text. The old "an mp4 carries
  none" was a false refusal: mp4 0.14 has MediaConfig::TtxtConfig all
  along. Samples are built from cue boundaries, so gaps are empty
  samples and the track spans the film.
- of_mp4 reads them back, so edith re-imports its own output. Verified
  against a file ffmpeg muxed, which writes mdhd in microseconds where
  we write milliseconds.
- The export set is derived from timeline_cues per call, so it cannot
  desync; the card names a track it leaves off, and counts past the
  width budget rather than eating the card.

Language and title
- SubtitleTrack carries language and name apart; the guess-them-back
  heuristic is gone. LanguageBCP47 is read and mapped to a 3-letter code
  (ffmpeg reads no BCP-47 at all, so writing it would have made the
  language invisible). A 17-track subtitle library file and a
  dual-language one no longer read "und".

Media bitrate in properties
- engine::probe_bitrate opens no decoder; all three numbers share the
  container's duration, so total >= video + audio holds by construction.
  Within 0.004% of ffprobe across the library.
- Both properties cards show it; a dual-audio file says which of how
  many. The line picks one unit off its smallest stated component, so a
  real value never renders as 0.00.

Off the render thread
- The subtitle walk moved to the background executor at every door:
  1324ms -> 0.1ms on a 3.1GB film, 234ms -> 5.0ms on a 25.4GB/35-track
  one. (The media walk is still on the render thread; separate slice.)

False refusals removed
- .mks and .mka were refused while the compiled-in Matroska reader
  parses them; is_matroska now takes the standard's closed set.
- The audio-only "sound alone" sentence was unreachable when every pick
  was a bitmap track.

Subtitle-free exports stay byte-identical: 294a8b0c (hevc mkv),
8c16b8b1 (default mp4).

2026-08-11

⚡ perf(subtitle): a project naming many tracks of one file walks it onceAhmet Kaan Gümüş · 95fb78d
⚡ perf(subtitle): a project naming many tracks of one file walks it once

A saved subtitle row was read by walking its whole Matroska file and
keeping one track of it, so a film whose project names thirty-five of
them was thirty-five walks of a 25 GB file -- 7.5 s with the window
stopped, since a project opens on the UI thread.

open_all reads every saved row at once: one walk per distinct file,
every row picked out of it, and the rows handed back in the order they
were saved in -- a subtitle is picked by its place in that list, so a
reordering would silently repoint what the user had picked. open now
delegates to it, which keeps the refusal wording in one place.
🩹 fix(subtitles): the grafts off the losing PGS laneAhmet Kaan Gümüş · bf65371
🩹 fix(subtitles): the grafts off the losing PGS lane

- The overlay is a flex box with the canvas as its one growing item,
  fitted (Contain) the way the picture under it is: size_full inside an
  absolutely placed box has nothing to be a percentage of, and Fill put
  every cue somewhere the disc did not.
- One way out of subtitle_overlay, and it lets the drawn picture go on
  the way: the toggle going off leaked an 8 MB atlas tile per press.
- A track is pictures because of its codec id, not because its first cue
  happens to be one: an all-erase or empty PGS track passed for text and
  an export promised words it has none of.
- The sup handed to the decoder stops at the end of the first display
  set that composes something, so a muxer packing the erase into the
  same block no longer blanks the cue.
- The film-gated session test: the row a click picks, the map a repaint
  asks for twice (under 16 ms warm), the picture it draws.
🔀 merge(subtitles): a PGS cue is a picture the timeline carriesAhmet Kaan Gümüş · 1bee319
🔀 merge(subtitles): a PGS cue is a picture the timeline carries

Conflicts, both in the demux lane's territory:
- matroska_subtitles wanted-track filter: PGS joins S_TEXT, and both
  still skip a track whose ContentEncoding the demuxer cannot undo.
- mkv_subtitle_blocks: the demux lane's laced walk stands; A's
  single-payload read and its refusal of lacing are dropped. A laced
  block's cues share a start, so end_of's strict > still finds the
  next real block.
- cues_of: A's &mut signature and PGS doc, with the demux lane's
  unsupported early return that is the source of the refusal text.
✨ feat(demux): a header-stripped or laced Matroska track plays instead of refusingAhmet Kaan Gümüş · 5d028c2
✨ feat(demux): a header-stripped or laced Matroska track plays instead of refusing

Two features every disc rip and streaming remux carries and this demuxer had no
reader for:

- `ContentEncodings`: header stripping (`ContentCompAlgo` 3) puts the bytes the
  muxer cut off the front of every frame back, and zlib (algo 0) inflates.
  bzlib, lzo1x, an unknown algorithm and encryption are refused *by name*, and
  per track -- a film whose sound cannot be read still shows its picture, and a
  subtitle track that cannot be read is listed with the reason like a bitmap
  one.
- Lacing: all three headers (Xiph, fixed, EBML) read into one `Block` per
  frame. The frames of a lace get a timestamp each, interpolated across the gap
  to the block after, because six E-AC-3 frames stacked on one instant is a
  sound track that walks away from the picture inside a cluster.

The two films this was cut for: a BluRay remux whose H.264 track is stripped of
one zero byte per block (no picture at all before this), and a WEB remux whose
every E-AC-3 block is fixed-laced (no sound at all before this). Both are
existence-gated tests beside the hand-built EBML fixtures.

zlib is `miniz_oxide`, which `image` already pulls into this build through
`png`: no new crate tree and nothing new to compile.
✨ feat(subtitles): a PGS cue is a picture the timeline carries, not a row that says noAhmet Kaan Gümüş · c45b18e
✨ feat(subtitles): a PGS cue is a picture the timeline carries, not a row that says no

The four S_HDMV/PGS tracks of a BluRay remux were listed and greyed: pictures,
and nothing here could draw one. Now the cue IR carries a picture beside its
text -- `Cue::image`, a `CueImage` holding the display set the Matroska block
held -- and the rows are rows a click can pick.

The decoding is `oxideav-sub-image`: the run-length walk, the palette, the
YCbCr and the object fragmentation are not this project's to re-derive. What is
written here is the framing between the two -- a Matroska block is a `.sup`'s
segments with the `PG` magic and the timestamps taken off, so they go back on --
and the pairing PGS needs and text does not: half the blocks compose nothing,
which is the disc clearing the screen, and that is where the cue before them
ends. `BlockDuration` is zero on every one of them, so `end_of` now reads a zero
the way it reads a missing one.

Kept encoded, decoded when something is about to draw it: this film's canvas is
8 MB of RGBA and its four tracks carry eleven thousand display sets, so the IR
holds the thirty megabytes the file already spends and the front-end keeps one
decoded picture for as long as its cue is up.

An export still writes a text track, so a track of pictures writes none and the
card says "drawn, not written" before the button. A `.edith` is unchanged: it
held a file and a track number and never a cue, which is why a bitmap track
round-trips without the format knowing it exists.
✨ feat(engine): subtitles come in with the film or beside itAhmet Kaan Gümüş · f4b5fd8
✨ feat(engine): subtitles come in with the film or beside it

A subtitle track was a track this engine walked past: the Matroska track
walk kept video and audio and dropped type 0x11, and a `.srt` next to the
media was a file with no door. Now both arrive as the same thing -- a
list of timed cues -- and a project keeps them.

`subtitle`: the cue model plus the two ways in. Standalone `.srt`,
`.vtt` and `.ass`/`.ssa` go through `oxideav-subtitle` and `oxideav-ass`
rather than through a fresh parser here; an embedded track carries its
timing on the block and its text in it, so each codec is put back into
the shape its own parser reads -- which is what makes an embedded track
and the file it was muxed from come back as the same cues.

What cannot be read is refused by name and still listed: the four PGS
tracks of a BluRay remux are four rows saying they are pictures, not an
empty list and not a file that would not open. A `.srt` that has gone
missing since the save is the same story, and a re-save keeps its row.

`.edith` 10 writes `subtitle <track> <path>` -- the reference only, the
cues stay in the file they came from. v9 and every older dialect load as
the projects with no subtitles that they are.