What's in an enigma2 serviceref?

Moderators: Gully, peteru

Post Reply
prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

What's in an enigma2 serviceref?

Post by prl » Sat Aug 15, 2015 18:30

The tuning scan files like userbouquet.terrestrial_lcn.tv and /etc/enigma2/userbouquet.LastScanned.tv are full of them. They pop up all over the code.

But it's hard to find documentation about them.

Broadcast service servicerefs look like:
1:0:1:211:211:1010:EEEE0000:0:0:0:

It turns out that there is a fair bit of information about them scattered throughout the enigma2 source. I've tried to bring it all together here:

Code: Select all

Structure and interpretation of servicerefs
===========================================

REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED:PATH:NAME

"Printf" format of the string format of a serviceref:
    %d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%d:%s%s

=== REFTYPE ===

idInvalid      =   -1
idStructure    =    0         service_id == 0 is root
idDVB          =    1
idFile         =    2
idUser         = 4096/0x1000
idServiceMP3   = 4097/0x1001
HDMI IN        = 8192/0x2000

Defined in class eServiceReference in enigma2/lib/service/iservice.h,
except for HDMI IN valus.

=== FLAGS ===

isDirectory      =   1  SHOULD enter  (implies mustDescent)
mustDescent      =   2  cannot be played directly
canDescent       =   4  supports enterDirectory/leaveDirectory
flagDirectory    =   7  (isDirectory|mustDescent|canDescent)
shouldSort       =   8  should be ASCII-sorted according to service_name.
                        great for directories.
hasSortKey       =  16  has a sort key in data[3]. not having a sort key
                        implies 0.
sort1            =  32  sort key is 1 instead of 0
isMarker         =  64  Marker
isGroup          = 128  is a group of services
isNumberedMarker = 256  use together with isMarker,
                        to force the marker to be numbered
isInvisible      = 512  use together with isMarker and isNumberedMarker,
                        to force an empty number

Defined in class eServiceReference in enigma2/lib/service/iservice.h.

=== STYPE ===

stype  1 = digital television service
stype  4 = nvod reference service (NYI)
stype  2 = digital radio sound service
stype 10 = advanced codec digital radio sound service
stype 13 = ??? used for filler entries in
           /etc/enigma2/userbouquet.terrestrial_lcn.tv
stype 17 = MPEG-2 HD digital television service
stype 22 = advanced codec SD digital television
stype 24 = advanced codec SD NVOD reference service (NYI)
stype 25 = advanced codec HD digital television
stype 27 = advanced codec HD NVOD reference service (NYI)

Documented in enigma2/RecordTimer.py, except for stype 13.

=== DVB fields ===

SID         - Stream ID

TSID        - Transport stream ID

ONID        - Originating network ID

NS          - DVB namespace

PARENT_SID  - Service parent Stream ID

PARENT_TSID - Service parent Transport stream ID

=== "UNUSED" field ===

Is in fact used for servicerefs with idServiceMP3

0    no buffering
1    buffering enabled
3    progressive download and buffering enabled


Documented in enigma2/lib/service/servicemp3.cpp.

=== PATH ===

Path specifying the source of the service data. E.g. filesystem
path name for files being played, URL for streaming services,
directory pathname for isDirectory/mustDescent/canDescent services
in a file system. Empty for broadcast services and HDMI IN.

=== NAME ===

REFTYPE-dependent text data associated with the service ref. Used,
for example, to store additional filename extension mappings in
idFile servicerefs where any flagDirectory bits are set, to store
the playlist name in idServiceMP3 servicerefs, and to store service
name information in idDVB servicerefs.
/etc/enigma2/lcndb contains entries like:
eeee0000:1010:0211:0210:00024:00065535
that look superficially like servicerefs, but they are not servicerefs (though they do have some common fields).

Their fields are:
NS:ONID:TSID:SID:LCN:SIGNAL
and the format is:
"%x:%x%x%x:%u:%u".

Updated 25/8/15.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

User avatar
peteru
Uber Wizard
Posts: 9737
Joined: Tue Jun 12, 2007 23:06
Location: Sydney, Australia
Contact:

Re: What's in an enigma2 serviceref?

Post by peteru » Sat Aug 15, 2015 22:31

This would be great as a commit. Probably doc/SERVICEREF, to mirror the naming of the existing doco.

"Beauty lies in the hands of the beer holder."
Blog.

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Sat Aug 15, 2015 22:45

No problem.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Sun Aug 16, 2015 12:57

I've submitted the new doc/SERVICEREF document to the source repository.

I've also updated my original post to the version of the text that' s been submitted.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Tue Aug 25, 2015 18:34

Updated to include NAME field.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

stevebow
Master
Posts: 482
Joined: Thu Sep 03, 2015 11:21
Location: Sydney

Re: What's in an enigma2 serviceref?

Post by stevebow » Sun Jul 22, 2018 15:39

Isn't there an STYPE missing from the OP, namely 19 for mp4 HD?

Grumpy_Geoff
Uber Wizard
Posts: 6490
Joined: Thu Mar 05, 2009 22:54
Location: Perth

Re: What's in an enigma2 serviceref?

Post by Grumpy_Geoff » Sun Jul 22, 2018 15:51

stevebow wrote:
Sun Jul 22, 2018 15:39
Isn't there an STYPE missing from the OP, namely 19 for mp4 HD?

