mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #2060] [CLOSED] [FIX] DVB subtitle OCR and SPUPNG output for options test on Linux #2869
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/CCExtractor/ccextractor/pull/2060
Author: @aniketchawardol
Created: 1/24/2026
Status: ❌ Closed
Base:
master← Head:fix/dvb-subtitle-ocr-spupng-v2📝 Commits (2)
3b7e1b3Fix DVB subtitle OCR extraction and SPUPNG outputd5689deupdate changelog📊 Changes
3 files changed (+21 additions, -9 deletions)
View changed files
📝
docs/CHANGES.TXT(+3 -0)📝
src/lib_ccx/ccx_encoders_spupng.c(+0 -6)📝
src/lib_ccx/dvb_subtitle_decoder.c(+18 -3)📄 Description
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
When processing DVB subtitles from the options test file, three things were wrong:
OCR text extraction failed completely - the code tried to use an undefined variable called "region" which didn't exist in that function scope. This caused crashes or garbage data.
SPUPNG XML output was missing the opening and closing wrapper tags. The file would start with individual subtitle entries but had no and tags around them. This happened because the header writing function was immediately writing the footer and freeing all data structures before any subtitle content could be written.
DVB subtitle regions were being processed repeatedly. After extracting text from a region, the code never marked it as processed by clearing its dirty flag, so the same regions kept getting processed over and over causing duplicate subtitle entries.
What was different in results:
Expected output had OCR text like "explosion" and "Safety remains our number one" inside the subtitle entries. Actual output had no OCR text at all because the extraction crashed.
Expected SPUPNG file structure was:
Actual output was just empty or missing the wrapper tags entirely.
How the fix works:
For OCR: Instead of using the undefined "region" variable, the code now loops through the display list to find the first valid region and uses that for the background color reference needed by the OCR function. This gives OCR the correct data to extract text from bitmap subtitles.
For SPUPNG structure: Removed the code block that was writing the footer immediately after the header. Now the header function only writes the header tags, subtitle content gets written in the middle, and the footer gets written later during normal cleanup. This produces the correct XML structure.
For duplicate processing: Added a loop at the end of subtitle processing that goes through all regions and sets their dirty flag to 0, marking them as already processed so they won't be processed again.
Added safety for non-OCR builds: When CCExtractor is compiled without OCR support, the code now explicitly sets OCR text pointers to NULL to prevent crashes from trying to use uninitialized memory.
All changes are minimal fixes that restore correct behavior without changing the overall architecture.
test link: https://sampleplatform.ccextractor.org/test/7992#
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.