Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/lib_ccx/ccx_decoders_xds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
#include "ccx_common_common.h"
#include "utility.h"

// declare rust implementation of process_xds_bytes (function)
extern void ccxr_process_xds_bytes(
struct ccx_decoders_xds_context *ctx,
unsigned char hi,
int lo);

// declare rust implementation of do_end_of_xds (function)
extern void ccxr_do_end_of_xds(
struct cc_subtitle *sub,
struct ccx_decoders_xds_context *ctx,
unsigned char expected_checksum);

// declare setter function for TS_START_OF_XDS from C code
extern void ccxr_set_ts_start_of_xds(long long value);

LLONG ts_start_of_xds = -1; // Time at which we switched to XDS mode, =-1 hasn't happened yet

static const char *XDSclasses[] =
Expand Down Expand Up @@ -238,6 +253,10 @@ void clear_xds_buffer(struct ccx_decoders_xds_context *ctx, int num)

void process_xds_bytes(struct ccx_decoders_xds_context *ctx, const unsigned char hi, int lo)
{
#ifndef DISABLE_RUST
ccxr_process_xds_bytes(ctx, hi, lo); // use the rust implementation
return;
#endif
int is_new;
if (!ctx)
return;
Expand Down Expand Up @@ -890,6 +909,11 @@ int xds_do_misc(struct ccx_decoders_xds_context *ctx)

void do_end_of_xds(struct cc_subtitle *sub, struct ccx_decoders_xds_context *ctx, unsigned char expected_checksum)
{
#ifndef DISABLE_RUST
ccxr_set_ts_start_of_xds(ts_start_of_xds);
ccxr_do_end_of_xds(sub, ctx, expected_checksum); // use the rust implementation
return;
#endif
int cs = 0;
int i;

Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/lib_ccx.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "avc_functions.h"
#include "teletext.h"

#include "ccx_decoders_xds.h"

#ifdef WITH_LIBCURL
#include <curl/curl.h>
#endif
Expand Down
1 change: 1 addition & 0 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ lib_ccxr = { path = "lib_ccxr" }
url = "2.5.4"
serial_test = "3.2.0"
encoding_rs = "0.8.35"
libc = "0.2.178"

# Use CCExtractor's forked rsmpeg with FFmpeg 7
# All platforms use ffmpeg7 feature with prebuilt bindings for API consistency
Expand Down
1 change: 1 addition & 0 deletions src/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ fn main() {
"ccx_encoding_type",
"ccx_decoder_608_settings",
"ccx_decoder_608_report",
"ccx_decoders_xds_context",
"ccx_gxf",
"MXFContext",
"demuxer_data",
Expand Down
1 change: 1 addition & 0 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub mod libccxr_exports;
pub mod parser;
pub mod track_lister;
pub mod utils;
pub mod xds;

#[cfg(windows)]
use std::os::windows::io::{FromRawHandle, RawHandle};
Expand Down
6 changes: 3 additions & 3 deletions src/rust/src/libccxr_exports/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub unsafe extern "C" fn ccxr_millis_to_time(
/// # Safety
///
/// `ctx` should not be null.
unsafe fn generate_timing_context(ctx: *const ccx_common_timing_ctx) -> TimingContext {
pub unsafe fn generate_timing_context(ctx: *const ccx_common_timing_ctx) -> TimingContext {
let pts_set = match (*ctx).pts_set {
0 => PtsSet::No,
1 => PtsSet::Received,
Expand Down Expand Up @@ -206,7 +206,7 @@ unsafe fn generate_timing_context(ctx: *const ccx_common_timing_ctx) -> TimingCo
/// # Safety
///
/// `ctx` should not be null.
unsafe fn write_back_to_common_timing_ctx(
pub unsafe fn write_back_to_common_timing_ctx(
ctx: *mut ccx_common_timing_ctx,
timing_ctx: &TimingContext,
) {
Expand Down Expand Up @@ -275,7 +275,7 @@ unsafe fn write_back_to_common_timing_ctx(
/// # Safety
///
/// All the static variables should be initialized and in valid state.
unsafe fn apply_timing_info() {
pub(crate) unsafe fn apply_timing_info() {
let Ok(mut timing_info) = GLOBAL_TIMING_INFO.write() else {
// RwLock is poisoned, skip updating
return;
Expand Down
Loading
Loading