[PR #2048] [CLOSED] feat: Implement DVB Subtitle Splitting with Safe Parsing #2860

Closed
opened 2026-01-29 17:24:18 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/2048
Author: @Rahul-2k4
Created: 1/20/2026
Status: Closed

Base: masterHead: dvb-split-clean


📝 Commits (10+)

  • cca3e3c Cleanup: Finalize DVB split feature implementation
  • 7505524 Fix issues identified by CodeRabbit review
  • 042493f Fix clap validation and remove dead unsafe code
  • c6da9db Fix syntax errors and formatting in C files
  • f53026b Fix remaining indentation issues in general_loop.c
  • ac35e84 Fix issues identified by CodeRabbit (Round 2) and repair syntax
  • 394a994 Apply clang-format to C files
  • 0de8a15 Fix build: resolve brace mismatches in general_loop.c and apply clang-format
  • ec9df11 Fix DVB dedup PTS calc, guard process_cc_data in general_loop, and restore rcwt cleanup
  • 8db4939 Apply manual formatting fixes to match CI clang-format

📊 Changes

48 files changed (+2356 additions, -2623 deletions)

View changed files

.github/workflows/build_deb.yml (+0 -283)
.github/workflows/build_deb_debian13.yml (+0 -275)
📝 .github/workflows/build_docker.yml (+0 -4)
📝 .github/workflows/build_linux.yml (+0 -4)
📝 .github/workflows/build_mac.yml (+0 -4)
📝 .github/workflows/build_windows.yml (+0 -4)
📝 docs/CHANGES.TXT (+7 -0)
📝 linux/Makefile.am (+4 -2)
📝 linux/configure.ac (+2 -2)
📝 mac/Makefile.am (+2 -0)
📝 src/CMakeLists.txt (+1 -10)
📝 src/ccextractor.c (+2 -0)
📝 src/lib_ccx/CMakeLists.txt (+13 -6)
📝 src/lib_ccx/ccx_common_option.c (+3 -0)
📝 src/lib_ccx/ccx_common_option.h (+3 -1)
📝 src/lib_ccx/ccx_decoders_common.c (+2 -2)
📝 src/lib_ccx/ccx_decoders_structs.h (+3 -1)
📝 src/lib_ccx/ccx_demuxer.c (+8 -0)
📝 src/lib_ccx/ccx_demuxer.h (+28 -2)
📝 src/lib_ccx/ccx_encoders_common.c (+12 -11)

...and 28 more files

📄 Description

feat: Implement DVB Subtitle Splitting with Safe Parsing

Description

This PR implements the requested DVB subtitle splitting feature (--split-dvb-subs) and includes significant refactoring to ensure memory safety and robustness in Rust-C interop.

Key Changes

  1. DVB Splitting: Added --split-dvb-subs flag to extracting DVB subtitle tracks into separate output files (e.g., output_spa_0x00D3.srt).
  2. Safety Refactoring:
    • Refactored mkvlang parsing in common.rs and parser.rs to replace unwrap()/expect() with safe result handling, preventing panics on invalid inputs.
    • Strict Validation: parser.rs now strictly rejects ambiguous comma-separated mkvlang inputs (e.g., eng,fre) or empty inputs with a clear error message, rather than silently ignoring them or panicking.
  3. Bug Fixes:
    • Restored process_cc_data_flag check in avc/sei.rs (ANSI/SCTE 128 branch) to correctly skip invalid caption blocks.
    • Fixed PID conflict logic in parser.rs to correctly detect manual PID selection (ts_cappids) when validating against split logic.
    • Fixed last_string vs last_str struct member mismatch in ccx_encoders_srt.c.

Verification

  • Rust Tests: All 395 unit tests passed (cargo test).
  • Regression Testing: Validated against multiprogram_spain.ts.
    • Generated 5 distinct language .srt files + 1 main file.
    • Verified output consistency across multiple builds.
  • Strict Parsing: Verified that invalid mkvlang inputs (comma-separated, empty) are correctly rejected with helpful error messages.

Checklist

  • Code compiles/runs.
  • cargo test passes.
  • Functional regression tests pass.
  • Formatting checks pass.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/2048 **Author:** [@Rahul-2k4](https://github.com/Rahul-2k4) **Created:** 1/20/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `dvb-split-clean` --- ### 📝 Commits (10+) - [`cca3e3c`](https://github.com/CCExtractor/ccextractor/commit/cca3e3c898ed2b1212c81d55fb30502dbf8fa651) Cleanup: Finalize DVB split feature implementation - [`7505524`](https://github.com/CCExtractor/ccextractor/commit/750552457186496306ffb350dc6de79ee3b7c993) Fix issues identified by CodeRabbit review - [`042493f`](https://github.com/CCExtractor/ccextractor/commit/042493fdc0d2e4e6efb68a10d2782d36f5d12401) Fix clap validation and remove dead unsafe code - [`c6da9db`](https://github.com/CCExtractor/ccextractor/commit/c6da9db36499bb600905763b32abf2ef3eff65e0) Fix syntax errors and formatting in C files - [`f53026b`](https://github.com/CCExtractor/ccextractor/commit/f53026b601e0cb245e6fe92a92d87f3cd29f3a36) Fix remaining indentation issues in general_loop.c - [`ac35e84`](https://github.com/CCExtractor/ccextractor/commit/ac35e845a8ac9969c81ec417f5a491a0dbc71b92) Fix issues identified by CodeRabbit (Round 2) and repair syntax - [`394a994`](https://github.com/CCExtractor/ccextractor/commit/394a9941c5121b688ed2f4cffcea71d5511e287e) Apply clang-format to C files - [`0de8a15`](https://github.com/CCExtractor/ccextractor/commit/0de8a15cba73434305d6213296137fc43ccc9fb7) Fix build: resolve brace mismatches in general_loop.c and apply clang-format - [`ec9df11`](https://github.com/CCExtractor/ccextractor/commit/ec9df11d15d5b97ae88df7ba018985d9ac7f70d9) Fix DVB dedup PTS calc, guard process_cc_data in general_loop, and restore rcwt cleanup - [`8db4939`](https://github.com/CCExtractor/ccextractor/commit/8db493980725a1db1c0fc4c8c7b7f639597dc0d1) Apply manual formatting fixes to match CI clang-format ### 📊 Changes **48 files changed** (+2356 additions, -2623 deletions) <details> <summary>View changed files</summary> ➖ `.github/workflows/build_deb.yml` (+0 -283) ➖ `.github/workflows/build_deb_debian13.yml` (+0 -275) 📝 `.github/workflows/build_docker.yml` (+0 -4) 📝 `.github/workflows/build_linux.yml` (+0 -4) 📝 `.github/workflows/build_mac.yml` (+0 -4) 📝 `.github/workflows/build_windows.yml` (+0 -4) 📝 `docs/CHANGES.TXT` (+7 -0) 📝 `linux/Makefile.am` (+4 -2) 📝 `linux/configure.ac` (+2 -2) 📝 `mac/Makefile.am` (+2 -0) 📝 `src/CMakeLists.txt` (+1 -10) 📝 `src/ccextractor.c` (+2 -0) 📝 `src/lib_ccx/CMakeLists.txt` (+13 -6) 📝 `src/lib_ccx/ccx_common_option.c` (+3 -0) 📝 `src/lib_ccx/ccx_common_option.h` (+3 -1) 📝 `src/lib_ccx/ccx_decoders_common.c` (+2 -2) 📝 `src/lib_ccx/ccx_decoders_structs.h` (+3 -1) 📝 `src/lib_ccx/ccx_demuxer.c` (+8 -0) 📝 `src/lib_ccx/ccx_demuxer.h` (+28 -2) 📝 `src/lib_ccx/ccx_encoders_common.c` (+12 -11) _...and 28 more files_ </details> ### 📄 Description feat: Implement DVB Subtitle Splitting with Safe Parsing ## Description This PR implements the requested DVB subtitle splitting feature (`--split-dvb-subs`) and includes significant refactoring to ensure memory safety and robustness in Rust-C interop. ### Key Changes 1. **DVB Splitting**: Added `--split-dvb-subs` flag to extracting DVB subtitle tracks into separate output files (e.g., `output_spa_0x00D3.srt`). 2. **Safety Refactoring**: * Refactored `mkvlang` parsing in `common.rs` and `parser.rs` to replace `unwrap()`/`expect()` with safe result handling, preventing panics on invalid inputs. * **Strict Validation**: `parser.rs` now strictly rejects ambiguous comma-separated `mkvlang` inputs (e.g., `eng,fre`) or empty inputs with a clear error message, rather than silently ignoring them or panicking. 3. **Bug Fixes**: * Restored `process_cc_data_flag` check in `avc/sei.rs` (ANSI/SCTE 128 branch) to correctly skip invalid caption blocks. * Fixed PID conflict logic in `parser.rs` to correctly detect manual PID selection (`ts_cappids`) when validating against split logic. * Fixed `last_string` vs `last_str` struct member mismatch in `ccx_encoders_srt.c`. ## Verification - **Rust Tests**: All 395 unit tests passed (`cargo test`). - **Regression Testing**: Validated against `multiprogram_spain.ts`. - Generated 5 distinct language `.srt` files + 1 main file. - Verified output consistency across multiple builds. - **Strict Parsing**: Verified that invalid `mkvlang` inputs (comma-separated, empty) are correctly rejected with helpful error messages. ## Checklist - [x] Code compiles/runs. - [x] `cargo test` passes. - [x] Functional regression tests pass. - [x] Formatting checks pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:24:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2860