Skip to content

[FIX]: Properly decode DVB EIT start time BCD field in XMLTV output#2100

Merged
cfsmp3 merged 2 commits intoCCExtractor:masterfrom
x15sr71:fix/dvb-eit-bcd-start-time
Feb 7, 2026
Merged

[FIX]: Properly decode DVB EIT start time BCD field in XMLTV output#2100
cfsmp3 merged 2 commits intoCCExtractor:masterfrom
x15sr71:fix/dvb-eit-bcd-start-time

Conversation

@x15sr71
Copy link
Contributor

@x15sr71 x15sr71 commented Feb 7, 2026

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

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Description

This PR fixes improper BCD decoding in DVB EIT start time fields, which was causing invalid XMLTV timestamps.

Problem

As reported by @TPeterson94070 in #1835 (comment), CCExtractor was generating invalid start times in XMLTV output for DVB streams:

Example of broken output:

<programme start="202601311184512+0000" stop="20260131122400 +0000" channel="40001">

Root Cause

The EPG_DVB_calc_start_time() function printed the raw 24-bit BCD time field as a numeric value without decoding individual BCD nibbles into HH/MM/SS, which resulted in invalid timestamps.

Solution

Properly decode BCD nibbles for hours, minutes, and seconds, then use struct tm + mktime() for normalization - aligning with the existing EPG_DVB_calc_end_time() implementation.

Testing

Test stream: channel41.ts

Before Fix:

<programme start="202601311184512+0000" stop="20260131122400 +0000" channel="40001">
<programme start="202601311188864+0000" stop="20260131123500 +0000" channel="40001">
  • Invalid: BCD time values printed as raw decimal instead of being decoded ( channel41_epg.xml )

After Fix:

<programme start="20260131121300 +0000" stop="20260131122400 +0000" channel="40001">
<programme start="20260131122400 +0000" stop="20260131123500 +0000" channel="40001">

Validation:

# All timestamps parse correctly
grep 'programme start' channel41_epg.xml \
| sed -E 's/.*start="[0-9]{8}([0-9]{6}).*/\1/' \
| while read t; do
  h=${t:0:2}; m=${t:2:2}; s=${t:4:2}
  if [ "$h" -gt 23 ] || [ "$m" -gt 59 ] || [ "$s" -gt 59 ]; then
    echo "BAD: $t"
  fi
done
# Result: 0 invalid timestamps

And Successfully imported into @TPeterson94070's PVR application -#1835 (comment)

Impact

  • Fixes DVB EIT XMLTV output to generate valid timestamps
  • Aligns start time and stop time decoding logic
  • No changes to ATSC codepath
  • Enables DVB EPG support for downstream applications

@x15sr71 x15sr71 force-pushed the fix/dvb-eit-bcd-start-time branch from 9fdf204 to f920c16 Compare February 7, 2026 19:29
@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 5c05173...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 85/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed: Never
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed: Never
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 5c05173...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 81/86
Teletext 21/21
WTV 13/13
XDS 34/34

NOTE: The following tests have been failing on the master branch as well as the PR:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed:

    Test 8271

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed:

    Test 8271

  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed:

    Test 8271

  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8271

  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8271

  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8271

  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8271

  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8271


This PR does not introduce any new test failures. However, some tests are failing on both master and this PR (see above).

Check the result page for more info.

@cfsmp3 cfsmp3 merged commit 1028824 into CCExtractor:master Feb 7, 2026
22 of 23 checks passed
@x15sr71 x15sr71 deleted the fix/dvb-eit-bcd-start-time branch February 8, 2026 05:46
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.

3 participants