TSDuck Version 3.22-1914 (TSDuck - The MPEG Transport Stream Toolkit)
ts::INT Class Reference

Representation of an IP/MAC Notification Table (INT). More...

Inheritance diagram for ts::INT:
Collaboration diagram for ts::INT:

Classes

struct  Device
 Description of a device. More...
 

Public Types

typedef EntryWithDescriptorsList< DeviceDeviceList
 List of devices.
 

Public Member Functions

 INT (uint8_t version=0, bool is_current=true)
 Default constructor. More...
 
 INT (const INT &other)
 Copy constructor. More...
 
 INT (DuckContext &duck, const BinaryTable &table)
 Constructor from a binary table. More...
 
virtual void clear () override final
 This method clears the content of the table or descriptor. More...
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object. More...
 
virtual void deserialize (DuckContext &duck, const BinaryTable &bin) final
 This method deserializes a binary table. More...
 
virtual void fromXML (DuckContext &duck, const xml::Element *element) final
 This method converts an XML structure to a table or descriptor in this object. More...
 
void invalidate ()
 Invalidate this object. More...
 
virtual bool isPrivate () const
 Check if the table is a private one (ie. More...
 
bool isValid () const
 Check if this object is valid. More...
 
virtual void serialize (DuckContext &duck, BinaryTable &bin) const final
 This method serializes a table. More...
 
TID tableId () const
 Get the table_id. More...
 
virtual uint16_t tableIdExtension () const override
 Get the table id extension. More...
 
virtual xml::ElementtoXML (DuckContext &duck, xml::Element *parent) const final
 This method converts this object to XML. More...
 
UString xmlName () const
 Get the XMl node name representing this table or descriptor. More...
 

Static Public Member Functions

static UString DeserializeLanguageCode (const uint8_t *data)
 This static method deserializes a 3-byte language or country code. More...
 
static void DisplaySection (ts::TablesDisplay &display, const ts::Section &section, int indent)
 A static method to display a section. More...
 
static bool SerializeFixedLength (DuckContext &duck, ByteBlock &bb, const UString &str, const size_t size)
 This static method serializes a DVB string with a required fixed size. More...
 
static bool SerializeLanguageCode (ByteBlock &bb, const UString &str, bool allow_empty=false)
 This static method serializes a 3-byte language or country code. More...
 

Public Attributes

uint8_t action_type
 Action type.
 
DeviceList devices
 List of device descriptions.
 
bool is_current
 True if table is current, false if table is next.
 
DescriptorList platform_descs
 Platforma descriptor loop.
 
uint32_t platform_id
 Platform id, 24 bits.
 
uint8_t processing_order
 Processing order code.
 
uint8_t version
 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. More...
 
virtual void addOneSectionImpl (BinaryTable &table, PSIBuffer &payload) const override
 Actual implementation of adding one section in a binary table. More...
 
virtual bool analyzeXML (DuckContext &duck, const xml::Element *element) override
 Helper method to convert this object from XML. More...
 
virtual void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML. More...
 
virtual void clearContent () override
 Helper method to clear the content of the table or descriptor. More...
 
bool deserializeBool (bool &value, const uint8_t *&data, size_t &size, size_t bit=0)
 Deserialize a one-bit boolean inside one byte. More...
 
virtual void deserializeContent (DuckContext &, const BinaryTable &) override
 This method deserializes the content of a binary table. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool deserializeInt (INT &value, const uint8_t *&data, size_t &size)
 Deserialize an integer. More...
 
bool deserializeLanguageCode (UString &lang, const uint8_t *&data, size_t &size)
 Deserialize a 3-byte language or country code. More...
 
virtual void deserializePayload (PSIBuffer &buf, const Section &section)
 This abstract method deserializes the payload of a section. More...
 
virtual void deserializePayloadWrapper (PSIBuffer &buf, const Section &section) override
 Wrapper for deserializePayload(). More...
 
virtual bool isValidTableId (TID tid) const
 This method checks if a table id is valid for this object. More...
 
virtual size_t maxPayloadSize () const override
 Get the maximum size in bytes of the payload of sections of this table. More...
 
virtual void serializeContent (DuckContext &, BinaryTable &) const override
 This abstract method serializes the content of a table. More...
 
virtual void serializePayload (BinaryTable &table, PSIBuffer &payload) const
 This abstract method serializes the payload of all sections in the table. More...
 

Protected Attributes

bool _is_valid
 It is the responsibility of the subclasses to set the valid flag.
 
TID _table_id
 The table id can be modified by subclasses only.
 

Detailed Description

Representation of an IP/MAC Notification Table (INT).

See also
ETSI EN 301 192, section 8.4.3.

Constructor & Destructor Documentation

◆ INT() [1/3]

ts::INT::INT ( uint8_t  version = 0,
bool  is_current = true 
)

Default constructor.

Parameters
[in]versionTable version number.
[in]is_currentTrue if table is current, false if table is next.

◆ INT() [2/3]

ts::INT::INT ( const INT other)

Copy constructor.

Parameters
[in]otherOther instance to copy.

◆ INT() [3/3]

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

Constructor from a binary table.

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

Member Function Documentation

◆ tableIdExtension()

virtual uint16_t ts::INT::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::INT::DisplaySection ( ts::TablesDisplay display,
const ts::Section section,
int  indent 
)
static

A static method to display a section.

Parameters
[in,out]displayDisplay engine.
[in]sectionThe section to display.
[in]indentIndentation width.

◆ clearContent()

virtual void ts::INT::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.

◆ serializeContent()

virtual void ts::INT::serializeContent ( DuckContext duck,
BinaryTable bin 
) const
overrideprotectedvirtual

This abstract method serializes the content of a table.

This method is invoked by serialize() when the table is valid.

Parameters
[in,out]duckTSDuck execution context.
[out]binA binary table object. Its content is replaced with a binary representation of this object.

Reimplemented from ts::AbstractTable.

◆ deserializeContent()

virtual void ts::INT::deserializeContent ( DuckContext duck,
const BinaryTable bin 
)
overrideprotectedvirtual

This method deserializes the content of 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.

The subclass shall preferably override deserializePayload(). As legacy, the subclass may directly override deserializeContent() but this is not recommended for new tables. At some point, if we can refactor all tables to the new scheme using deserializePayload(), deserializeContent() will disappear or become "final" and will no longer allow override.

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary table to interpret according to the table subclass.

Reimplemented from ts::AbstractTable.

◆ buildXML()

virtual void ts::INT::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::INT::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.

◆ maxPayloadSize()

virtual size_t ts::AbstractLongTable::maxPayloadSize ( ) const
overrideprotectedvirtualinherited

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::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::PMT, ts::CableEmergencyAlertTable, ts::SpliceInformationTable, ts::CAT, ts::TSDT, ts::DSMCCStreamDescriptorsTable, and ts::PAT.

◆ serialize()

virtual void ts::AbstractTable::serialize ( DuckContext duck,
BinaryTable bin 
) const
finalvirtualinherited

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.

◆ deserialize()

virtual void ts::AbstractTable::deserialize ( DuckContext duck,
const BinaryTable bin 
)
finalvirtualinherited

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.

◆ 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::SDT, ts::NBIT, and ts::NIT.

◆ serializePayload()

virtual void ts::AbstractTable::serializePayload ( BinaryTable table,
PSIBuffer payload 
) const
protectedvirtualinherited

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.

This is now the preferred method for table serialization: use the default implementation of serializeContent() and let it call the overridden serializePayload().

The default implementation generates an error. So, if a subclass overrides neither serializeContent() nor serializePayload(), all serialization will fail.

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

Reimplemented in ts::AbstractDescriptorsTable, and ts::PAT.

◆ deserializePayload()

virtual void ts::AbstractTable::deserializePayload ( PSIBuffer buf,
const Section section 
)
protectedvirtualinherited

This abstract method deserializes the payload of a 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.

This is now the preferred method for table deserialization: use the default implementation of deserializeContent() and let it call the overridden deserializePayload().

The default implementation generates an error. So, if a subclass overrides neither deserializeContent() nor deserializePayload(), all deserialization will fail.

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).

