TSDuck v3.38-3675
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::STT Class Reference

Representation of an ATSC System Time Table (STT) More...

#include <tsSTT.h>

Inheritance diagram for ts::STT:
Collaboration diagram for ts::STT:

Public Member Functions

 STT ()
 Default constructor.
 
 STT (const STT &other)
 Copy constructor.
 
 STT (DuckContext &duck, const BinaryTable &table)
 Constructor from a binary table.
 
 STT (DuckContext &duck, const Section &section)
 Constructor from a binary section.
 
virtual void clear () override final
 This method clears the content of the table or descriptor.
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
UString dataName (const UChar *section, INT value, NamesFlags flags=NamesFlags::NAME, size_t bits=0, INT alternate=0)
 Get a name from a specified section in the DVB names file for that signalization structure.
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object.
 
bool deserialize (DuckContext &duck, const BinaryTable &bin)
 This method deserializes a binary table.
 
void fromXML (DuckContext &duck, const xml::Element *element)
 This method converts an XML structure to a table or descriptor in this object.
 
void invalidate ()
 Invalidate this object.
 
virtual bool isPrivate () const
 Check if the table is a private one (ie.
 
bool isValid () const
 Check if this object is valid.
 
STToperator= (const STT &other)=default
 Assignment operator.
 
bool serialize (DuckContext &duck, BinaryTable &bin) const
 This method serializes a table.
 
TID tableId () const
 Get the table_id.
 
virtual uint16_t tableIdExtension () const override
 Get the table id extension.
 
xml::ElementtoXML (DuckContext &duck, xml::Element *parent) const
 This method converts this object to XML.
 
Time utcTime () const
 Convert the GPS system time in this object in a UTC time.
 
UString xmlName () const
 Get the XMl node name representing this table or descriptor.
 

Static Public Member Functions

template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
static UString DataName (const UChar *xml_name, const UChar *section, INT value, NamesFlags flags=NamesFlags::NAME, size_t bits=0, INT alternate=0)
 Get a name from a specified section in the DVB names file.
 
static void DisplaySection (ts::TablesDisplay &display, const ts::Section &section, ts::PSIBuffer &payload, const ts::UString &margin)
 A static method to display a section.
 

Public Attributes

DescriptorList descs
 Descriptor list.
 
uint8_t DS_day_of_month = 0
 Day of month (1-31) for DS transition, zero if none planned in the next 28 days.
 
uint8_t DS_hour = 0
 Hour of day for next DS transition, zero if none planned.
 
bool DS_status = false
 Daylight Saving time is on.
 
cn::seconds GPS_UTC_offset {}
 Current offset in seconds between GPS and UTC (UTC = GPS - GPS_UTC_offset)
 
bool is_current = true
 True if table is current, false if table is next.
 
uint8_t protocol_version = 0
 ATSC protocol version.
 
cn::seconds system_time {}
 Number of GPS seconds since 00:00:00 UTC, January 6th, 1980.
 
uint8_t version = 0
 Table version number.
 

Static Public Attributes

static const UChar *const XML_GENERIC_DESCRIPTOR
 XML tag name for generic descriptors.
 
static const UChar *const XML_GENERIC_LONG_TABLE
 XML tag name for generic tables with long sections.
 
static const UChar *const XML_GENERIC_SHORT_TABLE
 XML tag name for generic short sections.
 

Protected Member Functions

void addOneSection (BinaryTable &table, PSIBuffer &payload) const
 Helper method for serializePayload(): add a section in a binary table.
 
virtual void addOneSectionImpl (BinaryTable &, PSIBuffer &) const override
 Actual implementation of adding one section in a binary table.
 
virtual bool analyzeXML (DuckContext &, const xml::Element *) override
 Helper method to convert this object from XML.
 
virtual void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML.
 
virtual void clearContent () override
 Helper method to clear the content of the table or descriptor.
 
virtual void deserializePayload (PSIBuffer &, const Section &) override
 This abstract method deserializes the payload of one section.
 
virtual void deserializePayloadWrapper (PSIBuffer &, const Section &) override
 Wrapper for deserializePayload().
 
virtual bool isValidTableId (TID tid) const
 This method checks if a table id is valid for this object.
 
virtual size_t maxPayloadSize () const override
 Get the maximum size in bytes of the payload of sections of this table.
 
virtual void serializePayload (BinaryTable &, PSIBuffer &) const override
 This abstract method serializes the payload of all sections in the table.
 
virtual bool useTrailingCRC32 () const override
 Check if the sections of this table have a trailing CRC32.
 

Protected Attributes

TID _table_id = TID_NULL
 The table id can be modified by subclasses only.
 

Detailed Description

Representation of an ATSC System Time Table (STT)

See also
ATSC A/65, section 6.1.

Warning: The ATSC STT violates the common usage rules of MPEG sections, as defined in ISO/IEC 13818-1. An STT section is, by essence, unique. Each section carries a different system time. According the MPEG rules, this should be a short section, just like a TDT or TOT, its DVB counterparts. However, ATSC defines the STT as a long section with version zero. Normally, all consecutive sections with same tid, tid ext and version should be identical. But this is not the case with the ATSC STT. Specifically, when a SectionDemux is used, it reports only the first occurence of the STT because all subsequent sections have the same version. To be notified of all STT sections with a SectionDemux, it is necessary to provide a section handler, not a table handler.

Constructor & Destructor Documentation

◆ STT() [1/3]

ts::STT::STT ( const STT other)

Copy constructor.

Parameters
[in]otherOther instance to copy.

◆ STT() [2/3]

ts::STT::STT ( DuckContext duck,
const BinaryTable table 
)

Constructor from a binary table.

Parameters
[in,out]duckTSDuck execution context.
[in]tableBinary table to deserialize.

◆ STT() [3/3]

ts::STT::STT ( DuckContext duck,
const Section section 
)

Constructor from a binary section.

Parameters
[in,out]duckTSDuck execution context.
[in]sectionBinary section to deserialize.

Member Function Documentation

◆ operator=()

STT & ts::STT::operator= ( const STT other)
default

Assignment operator.

Parameters
[in]otherOther instance to copy.
Returns
A reference to this object.

◆ utcTime()

Time ts::STT::utcTime ( ) const

Convert the GPS system time in this object in a UTC time.

Returns
The system time as a UTC time or Time::Epoch if unset..

◆ tableIdExtension()

virtual uint16_t ts::STT::tableIdExtension ( ) const
overridevirtual

Get the table id extension.

The table id extension is a 16-bit field which usually contains one of the table fields (service id, transport stream id, etc.) For each subclass, the table id extension is usually directly available in the corresponding public field. This virtual method is a generic way to access the table id extension.

Returns
The table id extension.

Implements ts::AbstractLongTable.

◆ DisplaySection()

static void ts::STT::DisplaySection ( ts::TablesDisplay display,
const ts::Section section,
ts::PSIBuffer payload,
const ts::UString margin 
)
static

A static method to display a section.


Parameters
[in,out]displayDisplay engine.
[in]sectionThe section to display.
[in,out]payloadA PSIBuffer over the payload.
[in]marginLeft margin content.

◆ clearContent()

virtual void ts::STT::clearContent ( )
overrideprotectedvirtual

Helper method to clear the content of the table or descriptor.

It is called by clear(). In clearContent(), the subclass shall simply revert the value of all fields to their original values in the default constructor.

Implements ts::AbstractSignalization.

◆ maxPayloadSize()

virtual size_t ts::STT::maxPayloadSize ( ) const
overrideprotectedvirtual

Get the maximum size in bytes of the payload of sections of this table.

Returns
The maximum size in bytes of the payload of sections of this table.

Reimplemented from ts::AbstractLongTable.

◆ serializePayload()

virtual void ts::STT::serializePayload ( BinaryTable table,
PSIBuffer buf 
) const
overrideprotectedvirtual

This abstract method serializes the payload of all sections in the table.

When serialize() is called, the output binary table is cleared and serializePayload() is called. A subclass shall implement serializePayload() which adds all required sections in the binary table.

Note that it is not necessary to explicitly add the last (or only) section. Upon return from serializePayload(), serialize() checks the state of the payload buffer. If the output binary table is still empty or if the payload buffer is not empty (or not empty after the last saved write position), then addOneSection() is automatically called.

Parameters
[in,out]tableThe binary table into which this object shall be serialized. The table is initially empty when serialize() calls serializePayload().
[in,out]bufA PSIBuffer with the appropriate size for the section payload. The payload buffer is initially empty when serialize() calls serializePayload().

Implements ts::AbstractTable.

◆ deserializePayload()

virtual void ts::STT::deserializePayload ( PSIBuffer buf,
const Section section 
)
overrideprotectedvirtual

This abstract method deserializes the payload of one section.

When deserialize() is called, this object is cleared and validated. Then, deserializePayload() is invoked for each section in the binary table. A subclass shall implement deserializePayload() which adds the content of the binary section to the C++ object. Do not reset the object in deserializePayload() since it is repeatedly called for each section of a single binary table.

Parameters
[in,out]bufDeserialization buffer. The subclass shall read the descriptor payload from buf. The end of read is the end of the binary payload. If any kind of error is reported in the buffer or if the payload is not completely read, the deserialization is considered as invalid.
[in]sectionA reference to the section. Can be used to access values in the section header (typically for long sections).

Implements ts::AbstractTable.

◆ buildXML()

virtual void ts::STT::buildXML ( DuckContext duck,
xml::Element root 
) const
overrideprotectedvirtual

Helper method to convert this object to XML.

It is called by toXML() only when the object is valid. The root element is already built with the appropriate XML node name. In buildXML(), the subclass shall simply populate the XML node.

Parameters
[in,out]rootThe root node for the new XML tree.
[in,out]duckTSDuck execution context.

Implements ts::AbstractSignalization.

◆ analyzeXML()

virtual bool ts::STT::analyzeXML ( DuckContext duck,
const xml::Element element 
)
overrideprotectedvirtual

Helper method to convert this object from XML.

It is called by fromXML() after checking the validity of the XML node name. In analyzeXML(), the subclass shall populate the C++ object from the content of the XML node. If analyzeXML() returns false, this table or descriptor object is then invalidated and cleared.

Parameters
[in,out]duckTSDuck execution context.
[in]elementXML element to convert.
Returns
True if the analysis is correct, false otherwise.

Implements ts::AbstractSignalization.

◆ clear()

virtual void ts::AbstractLongTable::clear ( )
finaloverridevirtualinherited

This method clears the content of the table or descriptor.

Upon return, the object is valid and in the same empty state as after a default constructor.

Reimplemented from ts::AbstractSignalization.

◆ useTrailingCRC32()

virtual bool ts::AbstractLongTable::useTrailingCRC32 ( ) const
overrideprotectedvirtualinherited

Check if the sections of this table have a trailing CRC32.

This is usually false for short sections but some short sections such as DVB-TOT use a CRC32.

Returns
True if the sections of this table have a trailing CRC32.

Reimplemented from ts::AbstractTable.

◆ deserializePayloadWrapper()

virtual void ts::AbstractLongTable::deserializePayloadWrapper ( PSIBuffer buf,
const Section section 
)
overrideprotectedvirtualinherited

Wrapper for deserializePayload().

This is a method to overload in intermediate classes to avoid using "call superclass" to all tables.

Parameters
[in,out]bufDeserialization buffer.
[in]sectionA reference to the section.

Reimplemented from ts::AbstractTable.

◆ addOneSectionImpl()

virtual void ts::AbstractLongTable::addOneSectionImpl ( BinaryTable table,
PSIBuffer payload 
) const
overrideprotectedvirtualinherited

Actual implementation of adding one section in a binary table.

Do not call directly, it is only called by addOneSection() and is overridden in AbstractLongTable.

Parameters
[in,out]tableThe binary table into which the new section shall be added.
[in,out]payloadA PSIBuffer containing the section payload between the read and the write pointer.

Reimplemented from ts::AbstractTable.

◆ tableId()

TID ts::AbstractTable::tableId ( ) const
inlineinherited

Get the table_id.

Returns
The table_id.

◆ isPrivate()

virtual bool ts::AbstractTable::isPrivate ( ) const
virtualinherited

Check if the table is a private one (ie.

not MPEG-defined). The default implementation returns true. MPEG-defined tables should override this method to return false.

Returns
True if the table is a private one (ie. not MPEG-defined).

Reimplemented in ts::CAT, ts::DSMCCStreamDescriptorsTable, ts::PAT, ts::PMT, ts::TSDT, ts::CableEmergencyAlertTable, and ts::SpliceInformationTable.

◆ serialize()

bool ts::AbstractTable::serialize ( DuckContext duck,
BinaryTable bin 
) const
inherited

This method serializes a table.

Parameters
[in,out]duckTSDuck execution context.
[out]binA binary table object. Its content is replaced with a binary representation of this object.
Returns
True in case of success, false if the table is invalid.

◆ deserialize()

bool ts::AbstractTable::deserialize ( DuckContext duck,
const BinaryTable bin 
)
inherited

This method deserializes a binary table.

In case of success, this object is replaced with the interpreted content of bin. In case of error, this object is invalidated.

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary table to interpret according to the table subclass.
Returns
True in case of success, false if the table is invalid.

◆ isValidTableId()

virtual bool ts::AbstractTable::isValidTableId ( TID  tid) const
protectedvirtualinherited

This method checks if a table id is valid for this object.

Parameters
[in]tidA table id to check.
Returns
True if tid is a valid table id for this object, false otherwise. The default implementation checks that tid is identical to the table id of this object.

Reimplemented in ts::EIT, ts::NIT, ts::SDT, and ts::NBIT.

◆ addOneSection()

void ts::AbstractTable::addOneSection ( BinaryTable table,
PSIBuffer payload 
) const
protectedinherited

Helper method for serializePayload(): add a section in a binary table.

For long tables, the section number is always one more than the current last section in the table.

It the payload buffer has a pushed read/write state, this state is restored and immediately pushed again. The typical use case is the following:

  • A table may create more than one section.
  • The payload of all sections starts with the same fixed data.
  • In the subclass, the method serializePayload() builds the initial fixed data once.
  • The method serializePayload() immediately pushes the read/write state of the buffer.
  • The method serializePayload() builds payloads and call addOneSection().
  • Upon return from addOneSection(), the buffer is back right after the initial fixed data.
Parameters
[in,out]tableThe binary table into which the new section shall be added.
[in,out]payloadA PSIBuffer containing the section payload between the read and the write pointer.

◆ isValid()

bool ts::AbstractSignalization::isValid ( ) const
inlineinherited

Check if this object is valid.

Returns
True if this object is valid.

◆ invalidate()

void ts::AbstractSignalization::invalidate ( )
inlineinherited

Invalidate this object.

This object must be rebuilt.

◆ xmlName()

UString ts::AbstractSignalization::xmlName ( ) const
inherited

Get the XMl node name representing this table or descriptor.

Returns
The XML node name.

◆ toXML()

xml::Element * ts::AbstractSignalization::toXML ( DuckContext duck,
xml::Element parent 
) const
inherited

This method converts this object to XML.

When this object is valid, this method creates a root node with the default XML name and then invokes buildXML() in the subclass to populate the XML node.

Parameters
[in,out]duckTSDuck execution context.
[in,out]parentThe parent node for the new XML tree.
Returns
The new XML element.

◆ fromXML()

void ts::AbstractSignalization::fromXML ( DuckContext duck,
const xml::Element element 
)
inherited

This method converts an XML structure to a table or descriptor in this object.

In case of success, this object is replaced with the interpreted content of the XML structure. In case of error, this object is invalidated.

This method checks the name of the XML node and then invokes analyzeXML() in the subclass. Depending on the returned values of analyzeXML(), this object is either validated or invalidated.

Parameters
[in,out]duckTSDuck execution context.
[in]elementXML element to convert.

◆ definingStandards()

virtual Standards ts::AbstractSignalization::definingStandards ( ) const
overridevirtualinherited

Get the list of standards which define this object.

Returns
A bit mask of standards.

Implements ts::AbstractDefinedByStandards.

◆ DataName()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
static UString ts::AbstractSignalization::DataName ( const UChar xml_name,
const UChar section,
INT  value,
NamesFlags  flags = NamesFlags::NAME,
size_t  bits = 0,
INT  alternate = 0 
)
inlinestaticinherited

Get a name from a specified section in the DVB names file.

Template Parameters
INTAn integer type.
Parameters
[in]xml_nameTable or descriptor name, as used in XML structures.
[in]sectionName of section to search. Not case-sensitive. The actual section in the names file is prefixed by the XML name, followed by a dot.
[in]valueValue to get the name for.
[in]flagsPresentation flags.
[in]bitsNominal size in bits of the data, optional.
[in]alternateDisplay this integer value if flags ALTERNATE is set.
Returns
The corresponding name.

◆ dataName()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
UString ts::AbstractSignalization::dataName ( const UChar section,
INT  value,
NamesFlags  flags = NamesFlags::NAME,
size_t  bits = 0,
INT  alternate = 0 
)
inlineinherited

Get a name from a specified section in the DVB names file for that signalization structure.

Template Parameters
INTAn integer type.
Parameters
[in]sectionName of section to search. Not case-sensitive. The actual section in the names file is prefixed by the XML name of the structure, followed by a dot.
[in]valueValue to get the name for.
[in]flagsPresentation flags.
[in]bitsNominal size in bits of the data, optional.
[in]alternateDisplay this integer value if flags ALTERNATE is set.
Returns
The corresponding name.

The documentation for this class was generated from the following file: