Skip to content

[FIX] telxcc: don't close the current page when another subtitle page's header arrives - #2427

Open
x15sr71 wants to merge 1 commit into
CCExtractor:masterfrom
x15sr71:fix/teletext-other-page-closes-caption
Open

x15sr71 wants to merge 1 commit into
CCExtractor:masterfrom
x15sr71:fix/teletext-other-page-closes-caption

Conversation

@x15sr71

@x15sr71 x15sr71 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

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

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

RT78, on sample 72 (dcada74…e1ce):

ccextractor <sample>.mpg --autoprogram --out=ttxt --latin1 --datets

Three captions that the RT78 reference shows for several seconds come out on master as a split second. Before #2292 they were zero-length (the third only in its first half).

Caption Reference Master
"Morsomt, Dennis, å skremme vettet av folk?" 3.70 s 40 ms
"Forretningspartneren min vil ha avtalen i havn innen en uke. Greit?" 5.62 s 40 ms
"Har dere problemer, får dere hjelp av meg personlig." 4.38 s split: "Har dere problemer," lasts 20 ms, then "får dere hjelp av meg personlig." alone

Cause

This sample carries three pages with the subtitle flag set, all in parallel transmission mode: 333 (the page RT78 extracts), 777, and 444 (headers only).

#725 added a de_ctr counter to telxcc.c (1b3598b, narrowed in 1513b7c). While our page has received rows, a subtitle-flagged header from another magazine is no longer ignored. It reaches process_page(), which ends our page at that header's timestamp and starts a new buffer.

At all three captions, a magazine-7 header (7FF, 7FF, 777) arrives 20–40 ms after page 333's header: after its rows for the first two, and between them for the third, which is why it splits. Page 333's next header comes 3.74, 5.66 and 4.42 s later, with the erase bit set and no rows.

ETS 300 706 §7.2.1, also quoted in the comment above these checks, says a page "is terminated by and excludes the next page header packet having the same magazine address in parallel transmission mode". So a magazine-7 header doesn't end page 333. FFmpeg's libzvbi decoder agrees: it shows each of the three as one page, with no change at the magazine-7 headers.

Issue #699 (last lines missing from .bin output) was fixed by #725's other change, which writes the final page at end of input (rcwt_loop(), telxcc_close()). In #725's review, alexbrt noted that "the fix for the multiple lines shouldn't affect timing at all".

Builds of #725 and its parent (the first two match the platform's output for those commits):

Build RT78 output The three captions
4438e6c (#725's parent) 84f651b… (test 676) 3.70 / 5.62 / 4.38 s
fdd5b6b (#725 merged) 1928f66… (test 677) 0 ms, 0 ms, split
fdd5b6b, only telxcc.c reverted 84f651b… 3.70 / 5.62 / 4.38 s

Fix

Remove de_ctr and the three conditions that use it, so headers of other pages are ignored again, as before #725. The end-of-input flush and the multi-page logic from #665 are unchanged.

Testing

Master (d7eb132e) vs master + this commit, built with linux/build -hardsubx (Ubuntu 24.04, aarch64):

Notes

  • Multi-page mode (--tpage 333 --tpage 777, not covered by any test) also changes: one caption split into three fragments becomes one, and two captions go from 40/60 ms to 2.06/3.74 s.

@x15sr71

x15sr71 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

The Linux build and format failures aren't from this change: ubuntu-latest moved to Ubuntu 26.04, which has no libgpac-dev. They should be fixed by #2428.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant