TSDuck Version 3.22-1919 (TSDuck - The MPEG Transport Stream Toolkit)
ts::AssociationTagDescriptor Class Reference

Representation of an association_tag_descriptor. More...

Inheritance diagram for ts::AssociationTagDescriptor:
Collaboration diagram for ts::AssociationTagDescriptor:

Public Member Functions

 AssociationTagDescriptor ()
 Default constructor.
 
 AssociationTagDescriptor (DuckContext &duck, const Descriptor &bin)
 Constructor from a binary descriptor. More...
 
virtual void clear ()
 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 &, const Descriptor &) override
 This method deserializes a binary descriptor. More...
 
void deserialize (DuckContext &duck, const DescriptorList &dlist, size_t index)
 Deserialize a descriptor from a descriptor list. 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...
 
bool isPrivateDescriptor () const
 Check if this descriptor is a private descriptor. More...
 
bool isValid () const
 Check if this object is valid. More...
 
PDS requiredPDS () const
 Get the required private data specifier. More...
 
virtual void serialize (DuckContext &, Descriptor &) const override
 This method serializes a descriptor. More...
 
DID tag () const
 Get the descriptor tag. 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 DisplayDescriptor (ts::TablesDisplay &display, ts::DID did, const uint8_t *payload, size_t size, int indent, ts::TID tid, ts::PDS pds)
 Static method to display a descriptor. 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

uint16_t association_tag
 Association tag.
 
ByteBlock private_data
 Private data.
 
ByteBlock selector_bytes
 Selector bytes, depend on use.
 
uint16_t use
 Usage of associated bitstream.
 

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

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...
 
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)
 Deserialize the payload of the descriptor. More...
 
bool serializeEnd (Descriptor &bin, const ByteBlockPtr &bbp) const
 Tool for serialization: complete a serialization. More...
 
virtual void serializePayload (PSIBuffer &buf) const
 Serialize the payload of the descriptor. More...
 
ByteBlockPtr serializeStart () const
 Tool for serialization: get a byte buffer for serialization. More...
 

Protected Attributes

bool _is_valid
 It is the responsibility of the subclasses to set the valid flag.
 

Detailed Description

Representation of an association_tag_descriptor.

See also
ISO/IEC 13818-6 (DSM-CC), 11.4.2.

Constructor & Destructor Documentation

◆ AssociationTagDescriptor()

ts::AssociationTagDescriptor::AssociationTagDescriptor ( DuckContext duck,
const Descriptor bin 
)

Constructor from a binary descriptor.

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary descriptor to deserialize.

Member Function Documentation

◆ serialize()

virtual void ts::AssociationTagDescriptor::serialize ( DuckContext duck,
Descriptor bin 
) const
overridevirtual

This method serializes a descriptor.

The subclass shall preferably override serializePayload(). As legacy, the subclass may directly override serialize() but this is not recommended for new descriptors. At some point, if we can refactor all descriptors to the new scheme using serializePayload() (which seems unlikely), serialize() will become "final" and will no longer allow override.

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

Reimplemented from ts::AbstractDescriptor.

◆ deserialize() [1/2]

virtual void ts::AssociationTagDescriptor::deserialize ( DuckContext duck,
const Descriptor bin 
)
overridevirtual

This method deserializes a binary descriptor.

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

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary descriptor to interpret according to the descriptor subclass. In case of success, this object is replaced with the interpreted content of bin. In case of error, this object is invalidated.

Reimplemented from ts::AbstractDescriptor.

◆ DisplayDescriptor()

static void ts::AssociationTagDescriptor::DisplayDescriptor ( ts::TablesDisplay display,
ts::DID  did,
const uint8_t *  payload,
size_t  size,
int  indent,
ts::TID  tid,
ts::PDS  pds 
)
static

Static method to display a descriptor.

