Skip to content

Commit be239a5

Browse files
cfsmp3claude
andcommitted
fix: Restore teletext auto-detect mode for single-page extraction
The page update logic at line 1029-1035 was incorrectly updating tlt_config.page for all accepted pages, even in single-page auto-detect mode. This caused the auto-detect logic at line 979 to be bypassed because the first packet (even with an invalid page number like 0xFF) would set tlt_config.page, preventing proper auto-detection. The fix restricts the page update to multi-page mode only. In single-page mode, tlt_config.page is set exclusively by: 1. User specification (--tpage option) 2. Auto-detect logic (first valid subtitle page found) This fixes regression in SP Test 76 which uses sample 8c1615c1a84d4b9b34134bde8085214bb93305407e935edcdfd4c2fc522c215f.mpg with --autoprogram --out=ttxt --latin1. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 1d9f322 commit be239a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib_ccx/telxcc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,9 +1023,10 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
10231023
if (!accept_this_page && !(de_ctr && flag_subtitle && ctx->receiving_data == YES))
10241024
return;
10251025

1026-
// Update tlt_config.page to track the current page being received
1027-
// This is needed so process_page knows which page to tag the output with
1028-
if (accept_this_page && page_number != tlt_config.page)
1026+
// Update tlt_config.page to track the current page being received (multi-page mode only)
1027+
// In single-page mode, tlt_config.page is set by auto-detect logic or user specification
1028+
// This prevents overwriting auto-detect selection with an arbitrary page number
1029+
if (is_multi_page_mode() && accept_this_page && page_number != tlt_config.page)
10291030
{
10301031
tlt_config.page = page_number;
10311032
}

0 commit comments

Comments
 (0)