Repository navigation
Conversation
The CEA-708 writer only writes srt, sami, transcript (ttxt/txt) and scc. For any other --out format (webvtt, smptett, ssa, g608, ccd, dvdraw, bin, spupng) writer_output() still created the .pN.svcNN file before finding out it had nothing to write, so every run left a 0-byte file (3 bytes with --bom) and the CEA-708 captions were dropped without a word. Check the format first: don't create the file, and say once that CEA-708 captions are not written in this format.
|
@cfsmp3 Small fix: with |
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 10180, commit 2c1c1c6:
Compared with the commit this branch was cut from: the same run as the tip of master (test 10180), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
Sample: c83f765c…06cd.ts (has CEA-608 and CEA-708 service 1).
2c1c1c6fout.vtt(608)out.p1.svc01.vtt(708)[CEA-708] This output format is not supported for CEA-708 captions, so they are not written. Use srt, sami, ttxt, txt or scc for them.The same 0-byte file is left for
smptett,ssa,g608,ccd,dvdraw,binandspupng. With--bomit is a 3-byte file that holds only the BOM.The problem, simply
CCExtractor writes CEA-708 captions in their own file next to the main one, like
out.p1.svc01.srt. But the CEA-708 writer only knows four formats: srt, sami, transcript (ttxt/txt) and scc.When you ask for another format, like WebVTT, it does things in the wrong order. It first makes the file, then looks at the format, sees it can't write it, and stops. So you get an empty file and no captions. It's like putting an empty box on the shelf with a label on it: it looks like your CEA-708 captions are there, but the box is empty, and nobody tells you why.
Since 708 decoding is on by default, this happens on every run with one of those formats when the input has CEA-708 captions.
Root cause
dtvcc_tv_screen::writer_output()(src/rust/src/decoder/tv_screen.rs) creates the per-service file on its first call. It then callswrite(), which handles onlyCCX_OF_SRT,CCX_OF_SAMI,CCX_OF_TRANSCRIPTandCCX_OF_SCC. For anything else it returnsErr("Unsupported write format"), which goes towarn!and isn't shown to the user. Nothing is ever written to the file.#1877 fixed the same 0-byte symptom for the 608 files in
dinit_write(), but the CEA-708 files are closed indtvcc_writer_cleanup(), so that fix doesn't cover them.Fix
At the start of
writer_output(), check the format first. If the CEA-708 writer can't write it:write_debug(), aswrite()did for these formats, so the 708 debug output doesn't change.The four supported formats take exactly the same path as before.
Tests
On the sample, master vs. this PR:
webvtt,smptett,ssa,g608,ccd,dvdraw,binandspupng: the main output file is byte-identical. The only differences are the missing 0-byte.p1.svc01.*file and the one notice.srt,sami,ttxt,txt,scc,rawandmcc: all output files are byte-identical, and there is no notice.--bom: the 3-byte.p1.svc01.vttis gone.-1(608 only) and-quiet: no notice. With-quiet, nothing is printed, as before.-svc 1 --out=srtgives identical files.The exit codes are the same everywhere.
-svc 1 --out=webvttends withError: writing to file(exit 1) on both master and this PR. That comes from somewhere else and isn't changed here.Unit test:
test_writer_output_unsupported_format_creates_no_filecallswriter_output()withCCX_OF_WEBVTTand checks that no file is created. It fails on master.cargo testpasses (449 insrc/rust, all inlib_ccxr), andcargo fmt --checkandcargo clippy -- -D warningsare clean.Notes:
Writer::new(). If it merges first, the new test needs that one extra argument.DISABLE_RUSTbuild isn't changed.