[PR #1864] [CLOSED] Automatic extraction of multiple DVB subtitle streams (--split-dvb-subs) fixes#447 #2638

Open
opened 2026-01-29 17:23:13 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1864
Author: @Rahul-2k4
Created: 12/20/2025
Status: Closed

Base: masterHead: feature/split-dvb-subs


📝 Commits (10+)

  • 48d633f Implement multi-stream DVB subtitle extraction (--split-dvb-subs)
  • 20421f7 Initial plan
  • 6cd26a6 Fix compiler errors in DVB multi-stream structures
  • 2b4faa7 Initial plan
  • e1b0271 Apply clang-format and rustfmt formatting fixes
  • eedaf08 Merge pull request #7 from Rahul-2k4/copilot/fix-clang-format-issues
  • b2de438 Merge branch 'CCExtractor:master' into master
  • 9e816a1 Merge branch 'CCExtractor:master' into test
  • 7889a41 Add --split-dvb-subs validation in Rust parser
  • f62c3e7 Merge branch 'CCExtractor:master' into feature/split-dvb-subs

📊 Changes

14 files changed (+400 additions, -5 deletions)

View changed files

📝 src/lib_ccx/ccx_common_option.c (+4 -0)
📝 src/lib_ccx/ccx_common_option.h (+4 -0)
📝 src/lib_ccx/ccx_demuxer.c (+4 -0)
📝 src/lib_ccx/ccx_demuxer.h (+20 -0)
📝 src/lib_ccx/dvb_subtitle_decoder.c (+65 -0)
📝 src/lib_ccx/dvb_subtitle_decoder.h (+38 -0)
📝 src/lib_ccx/general_loop.c (+15 -5)
📝 src/lib_ccx/lib_ccx.c (+127 -0)
📝 src/lib_ccx/lib_ccx.h (+10 -0)
📝 src/lib_ccx/ts_tables.c (+73 -0)
📝 src/rust/lib_ccxr/src/common/options.rs (+3 -0)
📝 src/rust/src/args.rs (+6 -0)
📝 src/rust/src/common.rs (+3 -0)
📝 src/rust/src/parser.rs (+28 -0)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.
    My familiarity with the project is as follows (check one):
  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

This PR adds support for automatic multi-stream DVB subtitle extraction via a new flag:

--split-dvb-subs

When enabled, CCExtractor:

  • Detects all DVB subtitle streams (descriptor 0x59) from the PMT
  • Creates independent demuxer + decoder contexts per stream
  • Routes each PID through its own pipeline
  • Prevents cross-stream state sharing or corruption
  • This fulfills the original intent of the context-based architecture for DVB decoding.

Key Implementation Details

1. Demuxer-Level Stream Discovery

  • PMT parsing now records all DVB subtitle PIDs (with language codes when available)
  • Streams are deduplicated and tracked in ccx_demuxer_context

2. Per-Stream Decoder Isolation

  • Each DVB subtitle stream gets its own ccx_decoders_dvb_context
  • No shared buffers or global decoder state
  • Explicit lifecycle management (dvb_init_decoder() / dvb_free_decoder())

3. Correct Buffer Handling

  • Multi-stream path now skips the 2-byte DVB PES header, matching legacy behavior
  • Prevents corrupted decoding and aligns with existing single-stream logic

4. Safety & Robustness Fixes

  • Null-safety added for demuxer context access
  • Removed dangling pointer to stack-allocated config
  • Fixed incorrect Rust demuxer field usage (ts_cappids.is_empty())

Testing Performed

Sample: arte_multiaudio.ts
PMT advertises two DVB subtitle streams (different PIDs and languages)
--split-dvb-subs correctly:

  • Discovers both streams
  • initializes separate pipelines
  • Avoids cross-stream interference or crashes

Observed behavior:
Teletext subtitles extract correctly
DVB subtitle streams produce no output, which appears expected:


🔄 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/1864 **Author:** [@Rahul-2k4](https://github.com/Rahul-2k4) **Created:** 12/20/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/split-dvb-subs` --- ### 📝 Commits (10+) - [`48d633f`](https://github.com/CCExtractor/ccextractor/commit/48d633f10b776ed3f98b67a5ed86affc0caa26d6) Implement multi-stream DVB subtitle extraction (--split-dvb-subs) - [`20421f7`](https://github.com/CCExtractor/ccextractor/commit/20421f74329f33b21581e29fc78f253126784061) Initial plan - [`6cd26a6`](https://github.com/CCExtractor/ccextractor/commit/6cd26a6c47903e076821f9e1b19883aaa0b3f508) Fix compiler errors in DVB multi-stream structures - [`2b4faa7`](https://github.com/CCExtractor/ccextractor/commit/2b4faa7a26d0eb94dd858a3f62906fe349b5522a) Initial plan - [`e1b0271`](https://github.com/CCExtractor/ccextractor/commit/e1b027162906e368cc540a3038c73803fd1fd5c5) Apply clang-format and rustfmt formatting fixes - [`eedaf08`](https://github.com/CCExtractor/ccextractor/commit/eedaf0889d4baf1669d0f0fec1b398349b38c0e5) Merge pull request #7 from Rahul-2k4/copilot/fix-clang-format-issues - [`b2de438`](https://github.com/CCExtractor/ccextractor/commit/b2de438b22c90217ad5615abdfe9e232734e043b) Merge branch 'CCExtractor:master' into master - [`9e816a1`](https://github.com/CCExtractor/ccextractor/commit/9e816a10effc006b29990536088eaa74e813f3de) Merge branch 'CCExtractor:master' into test - [`7889a41`](https://github.com/CCExtractor/ccextractor/commit/7889a410360fe654c7999d3111c4a410e3747b81) Add --split-dvb-subs validation in Rust parser - [`f62c3e7`](https://github.com/CCExtractor/ccextractor/commit/f62c3e772f1ac992d3269b0501830f0a2ea18509) Merge branch 'CCExtractor:master' into feature/split-dvb-subs ### 📊 Changes **14 files changed** (+400 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_common_option.c` (+4 -0) 📝 `src/lib_ccx/ccx_common_option.h` (+4 -0) 📝 `src/lib_ccx/ccx_demuxer.c` (+4 -0) 📝 `src/lib_ccx/ccx_demuxer.h` (+20 -0) 📝 `src/lib_ccx/dvb_subtitle_decoder.c` (+65 -0) 📝 `src/lib_ccx/dvb_subtitle_decoder.h` (+38 -0) 📝 `src/lib_ccx/general_loop.c` (+15 -5) 📝 `src/lib_ccx/lib_ccx.c` (+127 -0) 📝 `src/lib_ccx/lib_ccx.h` (+10 -0) 📝 `src/lib_ccx/ts_tables.c` (+73 -0) 📝 `src/rust/lib_ccxr/src/common/options.rs` (+3 -0) 📝 `src/rust/src/args.rs` (+6 -0) 📝 `src/rust/src/common.rs` (+3 -0) 📝 `src/rust/src/parser.rs` (+28 -0) </details> ### 📄 Description In raising this pull request, I confirm the following (please check boxes): - [ ] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [ ] I have checked that another pull request for this purpose does not exist. - [ ] I have considered, and confirmed that this submission will be valuable to others. - [ ] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [ ] I give this submission freely, and claim no ownership to its content. - [ ] I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT). My familiarity with the project is as follows (check one): - [ ] I have never used CCExtractor. - [ ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [x] I am an active contributor to CCExtractor. _____________________________________________________________________________________ This PR adds support for automatic multi-stream DVB subtitle extraction via a new flag: --split-dvb-subs **When enabled, CCExtractor:** - Detects all DVB subtitle streams (descriptor 0x59) from the PMT - Creates independent demuxer + decoder contexts per stream - Routes each PID through its own pipeline - Prevents cross-stream state sharing or corruption - This fulfills the original intent of the context-based architecture for DVB decoding. _____________________________________________________________________________________ ### **Key Implementation Details** **1. Demuxer-Level Stream Discovery** - PMT parsing now records all DVB subtitle PIDs (with language codes when available) - Streams are deduplicated and tracked in ccx_demuxer_context **2. Per-Stream Decoder Isolation** - Each DVB subtitle stream gets its own ccx_decoders_dvb_context - No shared buffers or global decoder state - Explicit lifecycle management (dvb_init_decoder() / dvb_free_decoder()) **3. Correct Buffer Handling** - Multi-stream path now skips the 2-byte DVB PES header, matching legacy behavior - Prevents corrupted decoding and aligns with existing single-stream logic **4. Safety & Robustness Fixes** - Null-safety added for demuxer context access - Removed dangling pointer to stack-allocated config - Fixed incorrect Rust demuxer field usage (ts_cappids.is_empty()) _______________________________________________________________________________________________________________________________________ ### **Testing Performed** Sample: [arte_multiaudio.ts](https://www.dropbox.com/s/5oaqnjgqq1cqzky/arte_multiaudio.ts?dl=0) **PMT advertises two DVB subtitle streams (different PIDs and languages) --split-dvb-subs correctly:** - Discovers both streams - initializes separate pipelines - Avoids cross-stream interference or crashes **Observed behavior:** Teletext subtitles extract correctly DVB subtitle streams produce no output, which appears expected: --- <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:23:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2638