Parsing Service Description Tables in DVB streamsParseServiceDescriptionTable parses a reconstructed PSI table from a DVB MPEG Transport Stream, and outputs a dictionary containing the data in the table. The purpose of the SDT and details of the fields within in are defined in the DVB SI specification, including the possible 'descriptor' fields that feature in the table:
See Kamaelia.Support.DVB.Descriptors for information on how they are parsed. Example UsageA simple pipeline to receive, parse and display the Service Description Table applying to the transport stream (MUX) being received ("actual TS"): FREQUENCY = 505.833330 feparams = { "inversion" : dvb3.frontend.INVERSION_AUTO, "constellation" : dvb3.frontend.QAM_16, "code_rate_HP" : dvb3.frontend.FEC_3_4, "code_rate_LP" : dvb3.frontend.FEC_3_4, } SID_Actual_PID = 0x11 Pipeline( DVB_Multiplex(FREQUENCY, [SID_Actual_PID], feparams), DVB_Demuxer({ SID_Actual_PID:["outbox"]}), ReassemblePSITables(), ParseServiceDescriptionTable_ActualTS(), PrettifyServiceDescriptionTable(), ConsoleEchoer(), ).run() A simple pipeline to receive and parse the Service Description Table then convert it to a simple list mapping service names to service ids: Pipeline( DVB_Multiplex(FREQUENCY, [SID_Actual_PID], feparams), DVB_Demuxer({ SID_Actual_PID:["outbox"]}), ReassemblePSITables(), ParseServiceDescriptionTable_ActualTS(), SDT_to_SimpleServiceList(), ConsoleEchoer(), ).run() ParseServiceDescriptionTableBehaviourAt initialisation, specify whether you want ParseServiceDescriptionTables to parse 'actual' or 'other' tables (or both). 'Actual' tables describe services within the actual transport stream the table is it. 'Other' tables describe services carried in other transport streams - ie. broadcast in a different MUX in the same network. For example: ParseServiceDescriptionTable(acceptTables = {0x42:"ACTUAL",0x46:"OTHER"}) There are shorthands available for the various combinations: ParseServiceDescriptionTable_ActualTS() ParseServiceDescriptionTable_OtherTS() ParseServiceDescriptionTable_ActualAndOtherTS(): Send reconstructed PSI table 'sections' to the "inbox" inbox. When all sections of the table have arrived, ParseServiceDescriptionTable will parse the table and send it out of its "outbox" outbox. If the table is unchanged since last time it was parsed, then it will not be sent out. Parsed tables are only sent out when they are new or have just changed. The parsed table is sent out as a dictionary data structure, similar to this (the 'streams' list here is abridged for brevity): { 'actual_other' : 'ACTUAL', 'table_type' : 'SDT', 'current' : 1, 'original_network_id' : 9018, 'table_id' : 66, 'services': { 4228: { 'running_status' : 4, 'free_CA_mode' : 0, 'eit_present_following': 1, 'eit_schedule' : 2, 'descriptors': [ ( 72, { 'type': 'service', 'service_name': 'BBC TWO', 'service_type': 'digital television service', 'service_provider_name': 'BBC' } ), (115, { 'type': 'UNKNOWN', 'contents': 'fp.bbc.co.uk' } ) ] }, 4164: { 'running_status' : 4, 'free_CA_mode' : 0, 'eit_present_following': 1, 'eit_schedule' : 2, 'descriptors': [ ( 72, { 'type': 'service', 'service_name': 'BBC ONE', 'service_type': 'digital television service', 'service_provider_name': 'BBC' } ), (115, { 'type': 'UNKNOWN', 'contents': 'fp.bbc.co.uk' } ) ] }, ..... 4671: { 'running_status': 4, 'free_CA_mode' : 0, 'eit_present_following': 1, 'eit_schedule' : 2, 'descriptors': [ ( 72, { 'type': 'service', 'service_name': 'CBBC Channel', 'service_type': 'digital television service', 'service_provider_name': 'BBC' } ), (115, { 'type': 'UNKNOWN', 'contents': 'fp.bbc.co.uk' } ) ] } }, 'transport_stream_id': 4100 } This table contains information about the services within the transport stream. It lists the services (channels) including their names. types, and the fact that there is now & next data (eit_present_following) and Electronic Programme Guide (eit_schedule) data available for each of them. This is part of an instantaneous snapshot of the SDT broadcast from Crystal Palace MUX 1 (505.8MHz) in the UK on 21th Dec 2006. If this data is sent on through a PrettifyServiceDescriptionTable component, then the equivalent output is a string containing the following (again, abridged here for brevity): Table ID : 66 Table is valid for : CURRENT (valid) Actual or Other n/w: ACTUAL Transport stream id: 4100 Original network id: 9018 Services: Service id : 4228 EIT present_following? : YES EIT schedule? : YES Running status : 4 (RUNNING) Scrambled? : NO Service descriptors: Descriptor 0x48 : service service_name : 'BBC TWO' service_provider_name : 'BBC' service_type : 'digital television service' Descriptor 0x73 : UNKNOWN contents : 'fp.bbc.co.uk' Service id : 4164 EIT present_following? : YES EIT schedule? : YES Running status : 4 (RUNNING) Scrambled? : NO Service descriptors: Descriptor 0x48 : service service_name : 'BBC ONE' service_provider_name : 'BBC' service_type : 'digital television service' Descriptor 0x73 : UNKNOWN contents : 'fp.bbc.co.uk' ..... Service id : 4671 EIT present_following? : YES EIT schedule? : YES Running status : 4 (RUNNING) Scrambled? : NO Service descriptors: Descriptor 0x48 : service service_name : 'CBBC Channel' service_provider_name : 'BBC' service_type : 'digital television service' Descriptor 0x73 : UNKNOWN contents : 'fp.bbc.co.uk' ParseServiceDescriptionTable can collect the sections of, and then parse, both 'current' and 'next' tables simultaneously. See the "DVB SI" specifications for information on the purposes of the descriptor fields that appear in various parts of this table. See Kamaelia.Support.DVB.Descriptors for information on how each is parsed. If a shutdownMicroprocess or producerFinished message is received on the "control" inbox, then it will immediately be sent on out of the "signal" outbox and the component will then immediately terminate. How does it work?ParseServiceDescriptionTable logs all the table sections it receives, until it determines it has the complete set; then it parses them. If the version number field in any table section changes, then the log is cleared, and the component starts collecting the sections again from scratch. SDT_to_SimpleServiceListBehaviourSend parsed service description tables to this component's "inbox" inbox and a dictionary mapping service names to service ids will be sent out the "outbox" outbox. For example: { 'BBCi' : 4479, 'BBC ONE' : 4164, 'BBC TWO' : 4228, 'CBBC Channel': 4671, 'BBC NEWS 24' : 4415, 'BBC THREE' : 4351 } If a shutdownMicroprocess or producerFinished message is received on the "control" inbox, then it will immediately be sent on out of the "signal" outbox and the component will then immediately terminate. Kamaelia.Device.DVB.Parse.ParseServiceDescriptionTable.ParseServiceDescriptionTableclass ParseServiceDescriptionTable(Axon.Component.component)ParseServiceDescriptionTable([acceptTables]) -> new ParseServiceDescriptionTable component. Send reconstructed PSI table sections to the "inbox" inbox. When a complete table is assembled and parsed, the result is sent out of the "outbox" outbox as a dictionary. Doesn't emit anything again until the version number of the table changes. Keyword arguments: - acceptTables - dict of (table_id,string_description) mappings for tables to be accepted (default={0x42:"ACTUAL",0x46:"OTHER"}) Inboxes
Outboxes
Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. Kamaelia.Device.DVB.Parse.ParseServiceDescriptionTable.ParseServiceDescriptionTable_ActualAndOtherTSprefab: ParseServiceDescriptionTable_ActualAndOtherTSParseServiceDescriptionTable_ActualAndOtherTS() -> new ParseServiceDescriptionTable component. Instantiates a ParseServiceDescriptionTable component configured to parse both 'ACTUAL' and 'OTHER TS' tables (table ids 0x42 and 0x46) Kamaelia.Device.DVB.Parse.ParseServiceDescriptionTable.ParseServiceDescriptionTable_ActualTSprefab: ParseServiceDescriptionTable_ActualTSParseServiceDescriptionTable_ActualTS() -> new ParseServiceDescriptionTable component. Instantiates a ParseServiceDescriptionTable component configured to parse 'ACTUAL TS' tables only (table id 0x42) Kamaelia.Device.DVB.Parse.ParseServiceDescriptionTable.ParseServiceDescriptionTable_OtherTSprefab: ParseServiceDescriptionTable_OtherTSParseServiceDescriptionTable_OtherTS() -> new ParseServiceDescriptionTable component. Instantiates a ParseServiceDescriptionTable component configured to parse 'OTHER TS' tables only (table id 0x46) Kamaelia.Device.DVB.Parse.ParseServiceDescriptionTable.SDT_to_SimpleServiceListclass SDT_to_SimpleServiceList(Axon.Component.component)SDT_to_SimpleServiceList() -> new SDT_to_SimpleServiceList component. Converts parsed Service Description Tables to a simplified list of services. Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. FeedbackGot a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording! Please leave you feedback here in reply to the documentation thread in the Kamaelia blog. -- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.