-
Notifications
You must be signed in to change notification settings - Fork 492
feat(rust): Add persistent DtvccRust context for CEA-708 decoder (Pha… #1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…se 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 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 60ae6fb...:
Your PR breaks these cases:
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. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit da03c1e...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
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. |
| const CCX_DTVCC_MAX_COLUMNS: u8 = 32 * 2; | ||
|
|
||
| /// Maximum number of CEA-708 services | ||
| pub const CCX_DTVCC_MAX_SERVICES: usize = 63; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have this: pub const DTVCC_MAX_SERVICES: usize = 63;
CCExtractor/ccextractor/src/rust/lib_ccxr/src/common/constants.rs
…se 1)
This is Phase 1 of the fix for issue #1499. It adds the Rust-side infrastructure for a persistent CEA-708 decoder context without modifying any C code, ensuring backward compatibility.
It's based on #1618. That PR doesn't merge cleanly and it contains stuff that we already have -possibly implemented differently-.
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:
Changes:
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: #1499 (partial)