TSDuck Version 3.15-964 (TSDuck - The MPEG Transport Stream Toolkit)
ts::Descriptor Class Reference

Representation of a MPEG PSI/SI descriptors in binary format. More...

Public Member Functions

 Descriptor ()
 Default constructor.
 
 Descriptor (const Descriptor &desc, CopyShare mode)
 Copy constructor. More...
 
 Descriptor (DID tag, const void *data, size_t size)
 Constructor from tag and payload. More...
 
 Descriptor (DID tag, const ByteBlock &data)
 Constructor from tag and payload. More...
 
 Descriptor (const void *data, size_t size)
 Constructor from full binary content. More...
 
 Descriptor (const ByteBlock &bb)
 Constructor from full binary content. More...
 
 Descriptor (const ByteBlockPtr &bb, CopyShare mode)
 Constructor from full binary content. More...
 
const uint8_t * content () const
 Access to the full binary content of the descriptor. More...
 
Descriptorcopy (const Descriptor &desc)
 Duplication. More...
 
EDID edid (PDS pds=0) const
 Get the extended descriptor id. More...
 
bool fromXML (const xml::Element *node, TID tid=TID_NULL, const DVBCharset *charset=0)
 This method converts an XML node as a binary descriptor. More...
 
void invalidate ()
 Invalidate descriptor content.
 
bool isValid () const
 Check if a descriptor has valid content. More...
 
bool operator!= (const Descriptor &desc) const
 Comparison operator. More...
 
Descriptoroperator= (const Descriptor &desc)
 Assignment operator. More...
 
bool operator== (const Descriptor &desc) const
 Comparison operator. More...
 
const uint8_t * payload () const
 Access to the payload of the descriptor. More...
 
uint8_t * payload ()
 Access to the payload of the descriptor. More...
 
size_t payloadSize () const
 Size of the payload of the descriptor. More...
 
void replacePayload (const void *data, size_t size)
 Replace the payload of the descriptor. More...
 
void replacePayload (const ByteBlock &payload)
 Replace the payload of the descriptor. More...
 
void resizePayload (size_t size)
 Resize (truncate or extend) the payload of the descriptor. More...
 
size_t size () const
 Size of the binary content of the descriptor. More...
 
DID tag () const
 Get the descriptor tag. More...
 
xml::ElementtoXML (xml::Element *parent, PDS pds=0, TID tid=TID_NULL, bool forceGeneric=false, const DVBCharset *charset=0) const
 This method converts a descriptor to XML. More...
 

Detailed Description

Representation of a MPEG PSI/SI descriptors in binary format.

Constructor & Destructor Documentation

◆ Descriptor() [1/6]

ts::Descriptor::Descriptor ( const Descriptor desc,
CopyShare  mode 
)

Copy constructor.

Parameters
[in]descAnother instance to copy.
[in]modeThe descriptors' data are either shared (ts::SHARE) between the two descriptors or duplicated (ts::COPY).

◆ Descriptor() [2/6]

ts::Descriptor::Descriptor ( DID  tag,
const void *  data,
size_t  size 
)

Constructor from tag and payload.

The content is copied into the section if valid.

Parameters
[in]tagDescriptor tag.
[in]dataAddress of the descriptor payload.
[in]sizeSize in bytes of the descriptor payload.

◆ Descriptor() [3/6]

ts::Descriptor::Descriptor ( DID  tag,
const ByteBlock data 
)

Constructor from tag and payload.

The content is copied into the section if valid.

Parameters
[in]tagDescriptor tag.
[in]dataDescriptor payload.

◆ Descriptor() [4/6]

ts::Descriptor::Descriptor ( const void *  data,
size_t  size 
)

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]dataAddress of the descriptor data.
[in]sizeSize in bytes of the descriptor data.

◆ Descriptor() [5/6]

ts::Descriptor::Descriptor ( const ByteBlock bb)

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]bbDescriptor binary data.

◆ Descriptor() [6/6]

ts::Descriptor::Descriptor ( const ByteBlockPtr bb,
CopyShare  mode 
)

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]bbDescriptor binary data.
[in]modeThe data are either shared (ts::SHARE) between the descriptor and bb or duplicated (ts::COPY).

Member Function Documentation

◆ operator=()

