TSDuck Version 3.18-1208 (TSDuck - The MPEG Transport Stream Toolkit)
ts::PAT Class Reference

Representation of a Program Association Table (PAT). More...

Inheritance diagram for ts::PAT:
Collaboration diagram for ts::PAT:

Public Types

typedef std::map< uint16_t, PIDServiceMap
 List of PMT PID's, indexed by service_id.
 

Public Member Functions

 PAT (uint8_t version=0, bool is_current=true, uint16_t ts_id=0, PID nit_pid=PID_NIT)
 Default constructor. More...
 
 PAT (DuckContext &duck, const BinaryTable &table)
 Constructor from a binary table. More...
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object. More...
 
void deserialize (DuckContext &duck, const BinaryTable &bin)
 This method deserializes a binary table. More...
 
virtual void fromXML (DuckContext &, const xml::Element *) override
 This abstract converts an XML structure to a table or descriptor. More...
 
void invalidate ()
 Invalidate this object. More...
 
bool isValid () const
 Check if this object is valid. More...
 
void serialize (DuckContext &duck, BinaryTable &bin) const
 This method serializes a table. More...
 
TID tableId () const
 Get the table_id. More...
 
virtual xml::ElementtoXML (DuckContext &duck, xml::Element *parent) const
 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 void DisplaySection (TablesDisplay &display, const Section &section, int indent)
 A static method to display a section. More...
 

Public Attributes

bool is_current
 True if table is current, false if table is next.
 
PID nit_pid
 PID for NIT.
 
ServiceMap pmts
 Map of PMT PID's: key=service_id, value=pmt_pid.
 
uint16_t ts_id
 Transport stream id.
 
uint8_t version
 Table version number.
 

Protected Member Functions

virtual void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML. More...
 
bool checkXMLName (const xml::Element *element) const
 Check that an XML element has the right name for this table. More...
 
virtual void deserializeContent (DuckContext &, const BinaryTable &) override
 This abstract method deserializes the content of a binary table. More...
 
virtual bool isValidTableId (TID tid) const
 This method checks if a table id is valid for this object. More...
 
virtual void serializeContent (DuckContext &, BinaryTable &) const override
 This abstract method serializes the content of a table. More...
 

Static Protected Member Functions

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 (DuckContext &duck, ByteBlock &bb, const UString &str)
 This static method serializes a 3-byte language or country code. 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.
 
const UChar *const _xml_name
 XML table or descriptor name.
 

Detailed Description

Representation of a Program Association Table (PAT).

Constructor & Destructor Documentation

◆ PAT() [1/2]

ts::PAT::PAT ( uint8_t  version = 0,
bool  is_current = true,
uint16_t  ts_id = 0,
PID  nit_pid = PID_NIT 
)

Default constructor.

Parameters
[in]versionTable version number.
[in]is_currentTrue if table is current, false if table is next.
[in]ts_idTransport stream identifier.
[in]nit_pidPID of the NIT. Default: DVB-defined PID for NIT.

◆ PAT() [2/2]

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

Constructor from a binary table.

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

Member Function Documentation

◆ fromXML()

virtual void ts::PAT::fromXML ( DuckContext duck,
const xml::Element element 
)
overridevirtual

This abstract converts an XML structure to a table or descriptor.

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

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

Implements ts::AbstractSignalization.

◆ DisplaySection()

static void ts::PAT::DisplaySection ( TablesDisplay display,
const 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.

◆ serializeContent()

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

Implements ts::AbstractTable.

◆ deserializeContent()

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

This abstract 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.

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

Implements ts::AbstractTable.

◆ buildXML()

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

Helper method to convert this object to XML.

When this object is valid, the default implementation of toXML() creates a root node with the default XML name and then invoke buildXML() to populate the XML node.

The default implementation is to do nothing. Subclasses which override toXML() do not need to implement buildXML() since it won't be invoked.

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

Reimplemented from ts::AbstractSignalization.

◆ tableId()

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

Get the table_id.

Returns
The table_id.

◆ serialize()

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

◆ deserialize()

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

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

◆ 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
virtualinherited

This method converts this object to XML.

When this object is valid, the default implementation of toXML() creates a root node with the default XML name and then invoke buildXML() to populate the XML node.

Subclasses have the choice to either implement buildXML() or toXML(). If the object is serialized as one single XML node, it is simpler to implement buidlXML().

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

Reimplemented in ts::SSULinkageDescriptor, and ts::SSUDataBroadcastIdDescriptor.

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

◆ checkXMLName()

bool ts::AbstractSignalization::checkXMLName ( const xml::Element element) const
protectedinherited

Check that an XML element has the right name for this table.

Parameters
[in]elementXML element to check.
Returns
True on success, false on error.

◆ SerializeFixedLength()

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

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 ( DuckContext duck,
ByteBlock bb,
const UString str 
)
staticprotectedinherited

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

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.
Returns
True if the size has the required length and has been serialized.

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