[FIX] --out report: probe both EIA-608 fields so CC3/CC4 are reported accurately (#2177)#2298
[FIX] --out report: probe both EIA-608 fields so CC3/CC4 are reported accurately (#2177)#2298x15sr71 wants to merge 2 commits into
Conversation
… reported accurately (CCExtractor#2177) Issue: `--out report` reported CC3/CC4 as "No" even when the stream carried captions on EIA-608 field 2 (CC3/CC4 live on field 2), so the report was inaccurate for field-2 sources. Root cause: options->extract defaults to 1 (field 1 only, ccx_common_option.c:28). The report path never changed it, so the decoder's field gate (ccx_decoders_608.c, field 2 processed only when extract == 2 || extract == 12) skipped field 2 and CC3/CC4 presence was never probed. Fix: Set extract = 12 (both fields) in the OutFormat::Report arm (parser.rs). Kept scoped by two details: - Explicit --output-field still wins: the report arm runs during set_output_format, and --output-field is parsed afterwards and overwrites extract, so field selection is honoured regardless of CLI flag order. - The "both fields to stdout" broadcast-mode guard is bypassed only for report mode (added `&& !print_file_reports`). Report uses write_format = Null, so there is no real caption stream to stdout; normal extraction is unaffected. 13 lines, Rust-only (src/rust/src/parser.rs). extract is not changed for any non-report invocation. Before (cc3.ts): CC3: No -> After: CC3: Yes (CC1/CC2/CC4 unchanged) Reproduce: ffmpeg -i "https://weather.horse/samples/cc3.mkv" -c copy cc3.ts -y ccextractor --out report cc3.ts Testing: - report -> CC3 Yes; --output-field 1 override -> CC3 No; both -> Yes. - --out report --stdout and --out report --output-field both --stdout: report printed, no fatal. Normal --output-field both --stdout still rejected (exit 4). - Flag order irrelevant (`-1 --out report` == `--out report -1`). - Normal / -1 / -2 / both extraction unchanged (exit 0, expected output files). - C-side extract==12 encoder branches are inert in report mode: generates_file=0 for CCX_OF_NULL (verified: `--out report -o out.srt` creates no files) and encode_sub has no CCX_OF_NULL case. - parser:: unit tests 204/204, incl. test_out_report_enables_file_reports (asserts extract == 12) and test_out_report_explicit_field_overrides_both.
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 2feb09a...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
|
@bbgdzxng1 @Varadraj75 Tagging you both since this implements the approach discussed in #2177. Tested it with the weather.horse sample from the issue and it seems to behave as expected. If you get a chance, I'd appreciate any feedback. |
|
Claude review (with human verification!) Verified the fix on real samples — On the sample-platform failures: they're noise, not your PR. None of the 16 Nice side effect you didn't mention: One thing worth knowing — not a blocker, and not caused by this PR. I ran
The cause is in To be clear, this is pre-existing behaviour, not something you introduced: I also checked whether XDS data bytes were being misattributed to CC3/CC4 — Given that, I'm inclined to take this as-is and open a separate follow-up to Last thing: the |
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
Before / After
Sample
cc3.ts(captions on field 2):Before:
After:
Issue
Fixes #2177.
--out reportreportsCC3/CC4as No even when the stream carries captions on EIA-608 field 2 (CC3/CC4 live on field 2). The report is therefore inaccurate for any field-2-only source.Root cause
The report path never asked the decoder to look at field 2.
options->extractdefaults to1(field 1 only) —src/lib_ccx/ccx_common_option.c:28. The--out reportarm never changed it, so the decoder's field gate (src/lib_ccx/ccx_decoders_608.c:1185-1193, which only processes field 2 whenextract == 2 || extract == 12) skipped field 2 entirely. CC3/CC4 presence was never probed, so it was always reported as No.Fix
Set
extract = 12(both fields) in theOutFormat::Reportarm (src/rust/src/parser.rs:202-209).Two supporting details keep this scoped:
--output-fieldstill wins. The Report arm runs duringset_output_format(parser.rs:783);--output-fieldis parsed afterwards (parser.rs:988) and overwritesextract. Order of CLI flags is irrelevant because processing order inparse_parametersis fixed.extract == 12,--out report --stdoutwould otherwise trip the broadcast-mode guard (parser.rs:1575-1585). The guard now has&& !self.print_file_reports, so it is relaxed only for report mode. Report writeswrite_format = Null(no caption stream to stdout), so the guard is meaningless there; normal extraction is unaffected.The change is 13 lines, Rust-only, entirely inside the report arm + that one guard. It does not alter
extractfor any non-report invocation.Testing
Built from this branch (binary reports Git commit
0d968cde). All behaviours verified againstcc3.ts:--out report--out report --output-field 1--out report --output-field both--out report --stdout--out report --output-field both --stdout--output-field both --stdout(normal)--output-field 1 --out reportvs--out report --output-field 1--output-field 1,--output-field 2,--output-field bothRegression scope verified: the only new
extractwrite is inside the report arm, and the stdout-guard edit is a no-op whenprint_file_reports == false, so non-report behaviour cannot change. The C-sideextract == 12encoder branches (ccx_encoders_common.c:583/605/643/920) are inert in report mode becausegenerates_file = 0forCCX_OF_NULL(verified:--out report -o out.srtcreates no files) andencode_subhas noCCX_OF_NULLcase.Unit tests:
src/rust—parser::module 204/204 pass, including:test_out_report_enables_file_reports(now assertsextract == 12)test_out_report_explicit_field_overrides_both