Playout

When the table containing the EPG data is build only half of the job is done. The table, the EIT - Event Information Table, has to be sent to the multiplexer. There it will be multiplexed into the final output stream.

For continuously sending the EIT to the multiplexer cherryEPG has implemented a play-out carousel, which is called ringelspiel. The tool is controlled by systemctl and immediately launched as daemon after system startup.

When running, ringelspiel is watching the /var/lib/cherryepg/carousel/ directory for .cts files.

The .cts file format

The cherry transport stream file format is basically a transport stream file like the .ts format. You can look at it with tools like DVB Inspector1, dvbsnoop or any other MPEG transport stream analyzer tool.

The difference between .cts and .ts is only the additional transport stream packet at the beginning of the file. It has a packet identification PID of 0x1fff which indicates that it is just a null packet which is typically used as stuffing and contains no data.

In cherryEPG this null packet is used for sending information to the playout carousel - ringelspiel.

The payload of this packet contains a JSON formatted string:

{
  "dst": "239.10.10.10:5500",
  "interval": 2000,
  "title": "my testfile"
}

Following fields are required:

  • dst - the destination unicast/multicast address and port separated by a colon,
  • interval or bitrate - the repetition interval in milliseconds or bitrate in bps,
  • title - title or naming for the chunk is used as a short description which is then shown in the web-view of the carousel.

There can be also some optional flags.

As soon as a file with .cts extensions appears in the watched directory ringelspiel reads the first packet and starts to stream the content of the file (without the first packet) to the defined destination address and port. When multiple files with same destination and port exist, their content is multiplexed to the output.

If a file is updated the content is re-read and play-out changes accordingly. Also if the file is deleted.

ringelspiel is also handling the continuity counter.

Following flags can be set and are processed by the play-out carousel:

  • PCR - the output transport stream will contain packets with the Program Clock Reference PCR timestamps. The PID of these packets will be 0x1ffe,
  • TDT - the output transport stream will contain packets with the Time Date Table TDT. The date/time is taken from system time. According to MPEG and DVB the used PID is 0x14.
output streams

webview of carousel status

Bellow is a sample output of a .cts file containing a Service Description Table SDT.

dvbsnoop V1.4.50 -- http://dvbsnoop.sourceforge.net/

------------------------------------------------------------
TS-Packet: 00000001   PID: (Unkown PID), Length: 188 (0x00bc)
from file: sdt.cts
------------------------------------------------------------
Sync-Byte 0x47: 71 (0x47)
Transport_error_indicator: 0 (0x00)  [= packet ok]
Payload_unit_start_indicator: 0 (0x00)  [= Packet data continues]
transport_priority: 0 (0x00)
PID: 8191 (0x1fff)  [= Null Packet]
transport_scrambling_control: 0 (0x00)  [= No scrambling of TS packet payload]
adaptation_field_control: 1 (0x01)  [= no adaptation_field, payload only]
continuity_counter: 0 (0x00)  [= (sequence ok)]
Data-Bytes:
      0000:  72 69 6e 67 65 6c 73 70  69 65 6c 20 7b 22 74 69   ringelspiel {"ti
      0010:  74 6c 65 22 3a 20 22 53  44 54 22 2c 20 22 69 6e   tle": "SDT", "in
      0020:  74 65 72 76 61 6c 22 3a  20 31 39 30 30 2c 20 22   terval": 1900, "
      0030:  64 73 74 22 3a 20 22 32  33 39 2e 31 30 2e 31 30   dst": "239.10.10
      0040:  2e 31 3a 35 35 30 30 22  7d 00 ff ff ff ff ff ff   .1:5500"}.......
      0050:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      0060:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      0070:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      0080:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      0090:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      00a0:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
      00b0:  ff ff ff ff ff ff ff ff                            ........
==========================================================


------------------------------------------------------------
TS-Packet: 00000002   PID: (Unkown PID), Length: 188 (0x00bc)
from file: sdt.cts
------------------------------------------------------------
Sync-Byte 0x47: 71 (0x47)
Transport_error_indicator: 0 (0x00)  [= packet ok]
Payload_unit_start_indicator: 1 (0x01)  [= Packet data starts]
transport_priority: 0 (0x00)
PID: 17 (0x0011)  [= DVB Service Description Table (SDT), Bouquet Association Table (BAT)]
transport_scrambling_control: 0 (0x00)  [= No scrambling of TS packet payload]
adaptation_field_control: 1 (0x01)  [= no adaptation_field, payload only]
continuity_counter: 0 (0x00)  [= (sequence ok)]
    Payload: (len: 184)
        ==> pointer_field: 0 (0x00)
        ==> Section table: 66 (0x42)  [= Service Description Table (SDT) - actual transport stream]
    Data-Bytes:
          0000:  00 42 f0 2c 00 01 cf 00  00 00 01 ff 00 01 fc 80   .B.,............
          0010:  1b 48 19 16 0d 63 68 65  72 72 79 48 69 6c 6c 2e   .H...cherryHill.
          0020:  65 75 09 63 68 65 72 72  79 45 50 47 f0 78 e5 9b   eu.cherryEPG.x..
          0030:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0040:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0050:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0060:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0070:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0080:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          0090:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          00a0:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
          00b0:  ff ff ff ff ff ff ff ff                            ........
==========================================================


    TS sub-decoding (1 packet(s) stored for PID 0x0011):
    =====================================================
    TS contains Section...
    SI packet (length=47):
        PID:  17 (0x0011)  [= assigned for: DVB Service Description Table (SDT), Bouquet Association Table (BAT)]

        Guess table from table id...
        SDT-decoding....
        Table_ID: 66 (0x42)  [= Service Description Table (SDT) - actual transport stream]
        section_syntax_indicator: 1 (0x01)
        reserved_1: 1 (0x01)
        reserved_2: 3 (0x03)
        Section_length: 44 (0x002c)
        Transport_Stream_ID: 1 (0x0001)
        reserved_3: 3 (0x03)
        Version_number: 7 (0x07)
        current_next_indicator: 1 (0x01)  [= valid now]
        Section_number: 0 (0x00)
        Last_Section_number: 0 (0x00)
        Original_network_ID:  1 (0x0001)  [= Astra Satellite Network 19,2�E | Soci�t� Europ�enne des Satellites]
        reserved_4: 255 (0xff)


            Service_id: 1 (0x0001)  [=  --> refers to PMT program_number]
            reserved_1: 63 (0x3f)
            EIT_schedule_flag: 0 (0x00)
            EIT_present_following_flag: 0 (0x00)
            Running_status: 4 (0x04)  [= running]
            Free_CA_mode: 0 (0x00)  [= unscrambled]
            Descriptors_loop_length: 27 (0x001b)

                  DVB-DescriptorTag: 72 (0x48)  [= service_descriptor]
                  descriptor_length: 25 (0x19)
                  service_type: 22 (0x16)  [= advanced codec SD digital television service]
                  service_provider_name_length: 13 (0x0d)
                  service_provider_name: "cherryHill.eu"  -- Charset: Latin alphabet
                  service_name_length: 9 (0x09)
                  Service_name: "cherryEPG"  -- Charset: Latin alphabet

        CRC: 4034454939 (0xf078e59b)

All modification to .cts files must be atomic. This is easiest to accomplish if files are moved and not copied. cherryEPG is taking care of this for EIT files.


  1. Doesn’t show .ts files with less than 6 packets (1128 bytes)'. ↩︎