Commit Graph
15 Commits
Author SHA1 Message Date
JonRC 268a922dcc craft-captions: SCC and MCC time codes count from the document's start timecode
Ported from the caption-format part of storytold/filmcraft#4131
(filmcraft#4130). Document::start_timecode is the label of time zero; the SCC
and MCC writers count from the 29.97 frame with the same label, so the label
carries across rates. Readers note the rate and drop-frame mode of a file's
labels in Document::labels, and Document::count_from counts cues back from a
start time code. charset_warnings names the time codes the file has, which
that pull request's review found missing.
2026-11-11 23:38:02 +00:00
Dylan M. Taylor 8698a4f7f2 Merge branch 'captions-port-filmcraft-prs' into captions-start-timecode 2026-11-11 23:26:51 +00:00
Dylan M. Taylor 2b2f32334d craft-captions: use craft-timeline's exact time instead of a private copy
craft-captions carried a 290-line subset of the tick, frame rate and timecode
field code because craft-libs had none when it was added. craft-timeline now
has the whole module with the same tick unit. craft_captions::time is a
re-export of craft_timeline::time, so every public path still resolves and
the types are now the same ones craft-timeline's callers hold.
2026-11-11 23:19:28 +00:00
Dylan M. Taylor ae5b335e63 craft-captions: compare the craft-xml and roxmltree views of TTML documents
The TTML reader moved from roxmltree to craft-xml. This dev-only test checks
that both hand it the same elements, attributes and text, by namespace, on
TTML documents and on the writer's output. roxmltree becomes a dev-dependency,
which the cue ID tests use too.
2026-11-11 23:14:28 +00:00
sanyamsingh001 dbc626cc20 craft-captions: TTML/DFXP export keeps cue IDs unique and valid Unicode IDs as written
Ported from the TTML commit of storytold/filmcraft#1839. A cue named s1 could
collide with the style ID, and a generated c1 could take the ID of a later cue.
Valid explicit IDs are reserved first; missing, invalid or repeated ones get a
replacement that is in no one's way. IDs are checked as XML NCNames.
2026-11-11 23:14:28 +00:00
NetterSilver aecd7d8a6c craft-captions: TTML/DFXP export keeps literal < and > text
Ported from storytold/filmcraft#2830. The writer treated every < with a later >
as a tag and wrote nothing for unknown names, so "1 < 2 and 3 > 2" lost its
middle. Only a well-formed tag is markup now; a > inside a quoted attribute
value does not end the tag.
2026-11-11 23:14:28 +00:00
JonRC 0da0d9b2e8 craft-captions: CEA-708 export starts each caption at its window's top left
Ported from storytold/filmcraft#4043 (filmcraft#4042). Each window load now
sends DeleteWindows before DefineWindow in place of the ClearWindows after it:
a window made anew is empty with the pen at its top left in any decoder, for
the same number of bytes, so cue timing is unchanged.
2026-11-11 23:14:28 +00:00
jnohclee-rgb c55287c57a craft-captions: an SCC pop-on load may run across the previous caption's erase
Ported from storytold/filmcraft#1837 (filmcraft#1791). A caption that closely
follows another popped on about a second late, because its load had to be one
unbroken run of free frames. Doubled codes stay adjacent; pauses are allowed
between them.
2026-11-11 23:14:28 +00:00
SeeRay11 71fd9a791a craft-captions: back-to-back SCC captions with the same text stay separate cues
Ported from storytold/filmcraft#3808. Every End of Caption now closes the open
cue. MCC's CEA-608 path uses the same decoder.
2026-11-11 23:14:28 +00:00
NetterSilver 47664d1e13 craft-captions: an SRT text line that looks like a timing line survives a round trip
Ported from storytold/filmcraft#4448. The writer marks such a line with a
leading zero-width space and the reader removes it, so the cue is not split.
2026-11-11 23:14:28 +00:00
NetterSilver 6814f82fee craft-captions: a WebVTT speaker name with > no longer spills into the cue text
Ported from storytold/filmcraft#4470. The writer puts the lookalike U+203A in
place of > inside the voice tag. Also from that pull request's review: a line
break in a name is written as a space, and a name ending in - is kept apart
from the tag's closing >.
2026-11-11 23:14:28 +00:00
NetterSilver aa490f4ed0 craft-captions: WebVTT cue-text arrow escape is reversible
Ported from storytold/filmcraft#4437. A literal --&gt; in cue text came back as
--> after a write and parse; the writer now adds one amp; level and the reader
removes exactly one.
2026-11-11 23:14:27 +00:00
NetterSilver b994b31bbe craft-captions: TTML/DFXP export drops characters XML 1.0 forbids
Ported from storytold/filmcraft#4467. A control character in cue text made the
exported file unreadable. The filter also covers U+FFFE and U+FFFF, which the
review of that pull request asked for.
2026-11-11 23:14:27 +00:00
NetterSilver 6f2b34f3e9 craft-captions: TTML cue text collapses only XML whitespace and keeps edge line breaks
Ported from storytold/filmcraft#3145. char::is_whitespace also matched U+00A0,
U+2009 and U+3000, so no-break spaces became ordinary spaces on import, and a
leading or trailing <br/> was trimmed away.
2026-11-11 23:14:27 +00:00
Dylan M. Taylor 58b02d4e6a Add craft-captions: SRT, WebVTT, SCC, MCC, EBU STL and TTML behind one cue model (#876)
Carved from FilmCraft's filmcraft-captions (crates/captions at 4bec22bd): the
file readers and writers, CEA-608/708 coding, format detection and the cue
document. Rendering and the mapping onto FilmCraft's caption tracks stay there.

- time: the crate has its own exact Tick (1/254016000000 s) and rational
  FrameRate, the subset of filmcraft-time the formats use.
- TTML is read through craft-xml instead of roxmltree: no entity expansion,
  nesting bounded by the reader (128 levels, as before).
- parse refuses input over 64 MiB and keeps at most 1,000,000 cues.
- MCC and EBU STL name the caller's program (WriteOptions::program).
- plain_text (inline tag stripping) moves with the SCC/MCC writers that need it.
2026-11-11 16:23:34 -05:00