Parameters
[in,out]displayDisplay engine.
[in]didDescriptor id.
[in]payloadAddress of the descriptor payload.
[in]sizeSize in bytes of the descriptor payload.
[in]indentIndentation width.
[in]tidTable id of table containing the descriptors.
[in]pdsPrivate Data Specifier.

◆ clearContent()

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

◆ buildXML()

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

◆ tag()

DID ts::AbstractDescriptor::tag ( ) const
inlineinherited

Get the descriptor tag.

Returns
The descriptor tag.

◆ requiredPDS()

PDS ts::AbstractDescriptor::requiredPDS ( ) const
inlineinherited

Get the required private data specifier.

Returns
The private data specifier which is required to interpret correctly this descriptor in a section. Return zero if this descriptor is a DVB-defined or MPEG-defined descriptor, not a private specifier.

◆ isPrivateDescriptor()

bool ts::AbstractDescriptor::isPrivateDescriptor ( ) const
inlineinherited

Check if this descriptor is a private descriptor.

Returns
True if this descriptor is a private descriptor, false if it is a DVB-defined or MPEG-defined descriptor.

◆ deserialize() [2/2]

void ts::AbstractDescriptor::deserialize ( DuckContext duck,
const DescriptorList dlist,
size_t  index 
)
inherited

Deserialize a descriptor from a descriptor list.

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

Parameters
[in,out]duckTSDuck execution context.
[in]dlistA list of binary descriptors.
[in]indexIndex of the descriptor to deserialize in dlist.

◆ serializePayload()

virtual void ts::AbstractDescriptor::serializePayload ( PSIBuffer buf) const
protectedvirtualinherited

Serialize the payload of the descriptor.

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

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

Parameters
[in,out]bufSerialization buffer. The subclass shall write the descriptor payload into buf. If any kind of error is reported in the buffer, the serialization is considered as invalid and the binary descriptor is invalid. Such errors include write error, such as attempting to write more data than allowed in a binary descriptor or any user-generated error using ts::Buffer::setUserError().

Reimplemented in ts::ISO639LanguageDescriptor, ts::ServiceDescriptor, ts::BouquetNameDescriptor, ts::NetworkNameDescriptor, ts::StreamIdentifierDescriptor, and ts::BroadcasterNameDescriptor.

◆ deserializePayload()

virtual void ts::AbstractDescriptor::deserializePayload ( PSIBuffer buf)
protectedvirtualinherited

Deserialize the payload of the descriptor.

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

The default implementation generates an error. So, if a subclass overrides neither deserialize() 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.

Reimplemented in ts::ISO639LanguageDescriptor, ts::ServiceDescriptor, ts::BouquetNameDescriptor, ts::NetworkNameDescriptor, ts::StreamIdentifierDescriptor, and ts::BroadcasterNameDescriptor.

◆ serializeStart()

ByteBlockPtr ts::AbstractDescriptor::serializeStart ( ) const
protectedinherited

Tool for serialization: get a byte buffer for serialization.

Legacy warning: This method is useful only when serialize() is directly overridden instead of serializePayload(). This is consquently considered as a legacy feature.

Returns
A safe pointer to a two-byte byffer containing the descriptor tag and zero as length.
See also
serializeEnd()

◆ serializeEnd()

bool ts::AbstractDescriptor::serializeEnd ( Descriptor bin,
const ByteBlockPtr bbp 
) const
protectedinherited

Tool for serialization: complete a serialization.

Legacy warning: This method is useful only when serialize() is directly overridden instead of serializeContent(). This is consquently considered as a legacy feature.

Parameters
[out]binA binary descriptor object which receives the serialized object.
[in]bbpSafe pointer containing the serialized data, typically returned by serializeStart(). The tag and length will be updated.
Returns
True if the serialized descriptor is valid.
See also
serializeStart()

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

◆ clear()

virtual void ts::AbstractSignalization::clear ( )
virtualinherited

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 in ts::AbstractLongTable.

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