[PR #1931] [MERGED] fix(dvb): Enable OCR for all DVB subtitle streams, not just first #2732

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1931
Author: @cfsmp3
Created: 12/29/2025
Status: Merged
Merged: 12/29/2025
Merged by: @cfsmp3

Base: masterHead: fix/dvb-ocr-multi-stream-issue-1067


📝 Commits (3)

  • 3365a71 fix: Properly handle ATSC CC in private MPEG-2 streams
  • 25162fe chore: Add build directories to .gitignore
  • a71687e fix(dvb): Enable OCR for all DVB subtitle streams, not just first

📊 Changes

14 files changed (+17 additions, -39 deletions)

View changed files

📝 .gitignore (+2 -0)
📝 src/lib_ccx/avc_functions.c (+4 -5)
📝 src/lib_ccx/ccx_demuxer.c (+0 -1)
📝 src/lib_ccx/ccx_demuxer.h (+0 -1)
📝 src/lib_ccx/dvb_subtitle_decoder.c (+2 -3)
📝 src/lib_ccx/dvb_subtitle_decoder.h (+1 -1)
📝 src/lib_ccx/general_loop.c (+1 -5)
📝 src/lib_ccx/matroska.c (+1 -1)
📝 src/lib_ccx/ts_functions.c (+4 -14)
📝 src/lib_ccx/ts_info.c (+1 -1)
📝 src/lib_ccx/ts_tables.c (+1 -3)
📝 src/rust/src/common.rs (+0 -1)
📝 src/rust/src/ctorust.rs (+0 -1)
📝 src/rust/src/demuxer/common_types.rs (+0 -2)

📄 Description

Summary

  • Fixes OCR only working for the first DVB subtitle stream when multiple streams exist in a program
  • Removes the initialized_ocr flag that incorrectly prevented OCR initialization for subsequent streams
  • Each DVB decoder now gets its own OCR context, matching DVD and VOBSUB decoder behavior

Root Cause

The initialized_ocr flag was stored at the program level (pinfo->initialized_ocr), shared across all DVB subtitle streams within a program. When the first DVB stream was initialized, it set this flag to 1. Subsequent streams saw the flag was set and skipped OCR initialization, leaving them with ocr_ctx = NULL.

Test Plan

Tested with multi-language DVB sample containing Finnish (PID 0xCDF) and Dutch (PID 0xCE0) subtitle streams:

Before fix:

$ ccextractor test.ts -datapid 0xCE0 -ocrlang dut -out=srt
No captions were found in input.

After fix:

$ ccextractor test.ts -datapid 0xCE0 -ocrlang dut -out=srt
# Successfully extracts 5 subtitles

Both streams now extract correctly:

  • First stream (0xCDF): 2 subtitles
  • Second stream (0xCE0): 5 subtitles (was "No captions found" before)

Fixes #1067

🤖 Generated with Claude Code


🔄 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/1931 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/29/2025 **Status:** ✅ Merged **Merged:** 12/29/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/dvb-ocr-multi-stream-issue-1067` --- ### 📝 Commits (3) - [`3365a71`](https://github.com/CCExtractor/ccextractor/commit/3365a715a6e16a7db46a0e5b463e621237d7c40d) fix: Properly handle ATSC CC in private MPEG-2 streams - [`25162fe`](https://github.com/CCExtractor/ccextractor/commit/25162fe40a0d8e097cebe236a8b7231db86557dd) chore: Add build directories to .gitignore - [`a71687e`](https://github.com/CCExtractor/ccextractor/commit/a71687e19fb45f6a1bce9db34c5646f86be42e75) fix(dvb): Enable OCR for all DVB subtitle streams, not just first ### 📊 Changes **14 files changed** (+17 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) 📝 `src/lib_ccx/avc_functions.c` (+4 -5) 📝 `src/lib_ccx/ccx_demuxer.c` (+0 -1) 📝 `src/lib_ccx/ccx_demuxer.h` (+0 -1) 📝 `src/lib_ccx/dvb_subtitle_decoder.c` (+2 -3) 📝 `src/lib_ccx/dvb_subtitle_decoder.h` (+1 -1) 📝 `src/lib_ccx/general_loop.c` (+1 -5) 📝 `src/lib_ccx/matroska.c` (+1 -1) 📝 `src/lib_ccx/ts_functions.c` (+4 -14) 📝 `src/lib_ccx/ts_info.c` (+1 -1) 📝 `src/lib_ccx/ts_tables.c` (+1 -3) 📝 `src/rust/src/common.rs` (+0 -1) 📝 `src/rust/src/ctorust.rs` (+0 -1) 📝 `src/rust/src/demuxer/common_types.rs` (+0 -2) </details> ### 📄 Description ## Summary - Fixes OCR only working for the first DVB subtitle stream when multiple streams exist in a program - Removes the `initialized_ocr` flag that incorrectly prevented OCR initialization for subsequent streams - Each DVB decoder now gets its own OCR context, matching DVD and VOBSUB decoder behavior ## Root Cause The `initialized_ocr` flag was stored at the program level (`pinfo->initialized_ocr`), shared across all DVB subtitle streams within a program. When the first DVB stream was initialized, it set this flag to 1. Subsequent streams saw the flag was set and skipped OCR initialization, leaving them with `ocr_ctx = NULL`. ## Test Plan Tested with multi-language DVB sample containing Finnish (PID 0xCDF) and Dutch (PID 0xCE0) subtitle streams: **Before fix:** ``` $ ccextractor test.ts -datapid 0xCE0 -ocrlang dut -out=srt No captions were found in input. ``` **After fix:** ``` $ ccextractor test.ts -datapid 0xCE0 -ocrlang dut -out=srt # Successfully extracts 5 subtitles ``` Both streams now extract correctly: - First stream (0xCDF): 2 subtitles ✅ - Second stream (0xCE0): 5 subtitles ✅ (was "No captions found" before) Fixes #1067 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2732