Reimplemented in ts::AbstractDescriptorsTable, and ts::PAT.

◆ 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()

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

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()

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

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.

◆ SerializeFixedLength()

static bool ts::AbstractSignalization::SerializeFixedLength ( DuckContext duck,
ByteBlock bb,
const UString str,
const size_t  size 
)
staticinherited

This static method serializes a DVB string with a required fixed size.

Parameters
[in,out]duckTSDuck execution context.
[in,out]bbA byte-block where str will be appended if its size is correct.
[in]strString to serialize.
[in]sizeRequired size in bytes of the serialized string.
Returns
True if the size has the required length and has been serialized.

◆ SerializeLanguageCode()

static bool ts::AbstractSignalization::SerializeLanguageCode ( ByteBlock bb,
const UString str,
bool  allow_empty = false 
)
staticinherited

This static method serializes a 3-byte language or country code.

Parameters
[in,out]bbA byte-block where str will be appended if its size is correct.
[in]strString to serialize.
[in]allow_emptyIf true, an empty string is allowed and serialized as zeroes.
Returns
True if the size has the required length and has been serialized.

◆ DeserializeLanguageCode()

static UString ts::AbstractSignalization::DeserializeLanguageCode ( const uint8_t *  data)
staticinherited

This static method deserializes a 3-byte language or country code.

Parameters
[in]dataAddress of a 3-byte memory area.
Returns
Deserialized string.

◆ deserializeLanguageCode()

bool ts::AbstractSignalization::deserializeLanguageCode ( UString lang,
const uint8_t *&  data,
size_t &  size 
)
protectedinherited

Deserialize a 3-byte language or country code.

Parameters
[out]langDeserialized language code.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data.
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
Returns
True on success, false on error. On error, the object is invalidated.

◆ deserializeInt()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool ts::AbstractSignalization::deserializeInt ( INT value,
const uint8_t *&  data,
size_t &  size 
)
protectedinherited

Deserialize an integer.

Template Parameters
INTSome integer type.
Parameters
[out]valueDeserialized integer value.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data.
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
Returns
True on success, false on error. On error, the object is invalidated.

◆ deserializeBool()

bool ts::AbstractSignalization::deserializeBool ( bool &  value,
const uint8_t *&  data,
size_t &  size,
size_t  bit = 0 
)
protectedinherited

Deserialize a one-bit boolean inside one byte.

Parameters
[out]valueDeserialized bool value.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data (one byte).
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
[in]bitBit number of the boolean in the deserialized byte, from 0 (LSB) to 7 (MSB).
Returns
True on success, false on error. On error, the object is invalidated.

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