Skip to content

Conversation

@cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Dec 20, 2025

Summary

  • Fix CEA-708 decoder not activating when --service option is specified
  • Handle null timing pointer gracefully in from_ctype() conversion
  • Prevents critical settings (enabled, services_enabled) from being reset to defaults

Problem

When converting CEA-708 decoder settings from C to Rust via from_ctype(), a null timing pointer caused the entire conversion to fail and return None. This triggered the unwrap_or(default()) fallback, resetting:

  • enabled from true to false
  • active_services_count from 1 to 0

This caused CEA-708 captions to not be extracted (exit code 10) even when --service 1 was specified.

Root Cause

In src/rust/src/ctorust.rs, the ? operator on timing conversion propagated None when timing was null:

timing: CommonTimingCtx::from_ctype(settings.timing)?,  // Returns None if timing is null

Fix

Handle null timing pointer gracefully:

let timing = if settings.timing.is_null() {
    CommonTimingCtx::default()
} else {
    CommonTimingCtx::from_ctype(settings.timing).unwrap_or_default()
};

Test plan

  • Test with CEA-708 sample that was failing (exit code 10 → exit code 0)
  • Verify captions are extracted with --service 1
  • CI tests for CEA-708 (tests 141, 142, 146, 147, 149)

🤖 Generated with Claude Code

When converting CEA-708 decoder settings from C to Rust via from_ctype(),
a null timing pointer would cause the entire conversion to fail and return
None. This triggered the unwrap_or(default()) fallback, resetting critical
settings like `enabled` and `services_enabled` to false/0.

This caused CEA-708 captions to not be extracted (exit code 10) even when
--service was specified, because the decoder's is_active flag was reset
to 0 during demuxer initialization.

The fix handles null timing pointer gracefully by using a default
CommonTimingCtx instead of propagating None, preserving the other
decoder settings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 6503502...:
Report Name Tests Passed
Broken 13/13
CEA-708 12/14
DVB 4/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 72/86
Teletext 7/21
WTV 13/13
XDS 33/34

Your PR breaks these cases:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 8e8229b88b..., Last passed: Never
  • ccextractor --out=srt --latin1 611b4a9235..., Last passed: Never
  • ccextractor --service 1 --out=txt --no-bom --no-rollup b5d6aad89f..., Last passed: Never
  • ccextractor --service 1[EUC-KR] --out=txt --no-rollup b5d6aad89f..., Last passed: Never
  • ccextractor --service 1[EUC-KR] b5d6aad89f..., Last passed: Never
  • ccextractor --service 1[EUC-KR] --no-rollup b5d6aad89f..., Last passed: Never
  • ccextractor --service all[EUC-KR] b5d6aad89f..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 132d7df7e9..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 99e5eaafdc..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 70000200c0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 15feae9133..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 95dd33c6f1..., Last passed: Never
  • ccextractor --hardsubx 1a0302f7fd..., Last passed: Never
  • ccextractor --out=dvdraw c83f765c66..., Last passed: Never
  • ccextractor --in=bin 988d4e8bba..., Last passed: Never
  • ccextractor --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --endcreditsforatleast 3 --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --endcreditsforatmost 2 --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --out=srt --latin1 d7e7dbdf68..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --xds --latin1 --ucla e274a73653..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds b22260d065..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 27fab4dbb6..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds bbd5bb52fc..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds b992e0cccb..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds d0291cdcf6..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 7d2730d38e..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 88cd42b89a..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 7f41299cc7..., Last passed: Never

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.

@cfsmp3 cfsmp3 merged commit 0fdfb75 into CCExtractor:master Dec 21, 2025
23 of 25 checks passed
@cfsmp3 cfsmp3 deleted the fix/cea708-null-timing-pointer branch December 21, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants