Opened 8 months ago

Closed 7 months ago

#13382 closed Patch - Bug Fix (fixed)

User Defined DVB SDT descriptors seen as ATSC

Reported by: Klaas de Waal Owned by: Klaas de Waal
Priority: minor Milestone: 31.0
Component: MythTV - Channel Scanner Version: Master Head
Severity: medium Keywords: DVB ATSC SDT channelscan descriptor
Cc: Stuart Auchterlonie Ticket locked: no

Description (last modified by Stuart Auchterlonie)

A DVB-C channel scan with "mythtv-setup -v general,channel,chanscan" gives wrong output for some of the SDT descriptors. Especially descriptor 0xA3, which is shown by my "DVBInspector" analysis tool as "User Defined", is shown here as "Component Name". The descriptor decoding then fails completely as shown by the output fragment below for one of the TV channels (see last line, scroll to the end...):

2019-01-22 12:11:58.223338 I  ChannelScanSM(/dev/dvb/adapter3/frontend0): Got a Service Description Table (other)
2019-01-22 12:11:58.228999 I  SDT: TSID(0x81c) original_network_id(0x600) services(5)
2019-01-22 12:11:58.229005 I  Section (0) Last Section (0) IsCurrent (1)
2019-01-22 12:11:58.229012 I    Service # 0 SID(0x4cf5) eit_schd(t) eit_pf(t) encrypted(t)
2019-01-22 12:11:58.229015 I    Service descriptors length: 137
2019-01-22 12:11:58.229018 I      ServiceDescriptor: 24Kitchen HD  (TV)
2019-01-22 12:11:58.229029 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 12:11:58.229032 I        000  00 00 00 16                                       |....|
2019-01-22 12:11:58.229041 I      Unknown(212) Descriptor (0xd4) length(4). Dumping
2019-01-22 12:11:58.229045 I        000  00 06 00 01                                       |....|
2019-01-22 12:11:58.229054 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 12:11:58.229062 I        000  00 00 00 40                                       |...@|
2019-01-22 12:11:58.229066 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 12:11:58.229076 I        000  00 00 06 02                                       |....|
2019-01-22 12:11:58.229079 I      Unknown(215) Descriptor (0xd7) length(19). Dumping
2019-01-22 12:11:58.229088 I        000  01 01 10 32 34 6b 69 74  63 68 65 6e 5f 76 33 2e  |...24kitchen_v3.|
2019-01-22 12:11:58.229091 I        010  70 6e 67                                          |png|
2019-01-22 12:11:58.229101 I      Unknown(215) Descriptor (0xd7) length(19). Dumping
2019-01-22 12:11:58.229104 I        000  02 02 10 32 34 6b 69 74  63 68 65 6e 5f 76 33 2e  |...24kitchen_v3.|
2019-01-22 12:11:58.229119 I        010  70 6e 67                                          |png|
2019-01-22 12:11:58.229123 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 12:11:58.229132 I        000  00 00 06 03                                       |....|
2019-01-22 12:11:58.229135 I      ATSC PID Count Descriptor (0xa5) length(10). Dumping
2019-01-22 12:11:58.229145 I        000  08 00 00 02 78 00 00 00  00 00                    |....x.....|
2019-01-22 12:11:58.229163 I      Component Name Descriptor MultipleStringStructure    count(2) String #0 lang(x:7869192) String #1 lang(p:137328)  segment count(133)  Segment #0  ct(5) str(MSS unknown text compression 5)  Segment #1  ct(110) str(MSS unknown text compression 110)  Segment #2  ct(6) str(MSS unknown text compression 6)  Segment #3  ct(84) str(MSS unknown text compression 84)  Segment #4  ct(0) str()  Segment #5  ct(0) str()  Segment #6  ct(0) str()  Segment #7  ct(0) str()  Segment #8  ct(0) str()  Segment #9  ct(0) str()  Segment #10  ct(0) str()  Segment #11  ct(0) str()  Segment #12  ct(0) str()  Segment #13  ct(0) str()  Segment #14  ct(0) str()  Segment #15  ct(0) str()  Segment #16  ct(0) str()  Segment #17  ct(0) str()  Segment #18  ct(0) str()  Segment #19  ct(0) str()  Segment #20  ct(0) str()  Segment #21  ct(0) str()  Segment #22  ct(0) str()  Segment #23  ct(0) str()  Segment #24  ct(0) str()  Segment #25  ct(0) str()  Segment #26  ct(0) str()  Segment #27  ct(0) str()  Segment #28  ct(0) str()  Segment #29  ct(0) str()  Segment #30  ct(0) str()  Segment #31  ct(0) str()  Segment #32  ct(0) str()  Segment #33  ct(0) str()  Segment #34  ct(0) str()  Segment #35  ct(0) str()  Segment #36  ct(0) str()  Segment #37  ct(0) str()  Segment #38  ct(0) str()  Segment #39  ct(0) str()  Segment #40  ct(0) str()  Segment #41  ct(0) str()  Segment #42  ct(0) str()  Segment #43  ct(0) str()  Segment #44  ct(0) str()  Segment #45  ct(0) str()  Segment #46  ct(0) str()  Segment #47  ct(0) str()  Segment #48  ct(0) str()  Segment #49  ct(0) str()  Segment #50  ct(0) str()  Segment #51  ct(0) str()  Segment #52  ct(0) str()  Segment #53  ct(0) str()  Segment #54  ct(0) str()  Segment #55  ct(0) str()  Segment #56  ct(0) str()  Segment #57  ct(0) str()  Segment #58  ct(0) str()  Segment #59  ct(0) str()  Segment #60  ct(0) str()  Segment #61  ct(0) str()  Segment #62  ct(0) str()  Segment #63  ct(0) str()  Segme

