TSDuck Version 3.16-1064 (TSDuck - The MPEG Transport Stream Toolkit)
ts::PMT Class Reference

Representation of a Program Map Table (PMT). More...

Inheritance diagram for ts::PMT:
Collaboration diagram for ts::PMT:

Classes

struct  Stream
 Description of an elementary stream. More...
 

Public Types

typedef EntryWithDescriptorsMap< PID, StreamStreamMap
 List of elementary streams, indexed by PID.
 

Public Member Functions

 PMT (uint8_t version=0, bool is_current=true, uint16_t service_id=0, PID pcr_pid=PID_NULL)
 Default constructor. More...
 
 PMT (const PMT &other)
 Copy constructor. More...
 
 PMT (const BinaryTable &table, const DVBCharset *charset=nullptr)
 Constructor from a binary table. More...
 
virtual void buildXML (xml::Element *) const override
 Helper method to convert this object to XML. More...
 
PID componentTagToPID (uint8_t tag) const
 Search the component PID for a given component tag. More...
 
virtual void deserialize (const BinaryTable &table, const DVBCharset *=nullptr) override
 This abstract method deserializes a binary table. More...
 
virtual void fromXML (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...
 
virtual void serialize (BinaryTable &table, const DVBCharset *=nullptr) const override
 This abstract method serializes a table. More...
 
TID tableId () const
 Get the table_id. More...
 
virtual xml::ElementtoXML (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

DescriptorList descs
 Program-level descriptor list.
 
bool is_current
 True if table is current, false if table is next.
 
PID pcr_pid
 PID for PCR data.
 
uint16_t service_id
 Service id aka "program_number".
 
StreamMap streams
 Map of stream descriptions: key=PID, value=stream_description.
 
uint8_t version
 Table version number.
 

Protected Member Functions

bool checkXMLName (const xml::Element *element) const
 Check that an XML element has the right name for this table. More...
 

Static Protected Member Functions

static bool SerializeFixedLength (ByteBlock &bb, const UString &str, const size_t size, const DVBCharset *charset=nullptr)
 This static method serializes a DVB string with a required fixed size. More...
 
static bool SerializeLanguageCode (ByteBlock &bb, const UString &str, const DVBCharset *charset=nullptr)
 This abstract 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 Map Table (PMT).

Constructor & Destructor Documentation

◆ PMT() [1/3]

ts::PMT::PMT ( uint8_t  version = 0,
bool  is_current = true,
uint16_t  service_id = 0,
PID  pcr_pid = PID_NULL 
)

Default constructor.

Parameters
[in]versionTable version number.
[in]is_currentTrue if table is current, false if table is next.
[in]service_idService identifier.
[in]pcr_pidPID of the PCR. Default: none.

◆ PMT() [2/3]

ts::PMT::PMT ( const PMT other)

Copy constructor.

Parameters
[in]otherOther instance to copy.

◆ PMT() [3/3]

ts::PMT::PMT ( const BinaryTable table,
const DVBCharset charset = nullptr 
)

Constructor from a binary table.

Parameters
[in]tableBinary table to deserialize.
[in]charsetIf not zero, character set to use without explicit table code.

Member Function Documentation

◆ componentTagToPID()

PID ts::PMT::componentTagToPID ( uint8_t  tag) const

Search the component PID for a given component tag.

Parameters
[in]tagComponent tag to search.
Returns
The PID of the corresponding component of PID_NULL if not found.

◆ serialize()

virtual void ts::PMT::serialize ( BinaryTable bin,
const DVBCharset charset = nullptr 
) const
overridevirtual

This abstract method serializes a table.

Parameters
[out]binA binary table object. Its content is replaced with a binary representation of this object.
[in]charsetIf not zero, default character set to use.

Implements ts::AbstractTable.

◆ deserialize()

virtual void ts::PMT::deserialize ( const BinaryTable bin,
const DVBCharset charset = nullptr 
)
overridevirtual

This abstract 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]binA binary table to interpret according to the table subclass.
[in]charsetIf not zero, character set to use without explicit table code.

Implements ts::AbstractTable.

◆ buildXML()

virtual void ts::PMT::buildXML ( xml::Element root) const
overridevirtual

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.

Reimplemented from ts::AbstractSignalization.

◆ fromXML()

virtual void ts::PMT::fromXML ( 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]elementXML element to convert.

Implements ts::AbstractSignalization.

◆ DisplaySection()

static void ts::PMT::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.

◆ tableId()

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

Get the table_id.

Returns
The table_id.

◆ 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 ( 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]parentThe parent node for the new XML tree.
Returns
The new XML element.

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

◆ 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 ( ByteBlock bb,
const UString str,
const size_t  size,
const DVBCharset charset = nullptr 
)
staticprotectedinherited

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

Parameters
[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.
[in]charsetIf not zero, default character set to use.
Returns
True if the size has the required length and has been serialized.

◆ SerializeLanguageCode()

static bool ts::AbstractSignalization::SerializeLanguageCode ( ByteBlock bb,
const UString str,
const DVBCharset charset = nullptr 
)
inlinestaticprotectedinherited

This abstract 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]charsetIf not zero, default character set to use.
Returns
True if the size has the required length and has been serialized.

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