Fix fragmented teletext subtitles by delaying flush until sentence completion#2106
Open
Apprentice2907 wants to merge 3 commits intoCCExtractor:masterfrom
Open
Conversation
cfsmp3
requested changes
Feb 15, 2026
Contributor
cfsmp3
left a comment
There was a problem hiding this comment.
Review
This PR shares the same first 3 commits (identical SHAs) as your other PR #2108. It contains the same mix of unrelated changes:
- README
--timestamp-mapdocs (already merged in #2065) - JSON report format feature (~500 lines)
- Teletext sentence-merging behavior change
Please close this PR and work from a clean branch structure. See my review on #2108 for the full breakdown of what needs to be split into separate PRs.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[FIX] Fix fragmented teletext subtitles by delaying flush until sentence completion
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Problem
In some teletext broadcasts, subtitles are transmitted as incremental fragments where only a few characters change between consecutive pages. CCExtractor currently flushes the previous subtitle whenever the fuzzy comparison detects a difference between pages, causing each fragment to be written as a separate subtitle entry.
Example of incorrect output:
Expected output:
Root Cause
The issue occurs in
process_page()insidetelxcc.c. Whenfuzzy_memcmp()detects a difference between the previous and current teletext page, the code immediately flushes the previous subtitle viatelxcc_dump_prev_page(ctx, sub). However, in some broadcasts, teletext pages are updated gradually, causing small differences that trigger premature flushing.Solution
This patch modifies the flushing logic so that the previous subtitle is only flushed if it ends with a sentence-terminating punctuation mark (
.,?,!,:). Otherwise, the current fragment is merged into the previous buffer and the subtitle is not flushed yet.This allows incremental teletext fragments to be combined into a complete subtitle before being written.
Changes
src/lib_ccx/telxcc.cprocess_page()fuzzy_memcmp()was adjustedTesting
Tested with:
Benefits