Skip to content

Commit 3a220d6

Browse files
cfsmp3claude
andcommitted
feat(rust): Add persistent DtvccRust context for CEA-708 decoder (Phase 1)
This is Phase 1 of the fix for issue CCExtractor#1499. It adds the Rust-side infrastructure for a persistent CEA-708 decoder context without modifying any C code, ensuring backward compatibility. Problem: The current Rust CEA-708 decoder creates a new Dtvcc struct on every call to ccxr_process_cc_data(), causing all state to be reset. This breaks stateful caption processing. Solution: Add a new DtvccRust struct that: - Owns its decoder state (rather than borrowing from C) - Persists across processing calls - Is managed via FFI functions callable from C Changes: - Add DtvccRust struct in decoder/mod.rs with owned decoders - Add CCX_DTVCC_MAX_SERVICES constant (63) - Add FFI functions in lib.rs: - ccxr_dtvcc_init(): Create persistent context - ccxr_dtvcc_free(): Free context and all owned memory - ccxr_dtvcc_set_encoder(): Set encoder (not available at init) - ccxr_dtvcc_process_data(): Process CC data - ccxr_flush_active_decoders(): Flush all active decoders - ccxr_dtvcc_is_active(): Check if context is active - Add unit tests for DtvccRust - Use heap allocation for large structs to avoid stack overflow The existing Dtvcc struct and ccxr_process_cc_data() remain unchanged for backward compatibility. Phase 2-3 will add C header declarations and modify C code to use the new functions. Fixes: CCExtractor#1499 (partial) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 60ae6fb commit 3a220d6

File tree

3 files changed

+654
-141
lines changed

3 files changed

+654
-141
lines changed

src/rust/Cargo.lock

Lines changed: 7 additions & 140 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)