Descriptor& ts::Descriptor::operator= ( const Descriptor desc)
inline

Assignment operator.

The content is referenced, and thus shared between the two objects.

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

◆ copy()

Descriptor& ts::Descriptor::copy ( const Descriptor desc)
inline

Duplication.

Similar to assignment but the content is duplicated.

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

◆ isValid()

bool ts::Descriptor::isValid ( ) const
inline

Check if a descriptor has valid content.

Returns
True if a descriptor has valid content.

◆ tag()

DID ts::Descriptor::tag ( ) const
inline

Get the descriptor tag.

Returns
The descriptor tag or the reserved value 0 if the descriptor is invalid.

◆ edid()

EDID ts::Descriptor::edid ( PDS  pds = 0) const

Get the extended descriptor id.

Parameters
[in]pdsAssociated private data specifier.
Returns
The extended descriptor id.

◆ content()

const uint8_t* ts::Descriptor::content ( ) const
inline

Access to the full binary content of the descriptor.

Returns
Address of the full binary content of the descriptor.

◆ size()

size_t ts::Descriptor::size ( ) const
inline

Size of the binary content of the descriptor.

Returns
Size of the binary content of the descriptor.

◆ payload() [1/2]

const uint8_t* ts::Descriptor::payload ( ) const
inline

Access to the payload of the descriptor.

Returns
Address of the payload of the descriptor.

◆ payload() [2/2]

uint8_t* ts::Descriptor::payload ( )
inline

Access to the payload of the descriptor.

Returns
Address of the payload of the descriptor.

◆ payloadSize()

size_t ts::Descriptor::payloadSize ( ) const
inline

Size of the payload of the descriptor.

Returns
Size in bytes of the payload of the descriptor.

◆ replacePayload() [1/2]

void ts::Descriptor::replacePayload ( const void *  data,
size_t  size 
)

Replace the payload of the descriptor.

The tag is unchanged, the size is adjusted.

Parameters
[in]dataAddress of the new payload data.
[in]sizeSize in bytes of the new payload data.

◆ replacePayload() [2/2]

void ts::Descriptor::replacePayload ( const ByteBlock payload)
inline

Replace the payload of the descriptor.

The tag is unchanged, the size is adjusted.

Parameters
[in]payloadThe new payload data.

◆ resizePayload()

void ts::Descriptor::resizePayload ( size_t  size)

Resize (truncate or extend) the payload of the descriptor.

The tag is unchanged, the size is adjusted. If the payload is extended, new bytes are zeroes.

Parameters
[in]sizeNew size in bytes of the payload.

◆ operator==()

bool ts::Descriptor::operator== ( const Descriptor desc) const

Comparison operator.

Parameters
[in]descAnother descriptor to compare.
Returns
True is the two descriptors are identical.

◆ operator!=()

bool ts::Descriptor::operator!= ( const Descriptor desc) const
inline

Comparison operator.

Parameters
[in]descAnother descriptor to compare.
Returns
True is the two descriptors are different.

◆ toXML()

xml::Element* ts::Descriptor::toXML ( xml::Element parent,
PDS  pds = 0,
TID  tid = TID_NULL,
bool  forceGeneric = false,
const DVBCharset charset = 0 
) const

This method converts a descriptor to XML.

If the descriptor has a specialized implementation, generate a specialized XML structure. Otherwise, generate a <generic_descriptor> node.

Parameters
[in,out]parentThe parent node for the XML descriptor.
[in]pdsAssociated private data specifier.
[in]tidOptional table id of the table containing the descriptor.
[in]forceGenericForce a <generic_descriptor> node even if the descriptor can be specialized.
[in]charsetIf not zero, default character set to use.
Returns
The new XML element or zero if the descriptor is not valid.

◆ fromXML()

bool ts::Descriptor::fromXML ( const xml::Element node,
TID  tid = TID_NULL,
const DVBCharset charset = 0 
)

This method converts an XML node as a binary descriptor.

Parameters
[in]nodeThe root of the XML descriptor.
[in]tidOptional table id of the table containing the descriptor.
[in]charsetIf not zero, default character set to use.
Returns
True if the XML element name is a valid descriptor name, false otherwise. If the name is valid but the content is incorrect, true is returned and this object is invalidated.

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