Builder

Creating or building the EIT output is the main task of cherryEPG. The builder takes schedule data of each service stored in the database and builds present/following and schedule tables.

The output of the builder is a 60 second transport stream chunk. The chunk is a recording of transport stream packets containing packetized EIT data. The data in this block must be repeated several times so that it can be displayed to the viewer as quickly as possible when changing programs. In order to save the bit rate, not all tables are repeated with the same frequency.

The repetition rate for tables is hard-coded inside cherryEPG1.

EIT table type Repetition time
EIT present/following actual every <2s
EIT present/following other every <10s
EIT schedule for 1 day actual every 10s
EIT schedule for 1 day other every 30s
EIT schedule > 1 day actual/other every 30s

The building process is started every 60 seconds. The builder checks every time whether there are changes in the database or whether an event has been started / stopped since the last creation. The output is only build when changes have occurred. This saves computing time.

To prevent the build process from running more than once at the same time, the builder checks whether a build process is currently running. In this case, the builder stops with a warning.

The building process is using multi-threading. The output is written in cherry transport stream file format to the /var/lib/cherryepg/carousel/ directory

The configuration of the builder is done by the scheme file. The columns relevant for configuring the builder are MaxSegments, Codepage and Language.

MaxSegments

In EPG a segment is a time interval of 3 hours starting an 00:00 midnight. The segment contains all events starting within this interval. The number of segments specifies the time frame for which schedule data will be build.

To build a schedule for 7 days in future the number of segments must be: 7 days x 8 segments/day = 56 segments

When only present/following tables are required, schedule table building can be also disabled. Therefore the number of segments should be 0.

Codepage

Event data inside cherryEPG is always UTF-8 encoded. Before building the EIT all text data is encoded to the final codepage. It is important that TV sets and STB support the chosen codepage.

According to DVB specification the used codepage is signaled by prefixing the text with special characters. Following codepages are currently supported:

codepage hex prefix
iso-8859-1 10 00 01
iso-8859-2 10 00 02
iso-8859-3 10 00 03
iso-8859-4 10 00 04
iso-8859-5 01
iso-8859-6 02
iso-8859-7 03
iso-8859-8 04
iso-8859-9 05
iso-8859-10 10 00 0a
iso-8859-11 10 00 0b
iso-8859-12 10 00 0c
iso-8859-13 10 00 0d
iso-8859-14 10 00 0e
iso-8859-15 10 00 0f
utf-8 15
latin-1 -

Language

Inside some of the descriptors used by EIT the used language is signaled. The language is signaled as 3-letter code according to ISO 639.

Control from Command-line

The builder is invoked from command-line with the cherryTool script.

cherryTool -B

makes the EIT ready for playing. The builder is called and if changes have occurred since the last creation, EIT is build.

To force the next creation of EIT regardless whether changes have occurred, we have to reset the section and version tables

cherryTool -f

this can be combined “force build” and by adding the verbose flag, it is possible to follow the building process in detail

cherryTool -fBv
cherryTool - ver. 2.1.3 Copyright 2022 Bojan Ramšak
Clean section and version tables
INFO  system   : reset section and version table [-|-]
Building
TRACE builder  : start eit multibuild with 16 tasks [-|-]
TRACE builder  : build EIT [-|1]
TRACE builder  : build EIT [-|4]
TRACE builder  : build EIT [-|6]
TRACE builder  : build EIT [-|2]
TRACE builder  : build EIT [-|3]
TRACE builder  : build EIT [-|7]
TRACE builder  : build EIT [-|5]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_005.tmp] [-|5]
TRACE player   : lock destination [eit_005.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_007.tmp] [-|7]
TRACE player   : lock destination [eit_007.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_006.tmp] [-|6]
TRACE player   : lock destination [eit_006.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_003.tmp] [-|3]
TRACE player   : lock destination [eit_003.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_001.tmp] [-|1]
TRACE player   : lock destination [eit_001.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_002.tmp] [-|2]
TRACE player   : lock destination [eit_002.cts] [-|-]
TRACE player   : export 22 bytes to [/var/lib/cherryepg/carousel/eit_004.tmp] [-|4]
TRACE player   : lock destination [eit_004.cts] [-|-]
spent: 1.01 s

  1. As sourcecode is provided, even this can be modified. ↩︎