Nup. It is hexadecimal 19 or decimal 25.

stevebow
Master
Posts: 482
Joined: Thu Sep 03, 2015 11:21
Location: Sydney

Re: What's in an enigma2 serviceref?

Post by stevebow » Sun Jul 22, 2018 17:19

Ah right, a little trap there. Perhaps prl could add the hex equivalents (as done for a few REFTYPE entries), as the parameters as used are actually hex values and not decimal? I had assumed they were decimal as that is the format used by the REFTYPE values.

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Mon Jul 23, 2018 10:16

The best source for information about what's in a serviceref is in the source repository in doc/SERVICEREFS.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

stevebow
Master
Posts: 482
Joined: Thu Sep 03, 2015 11:21
Location: Sydney

Re: What's in an enigma2 serviceref?

Post by stevebow » Mon Jul 23, 2018 10:58

Ok, thanks. On second read-through, I see now the expected format: %d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%d:%s%s :roll:

User avatar
Altimes
Master
Posts: 242
Joined: Wed Jun 27, 2007 11:00
Location: Sydney

Re: What's in an enigma2 serviceref?

Post by Altimes » Mon Jul 23, 2018 11:02

FWIW, whilst writing myself a metadata editor, I found this breakdown of the STYPE byte on the web *somewhere* (I usually embed to the URL :? ) and have it as a comment in my code......from its style and looks it is probably from one of the ETSI DVB documents.

0x00 reserved for future use
0x01 digital television service (see note 1)
0x02 digital radio sound service (see note 2)
0x03 Teletext service
0x04 NVOD reference service (see note 1)
0x05 NVOD time-shifted service (see note 1)
0x06 mosaic service
0x07 FM radio service
0x08 DVB SRM service [48]
0x09 reserved for future use
0x0A advanced codec digital radio sound service
0x0B advanced codec mosaic service
0x0C data broadcast service
0x0D reserved for Common Interface Usage (EN 50221 [37])
0x0E RCS Map (see EN 301 790 [7])
0x0F RCS FLS (see EN 301 790 [7])
0x10 DVB MHP service
0x11 MPEG-2 HD digital television service
0x12 to 0x15 reserved for future use
0x16 advanced codec SD digital television service
0x17 advanced codec SD NVOD time-shifted service
0x18 advanced codec SD NVOD reference service
0x19 advanced codec HD digital television service
0x1A advanced codec HD NVOD time-shifted service
0x1B advanced codec HD NVOD reference service
0x1C to 0x7F reserved for future use
0x80 to 0xFE user defined
0xFF reserved for future use

Alan.

T4, 4TB
U4, (small SSD)
IceTV EPG
LG OLED65E8PTA
Akai AK5021S6WOS
Sony HT DDWG800
Wired Network via Telstra Max2 - ASUS RT-AX86U, Netgear DGND3700, GS108TV2, WNDR3700
Synology 918+

User avatar
Altimes
Master
Posts: 242
Joined: Wed Jun 27, 2007 11:00
Location: Sydney

Re: What's in an enigma2 serviceref?

Post by Altimes » Mon Jul 23, 2018 11:11

OK, so I searched again.....

It is table 81, page 68 from ETSI EN 300 468 V1.11.1 (2010-04) pdf document

Digital Video Broadcasting (DVB);
Specification for Service Information (SI) in DVB systems

https://www.etsi.org/deliver/etsi_en/30 ... 11101p.pdf

A document full of lots of super fine detailed and sometimes irrelevant (to a programmer) information.


[Edit]

Seems that there is a more recent version

https://www.etsi.org/deliver/etsi_en/30 ... 11501p.pdf

Where sadly it is not so clearcut as a simple table ... :(
(Looks like shoehorning in unexpected stuff like 3D)

Annex I (normative):
Assignment and interpretation of the service_type field

page 154.

[edit 2]

There is a simple table: table 87, page 77. Some of the 2010 ed. Reserved fields now taken.

Alan

T4, 4TB
U4, (small SSD)
IceTV EPG
LG OLED65E8PTA
Akai AK5021S6WOS
Sony HT DDWG800
Wired Network via Telstra Max2 - ASUS RT-AX86U, Netgear DGND3700, GS108TV2, WNDR3700
Synology 918+

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Mon Jul 23, 2018 17:40

Altimes wrote:
Mon Jul 23, 2018 11:11
A document full of lots of super fine detailed and sometimes irrelevant (to a programmer) information.

There's some truth to that, but when I'm programming (or trying to understand) parts of enigma2 the have to do with the processing of the DVB-T metadata, I very often have ETSI EN 300 468 open. That's mostly in the C++ code. There's not all that much in the Python code that needs reference to the standard, but there is some, like the string translations of genre and parental rating values, which need both ETSI EN 300 468 and Australian Standard As4599.1 (Digital television—Terrestrial broadcasting Part 1: Characteristics of digital terrestrial television transmissions). The FreeTV Operational Practice documents also come into play sometimes.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Re: What's in an enigma2 serviceref?

Post by prl » Mon Jul 23, 2018 17:46

prl wrote:
Mon Jul 23, 2018 10:16
The best source for information about what's in a serviceref is in the source repository in doc/SERVICEREFS.

That's doc/SERVICEREF.

It has service type values in both hex and decimal, because while the serviceref itself has the service type in hex, the code often uses decimal. :)
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

Post Reply

Return to “Developers Community”