[FEAT] Port SRT encoder to Rust#2227
[FEAT] Port SRT encoder to Rust#2227DhanushVarma-2 wants to merge 1 commit intoCCExtractor:masterfrom
Conversation
d9b3a3a to
c6523ce
Compare
af58374 to
a1dc78a
Compare
|
The bitmap function can't be wired right now. CMake sets ENABLE_HARDSUBX for C code but never calls corrosion_set_features to pass hardsubx_ocr to the Rust crate. So the Rust function doesn't get compiled in hardsubx builds, and wiring it from C causes a linker error....that's what happened when the OCR Docker CI failed earlier. The Rust code is there and ready. To actually wire it, someone needs to add corrosion_set_features(ccx_rust hardsubx_ocr) inside the WITH_HARDSUBX block in CMakeLists.txt. I'll do that as a follow-up PR to keep this one clean. And yes get_teletext_output and get_teletext_srt_counter both exist in ccx_encoders_common.c (lines 1356 and 1460) |
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 03ad9e8...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
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. |
steel-bucket
left a comment
There was a problem hiding this comment.
Compare Master Branch SP test results and yours
| #ifndef DISABLE_RUST | ||
| extern int ccxr_write_stringz_as_srt(const char *string, struct encoder_ctx *context, LLONG ms_start, LLONG ms_end); | ||
| extern int ccxr_write_cc_buffer_as_srt(struct eia608_screen *data, struct encoder_ctx *context); |
There was a problem hiding this comment.
DISABLE_RUST is deprecated
| extern "C" { | ||
| fn get_decoder_line_encoded( | ||
| ctx: *mut encoder_ctx, | ||
| buffer: *mut c_uchar, | ||
| line_num: c_int, | ||
| data: *const eia608_screen, | ||
| ) -> c_uint; | ||
| } | ||
|
|
There was a problem hiding this comment.
Import Externs from the way we do in src/rust/src/lib.rs, not this way
a1dc78a to
43ef45f
Compare
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 74e3842...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
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. |
Implement ccxr_write_stringz_as_srt and ccxr_write_cc_buffer_as_srt in src/rust/src/encoder/srt.rs. Covers: - Subtitle counter and timestamp formatting with -1ms overlap prevention - \n unescape handling for multi-line subtitles - Encoding conversion (UTF-8, Latin1, UCS-2) - Autodash detection for CEA-608 screen buffers - Speaker name detection (colon-based) Uses existing Rust encoder infrastructure (encode_line, write_wrapped) and calls C get_decoder_line_encoded for CEA-608 line encoding until that function is also ported. Exported as #[no_mangle] extern C functions ready to replace the C versions in ccx_encoders_srt.c.
43ef45f to
043901b
Compare

Ported all 5 functions from ccx_encoders_srt.c to Rust:
Rust is called by default. C fallback behind #ifdef DISABLE_RUST.
Tested on Matroska test files (Elephant Dreams) with 8 subtitle tracks
including English and Hungarian with UTF-8 accented characters.
All extract correctly.