Skip to content

Commit 30097cc

Browse files
feat: Use of rust function due to initialization of dtvcc_rust in mp4.c
1 parent 8814fc9 commit 30097cc

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/lib_ccx/ccx_dtvcc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ void dtvcc_free(dtvcc_ctx **);
1313
#ifndef DISABLE_RUST
1414
extern void *ccxr_dtvcc_init(struct ccx_decoder_dtvcc_settings *settings_dtvcc);
1515
extern void ccxr_dtvcc_free(void *dtvcc_rust);
16+
extern void ccxr_dtvcc_process_data(void *dtvcc_rust, const unsigned char *data);
1617
#endif
1718

1819
#endif // CCEXTRACTOR_CCX_DTVCC_H

src/lib_ccx/mp4.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,14 @@ static int process_clcp(struct lib_ccx_ctx *ctx, struct encoder_ctx *enc_ctx,
417417
continue;
418418
}
419419
// WARN: otherwise cea-708 will not work
420+
421+
#ifndef DISABLE_RUST
422+
ccxr_dtvcc_set_encoder(dec_ctx->dtvcc_rust, enc_ctx);
423+
ccxr_dtvcc_process_data(dec_ctx->dtvcc_rust, (unsigned char *)temp);
424+
#else
420425
dec_ctx->dtvcc->encoder = (void *)enc_ctx;
421426
dtvcc_process_data(dec_ctx->dtvcc, (unsigned char *)temp);
427+
#endif
422428
cb_708++;
423429
}
424430
if (ctx->write_format == CCX_OF_MCC)

src/rust/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ extern "C" fn ccxr_dtvcc_set_encoder(dtvcc_rust: *mut Dtvcc, encoder: *mut encod
118118
unsafe { (*dtvcc_rust).encoder = encoder };
119119
}
120120

121+
extern "C" fn ccxr_dtvcc_process_data(dtvcc_rust: *mut Dtvcc, data: &[u8]) {
122+
unsafe { &mut (*dtvcc_rust) }.process_cc_data(data[0], data[1], data[2], data[3]);
123+
}
124+
121125
/// Process cc_data
122126
///
123127
/// # Safety

0 commit comments

Comments
 (0)