[PR #1870] fix(708): Handle null timing pointer in CEA-708 settings conversion #2646

Open
opened 2026-01-29 17:23:15 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1870

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1870 **State:** closed **Merged:** Yes --- ## 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: ```rust timing: CommonTimingCtx::from_ctype(settings.timing)?, // Returns None if timing is null ``` ## Fix Handle null timing pointer gracefully: ```rust let timing = if settings.timing.is_null() { CommonTimingCtx::default() } else { CommonTimingCtx::from_ctype(settings.timing).unwrap_or_default() }; ``` ## Test plan - [x] Test with CEA-708 sample that was failing (exit code 10 → exit code 0) - [x] Verify captions are extracted with `--service 1` - [ ] CI tests for CEA-708 (tests 141, 142, 146, 147, 149) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2646