The last two descriptors, "ATSC PID Count" (0xA5) and "Component Name" (0xA3), are presented as if they are ATSC descriptors. This is especially painful for the last one, "Component Name" (0xA3); the decoding clearly goes completely out of control.

The root cause is that mpegdescriptors.cpp contains only one list of descriptors that is used both for DVB and ATSC. Values below 0x80 are DVB (and MPEG) and values of 0x80 and above are ATSC (and SCTE).
However, DVB allows values from 0x80 to 0xFE as "user defined", as found in "Final draft ETSI EN 300 468 v1.13.1 (2012-04)", Table 12: "Possible location of descriptors", page 33.
The use of values above 0x80 in DVB is not a problem as long as the values are not used in ATSC; this is for instance the case with the descriptors 0x83 (logical channel numbers) and 0x88 (HD-simulcast logical channel numbers).
However, in my DVB-C signal there are also descriptors that conflict with the ATSC numbers, such as 0xA3 and 0xA5.

The mythtv code is written such that there is only one "MPEGDescriptor::toString" function that does the toString for all descriptors, both DVB and ATSC. This function is called from dvbtables.cpp and from atsctables.cpp.

The attached patch modifies dvbtables.cpp so that MPEGDescriptor::toString is only called for descriptors below 0x80; the other values are now printed as "User Defined" and the content is only printed as a hex dump. For this also mpegdescriptors.h is changed to allow calling hexdump() from anywhere.
This is the output for the same TV channel, now with the fix:

