[PR #2007] [MERGED] fix: Correct progress time display for multi-program TS files #2808

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/2007
Author: @cfsmp3
Created: 1/10/2026
Status: Merged
Merged: 1/11/2026
Merged by: @cfsmp3

Base: masterHead: fix/multi-program-ts-progress-time


📝 Commits (1)

  • 1c781c2 fix: Correct progress time display for multi-program TS files

📊 Changes

3 files changed (+42 additions, -1 deletions)

View changed files

📝 src/lib_ccx/file_functions.c (+1 -0)
📝 src/lib_ccx/general_loop.c (+40 -1)
📝 src/lib_ccx/lib_ccx.h (+1 -0)

📄 Description

Summary

  • Fixes incorrect progress time display for multi-program transport stream files
  • Times now show correctly relative to file start instead of wildly jumping values

Problem

Multi-program TS files can have different PCR (Program Clock Reference) bases for each program. For example:

  • Program A: PCR base at 23 hours
  • Program B: PCR base at 25 hours

When processing such files, the progress time would jump between values based on which program's data was being processed:

1%  |  265:45  (from Program B)
2%  |  00:00   (from Program A)
3%  |  263:11  (from Program B)
...

This was confusing for a 6-second file!

Solution

Track the minimum timestamp offset seen across all programs and use that as the baseline:

  1. Add min_global_timestamp_offset field to track minimum (global_timestamp - min_global_timestamp)
  2. When displaying progress, use current_offset - min_offset as the time
  3. If current offset is > 60 seconds larger than minimum (indicating a different program with higher PCR base), fall back to showing time relative to the minimum baseline

Test Results

Multi-program DVB teletext sample (dvbt.ts, 6 seconds):

  • Before: 1% | 265:45, 2% | 00:00, 3% | 263:11 ... (jumping wildly)
  • After: 1% | 00:00, 2% | 00:00 ... 87% | 00:05, 100% | 00:00 (stable 0-5 second range)

Single-program DVB subtitle sample:

  • Before and after: 0% | 00:00 ... 100% | 00:34 (no change, still works correctly)

Test plan

  • Build succeeds
  • Multi-program TS file shows reasonable times
  • Single-program TS file timing unaffected
  • Live stream mode updated with same fix

🤖 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/2007 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 1/10/2026 **Status:** ✅ Merged **Merged:** 1/11/2026 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/multi-program-ts-progress-time` --- ### 📝 Commits (1) - [`1c781c2`](https://github.com/CCExtractor/ccextractor/commit/1c781c2a382083002207f85733233a938253bf44) fix: Correct progress time display for multi-program TS files ### 📊 Changes **3 files changed** (+42 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/file_functions.c` (+1 -0) 📝 `src/lib_ccx/general_loop.c` (+40 -1) 📝 `src/lib_ccx/lib_ccx.h` (+1 -0) </details> ### 📄 Description ## Summary - Fixes incorrect progress time display for multi-program transport stream files - Times now show correctly relative to file start instead of wildly jumping values ## Problem Multi-program TS files can have different PCR (Program Clock Reference) bases for each program. For example: - Program A: PCR base at 23 hours - Program B: PCR base at 25 hours When processing such files, the progress time would jump between values based on which program's data was being processed: ``` 1% | 265:45 (from Program B) 2% | 00:00 (from Program A) 3% | 263:11 (from Program B) ... ``` This was confusing for a 6-second file! ## Solution Track the minimum timestamp offset seen across all programs and use that as the baseline: 1. Add `min_global_timestamp_offset` field to track minimum (global_timestamp - min_global_timestamp) 2. When displaying progress, use `current_offset - min_offset` as the time 3. If current offset is > 60 seconds larger than minimum (indicating a different program with higher PCR base), fall back to showing time relative to the minimum baseline ## Test Results **Multi-program DVB teletext sample (dvbt.ts, 6 seconds):** - Before: `1% | 265:45`, `2% | 00:00`, `3% | 263:11` ... (jumping wildly) - After: `1% | 00:00`, `2% | 00:00` ... `87% | 00:05`, `100% | 00:00` (stable 0-5 second range) **Single-program DVB subtitle sample:** - Before and after: `0% | 00:00` ... `100% | 00:34` (no change, still works correctly) ## Test plan - [x] Build succeeds - [x] Multi-program TS file shows reasonable times - [x] Single-program TS file timing unaffected - [x] Live stream mode updated with same fix 🤖 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:24:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2808