mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
[PR #1782] feat(rust): Add persistent DtvccRust context for CEA-708 decoder (Pha… #2510
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1782
State: closed
Merged: Yes
Fix CEA-708 Decoder State Persistence (Issue #1499)
This PR fully implements the fix for issue #1499. The Rust CEA-708 decoder was creating a new
Dtvccstruct on every call toccxr_process_cc_data(), causing all state to be reset and breaking stateful caption processing.Based on #1618, which doesn't merge cleanly and contains implementations that differ from current code.
Changes by Phase
Phase 1: Rust Core
DtvccRuststruct indecoder/mod.rsthat owns its decoder stateCCX_DTVCC_MAX_SERVICESconstant (63)lib.rs:ccxr_dtvcc_init(): Create persistent contextccxr_dtvcc_free(): Free context and all owned memoryccxr_dtvcc_set_encoder(): Set encoder (not available at init)ccxr_dtvcc_process_data(): Process CC data on persistent contextccxr_flush_active_decoders(): Flush all active decodersccxr_dtvcc_is_active(): Check if context is activeDtvccRustPhase 2: C Headers
void *dtvcc_rustfield tolib_cc_decodestruct inccx_decoders_structs.hccx_dtvcc.hfor init/free/process_data/is_activelib_ccx.hforccxr_dtvcc_set_encoderccx_decoders_common.hforccxr_flush_active_decodersPhase 3: C Implementation
ccx_decoders_common.c:init_cc_decode(): Useccxr_dtvcc_init()when Rust enableddinit_cc_decode(): Useccxr_dtvcc_free()when Rust enabledflush_cc_decode(): Useccxr_flush_active_decoders()when Rust enabledgeneral_loop.c: Set encoder viaccxr_dtvcc_set_encoder()at 3 locationsmp4.c: Useccxr_dtvcc_set_encoder()andccxr_dtvcc_process_data()#ifndef DISABLE_RUSTPhase 4: Bug Fix & Testing
ccxr_process_cc_data()to use persistentDtvccRustfromdec_ctx.dtvcc_rustinstead of creating newDtvccfromdec_ctx.dtvcc(which is NULL when Rust enabled)do_cb_dtvcc_rust()function for processing withDtvccRustTesting
Automated Tests
Manual Testing
Files Modified
src/rust/src/decoder/mod.rsDtvccRuststruct and methodssrc/rust/src/lib.rsccxr_process_cc_datasrc/lib_ccx/ccx_decoders_structs.hdtvcc_rustfieldsrc/lib_ccx/ccx_dtvcc.hsrc/lib_ccx/lib_ccx.hccxr_dtvcc_set_encoderdeclarationsrc/lib_ccx/ccx_decoders_common.hccxr_flush_active_decodersdeclarationsrc/lib_ccx/ccx_decoders_common.csrc/lib_ccx/general_loop.csrc/lib_ccx/mp4.cFixes: #1499