2019-01-22 14:29:03.238315 I  ChannelScanSM(/dev/dvb/adapter3/frontend0): Got a Service Description Table (other)
2019-01-22 14:29:03.239928 I  SDT: TSID(0x81c) original_network_id(0x600) services(5)
2019-01-22 14:29:03.239934 I  Section (0) Last Section (0) IsCurrent (1)
2019-01-22 14:29:03.239937 I    Service # 0 SID(0x4cf5) eit_schd(t) eit_pf(t) encrypted(t)
2019-01-22 14:29:03.239941 I    Service descriptors length: 137
2019-01-22 14:29:03.239944 I      ServiceDescriptor: 24Kitchen HD  (TV)
2019-01-22 14:29:03.239948 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 14:29:03.239951 I        000  00 00 00 16                                       |....|
2019-01-22 14:29:03.239954 I      User Defined Descriptor (0xd4) length(4). Dumping
2019-01-22 14:29:03.239958 I        000  00 06 00 01                                       |....|
2019-01-22 14:29:03.239961 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 14:29:03.239964 I        000  00 00 00 40                                       |...@|
2019-01-22 14:29:03.239968 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 14:29:03.239972 I        000  00 00 06 02                                       |....|
2019-01-22 14:29:03.239976 I      User Defined Descriptor (0xd7) length(19). Dumping
2019-01-22 14:29:03.239979 I        000  01 01 10 32 34 6b 69 74  63 68 65 6e 5f 76 33 2e  |...24kitchen_v3.|
2019-01-22 14:29:03.239983 I        010  70 6e 67                                          |png|
2019-01-22 14:29:03.239987 I      User Defined Descriptor (0xd7) length(19). Dumping
2019-01-22 14:29:03.239990 I        000  02 02 10 32 34 6b 69 74  63 68 65 6e 5f 76 33 2e  |...24kitchen_v3.|
2019-01-22 14:29:03.239994 I        010  70 6e 67                                          |png|
2019-01-22 14:29:03.239998 I      Private Data Specifier Descriptor (0x5f) length(4). Dumping
2019-01-22 14:29:03.240001 I        000  00 00 06 03                                       |....|
2019-01-22 14:29:03.240006 I      User Defined Descriptor (0xa5) length(10). Dumping
2019-01-22 14:29:03.240009 I        000  08 00 00 02 78 00 00 00  00 00                    |....x.....|
2019-01-22 14:29:03.240013 I      User Defined Descriptor (0xa3) length(29). Dumping
2019-01-22 14:29:03.240016 I        000  02 78 13 08 00 02 18 50  85 05 f5 e1 00 05 f5 e1  |.x.....P........|
2019-01-22 14:29:03.240020 I        010  0a 07 5b cd 15 11 e1 a3  00 2e 5b f2 71           |..[.......[.q|

Note: it is far more elegant to make separate DVBDescriptor::toString and ATSCDescriptor::toString functions, share the MPEG descriptors that are used by both but with separate tables for ATSC and DVB-specific descriptors. This can be done but please consider that this would then also touch the ATSC code and thus require testing with ATSC signals. The patch as given only modifies the DVB path and has been tested with the DVB-C signal.

Attachments (1)

20190122-dvb-sdt-descriptors.patch (2.1 KB) - added by Klaas de Waal 8 months ago.

Download all attachments as: .zip

Change History (5)

Changed 8 months ago by Klaas de Waal

comment:1 Changed 8 months ago by Stuart Auchterlonie

Description: modified (diff)
Milestone: needs_triage30.1
Owner: set to Stuart Auchterlonie
Status: newaccepted

comment:2 Changed 7 months ago by Stuart Auchterlonie

Owner: changed from Stuart Auchterlonie to Klaas de Waal
Status: acceptedassigned

comment:3 Changed 7 months ago by Klaas de Waal

Milestone: 30.131.0

comment:4 Changed 7 months ago by Klaas de Waal <kdewaal@…>

Resolution: fixed
Status: assignedclosed

In fb191e52d/mythtv:

DVB SDT descriptors above 0x80 now decoded as "User Defined" instead of as ATSC.
This problem occurs with a mythtv-setup channelscan when there are SDT descriptors
in the "User Defined" range, above 0x80. This range is also used for ATSC descriptors.
See the ticket for an extensive description.

Fixes #13382

Signed-off-by: Klaas de Waal <kdewaal@…>

Note: See TracTickets for help on using tickets.