@@ -224,7 +224,12 @@ int do_cb(struct lib_cc_decode *ctx, unsigned char *cc_block, struct cc_subtitle
224224void dinit_cc_decode (struct lib_cc_decode * * ctx )
225225{
226226 struct lib_cc_decode * lctx = * ctx ;
227+ #ifndef DISABLE_RUST
228+ ccxr_dtvcc_free (lctx -> dtvcc_rust );
229+ lctx -> dtvcc_rust = NULL ;
230+ #else
227231 dtvcc_free (& lctx -> dtvcc );
232+ #endif
228233 dinit_avc (& lctx -> avc_ctx );
229234 ccx_decoder_608_dinit_library (& lctx -> context_cc608_field_1 );
230235 ccx_decoder_608_dinit_library (& lctx -> context_cc608_field_2 );
@@ -294,10 +299,16 @@ struct lib_cc_decode *init_cc_decode(struct ccx_decoders_common_settings_t *sett
294299 ctx -> no_rollup = setting -> no_rollup ;
295300 ctx -> noscte20 = setting -> noscte20 ;
296301
302+ #ifndef DISABLE_RUST
303+ ctx -> dtvcc_rust = ccxr_dtvcc_init (setting -> settings_dtvcc );
304+ ctx -> dtvcc = NULL ; // Not used when Rust is enabled
305+ #else
297306 ctx -> dtvcc = dtvcc_init (setting -> settings_dtvcc );
298307 if (!ctx -> dtvcc )
299308 fatal (EXIT_NOT_ENOUGH_MEMORY , "In init_cc_decode: Out of memory initializing dtvcc." );
300309 ctx -> dtvcc -> is_active = setting -> settings_dtvcc -> enabled ;
310+ ctx -> dtvcc_rust = NULL ;
311+ #endif
301312
302313 if (setting -> codec == CCX_CODEC_ATSC_CC )
303314 {
@@ -477,6 +488,13 @@ void flush_cc_decode(struct lib_cc_decode *ctx, struct cc_subtitle *sub)
477488 }
478489 }
479490 }
491+ #ifndef DISABLE_RUST
492+ if (ccxr_dtvcc_is_active (ctx -> dtvcc_rust ))
493+ {
494+ ctx -> current_field = 3 ;
495+ ccxr_flush_active_decoders (ctx -> dtvcc_rust );
496+ }
497+ #else
480498 if (ctx -> dtvcc -> is_active )
481499 {
482500 for (int i = 0 ; i < CCX_DTVCC_MAX_SERVICES ; i ++ )
@@ -491,6 +509,7 @@ void flush_cc_decode(struct lib_cc_decode *ctx, struct cc_subtitle *sub)
491509 }
492510 }
493511 }
512+ #endif
494513}
495514struct encoder_ctx * copy_encoder_context (struct encoder_ctx * ctx )
496515{
0 commit comments