TSDuck v3.38-3699
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::CADescriptor Class Reference

Representation of a generic CA_descriptor. More...

#include <tsCADescriptor.h>

Inheritance diagram for ts::CADescriptor:
Collaboration diagram for ts::CADescriptor:

Public Member Functions

 CADescriptor (DuckContext &duck, const Descriptor &bin)
 Constructor from a binary descriptor.
 
 CADescriptor (uint16_t cas_id=0, PID ca_pid=PID_NULL)
 Default constructor.
 
virtual void clear ()
 This method clears the content of the table or descriptor.
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
UString dataName (const UChar *section, INT value, NamesFlags flags=NamesFlags::NAME, size_t bits=0, INT alternate=0)
 Get a name from a specified section in the DVB names file for that signalization structure.
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object.
 
bool deserialize (DuckContext &duck, const Descriptor &bin)
 This method deserializes a binary descriptor.
 
bool deserialize (DuckContext &duck, const DescriptorList &dlist, size_t index)
 Deserialize a descriptor from a descriptor list.
 
virtual DescriptorDuplication duplicationMode () const override
 What to do when a descriptor of the same type is added twice in a descriptor list.
 
EDID edid (const AbstractTable *table) const
 Get the extended descriptor id.
 
EDID edid (TID tid=TID_NULL) const
 Get the extended descriptor id.
 
virtual DID extendedTag () const
 For MPEG-defined and DVB-defined extension descriptors, get the extended descriptor tag (first byte in payload).
 
bool fromCommmandLine (const UString &value, Report &report=(ts::NullReport::Instance()))
 Decode a command-line CA_descriptor and fills this object with it.
 
void fromXML (DuckContext &duck, const xml::Element *element)
 This method converts an XML structure to a table or descriptor in this object.
 
void invalidate ()
 Invalidate this object.
 
bool isPrivateDescriptor () const
 Check if this descriptor is a private descriptor.
 
bool isValid () const
 Check if this object is valid.
 
virtual bool merge (const AbstractDescriptor &desc)
 Merge the content of a descriptor into this object.
 
PDS requiredPDS () const
 Get the required private data specifier.
 
bool serialize (DuckContext &duck, Descriptor &bin) const
 This method serializes a descriptor.
 
DID tag () const
 Get the descriptor tag.
 
xml::ElementtoXML (DuckContext &duck, xml::Element *parent) const
 This method converts this object to XML.
 
UString xmlName () const
 Get the XMl node name representing this table or descriptor.
 

Static Public Member Functions

static bool AddFromCommandLine (DuckContext &duck, DescriptorList &dlist, const UStringVector &values)
 Static method to decode command-line CA_descriptor and add them in a descriptor list.
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
static UString DataName (const UChar *xml_name, const UChar *section, INT value, NamesFlags flags=NamesFlags::NAME, size_t bits=0, INT alternate=0)
 Get a name from a specified section in the DVB names file.
 
static void DisplayDescriptor (ts::TablesDisplay &display, ts::PSIBuffer &payload, const ts::UString &margin, ts::DID did, ts::TID tid, ts::PDS pds)
 Static method to display a descriptor.
 
static size_t SearchByCAS (const DescriptorList &dlist, uint16_t casid, size_t start_index=0)
 Static method to search a CA_descriptor by CA system id in a descriptor list.
 
static size_t SearchByPID (const DescriptorList &dlist, PID pid, size_t start_index=0)
 Static method to search a CA_descriptor by ECM/EMM PID in a descriptor list.
 

Public Attributes

PID ca_pid = 0
 PID for CA tables (ECM or EMM).
 
uint16_t cas_id = 0
 CA system id.
 
ByteBlock private_data {}
 CA-specific private data.
 

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 &, const xml::Element *) override
 Helper method to convert this object from XML.
 
virtual void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML.
 
virtual void clearContent () override
 Helper method to clear the content of the table or descriptor.
 
virtual void deserializePayload (PSIBuffer &) override
 Deserialize the payload of the descriptor.
 
virtual void serializePayload (PSIBuffer &) const override
 Serialize the payload of the descriptor.
 

Detailed Description

Representation of a generic CA_descriptor.

Specialized classes may exist, depending on the CA_system_id.

See also
ISO/IEC 13818-1, ITU-T Rec. H.222.0, 2.6.16.

Constructor & Destructor Documentation

◆ CADescriptor() [1/2]

ts::CADescriptor::CADescriptor ( uint16_t  cas_id = 0,
PID  ca_pid = PID_NULL 
)

Default constructor.

Parameters
[in]cas_idCA system id.
[in]ca_pidPID for CA tables (ECM or EMM).

◆ CADescriptor() [2/2]

ts::CADescriptor::CADescriptor ( 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

◆ fromCommmandLine()

bool ts::CADescriptor::fromCommmandLine ( const UString value,
Report report = (ts::NullReport::Instance()) 
)

Decode a command-line CA_descriptor and fills this object with it.

Parameters
[in]valueCA descriptor in command-line form: casid/pid[/private-data] The mandatory parts, casid and pid, are integer values, either decimal or hexadecimal. The optional private data must be a suite of hexadecimal digits.
[in,out]reportWhere to report errors (typically badly formed parameters).
Returns
True on success, false on error.

◆ AddFromCommandLine()

static bool ts::CADescriptor::AddFromCommandLine ( DuckContext duck,
DescriptorList dlist,
const UStringVector values 
)
static

Static method to decode command-line CA_descriptor and add them in a descriptor list.

Parameters
[in,out]duckTSDuck execution context. The reference is kept inside this object.
[in,out]dlistDescriptor list. The new CA descriptors are added in the list.
[in]valuesList of CA descriptors in command-line form: casid/pid[/private-data]
Returns
True on success, false on error.
See also
fromCommmandLine()

◆ SearchByPID()

static size_t ts::CADescriptor::SearchByPID ( const DescriptorList dlist,
PID  pid,
size_t  start_index = 0 
)
static

Static method to search a CA_descriptor by ECM/EMM PID in a descriptor list.

Parameters
[in]dlistDescriptor list to search
[in]pidECM/EMM PID to search.
[in]start_indexStart searching at this index.
Returns
The index of the descriptor in the list or its count() if no such descriptor is found.

◆ SearchByCAS()

static size_t ts::CADescriptor::SearchByCAS ( const DescriptorList dlist,
uint16_t  casid,
size_t  start_index = 0 
)
static

Static method to search a CA_descriptor by CA system id in a descriptor list.

Parameters
[in]dlistDescriptor list to search
[in]casidCA system id to search.
[in]start_indexStart searching at this index.
Returns
The index of the descriptor in the list or its count() if no such descriptor is found.

◆ DisplayDescriptor()

static void ts::CADescriptor::DisplayDescriptor ( ts::TablesDisplay display,
ts::PSIBuffer payload,
const ts::UString margin,
ts::DID  did,
ts::TID  tid,
ts::PDS  pds 
)
static

Static method to display a descriptor.


Parameters
[in,out]displayDisplay engine.
[in,out]payloadA PSIBuffer over the payload.
[in]marginLeft margin content.
[in]didDescriptor id.
[in]tidTable id of table containing the descriptors.
[in]pdsPrivate Data Specifier.

◆ duplicationMode()

virtual DescriptorDuplication ts::CADescriptor::duplicationMode ( ) const
overridevirtual

What to do when a descriptor of the same type is added twice in a descriptor list.

The default action is DescriptorDuplication::ADD, meaning that descriptors are added to the list. Descriptor subclasses should override this method to define a new action.

Returns
The descriptor duplication mode for this class of descriptors.

Reimplemented from ts::AbstractDescriptor.

◆ clearContent()

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

◆ serializePayload()

virtual void ts::CADescriptor::serializePayload ( PSIBuffer buf) const
overrideprotectedvirtual

Serialize the payload of the descriptor.

When serialize() is called, the output binary descriptor is cleared and serializePayload() is called. A subclass shall implement serializePayload().

Important: With extension descriptors (MPEG or DVB), serializePayload() does not need to add the extended descriptor tag, it has already been added in the buffer by AbstractDescriptor::serialize().

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(). For "extended descriptors", the buffer starts after the "extension tag" which was already written by the caller.

Implements ts::AbstractDescriptor.

◆ deserializePayload()

virtual void ts::CADescriptor::deserializePayload ( PSIBuffer buf)
overrideprotectedvirtual

Deserialize the payload of the descriptor.

When deserialize() is called, this object is cleared and validated. Then, deserializePayload() is invoked. A subclass shall implement deserializePayload().

Important: With extension descriptors (MPEG or DVB), deserializePayload() must not read the extended descriptor tag, it has already been extracted from the buffer and verified by AbstractDescriptor::deserialize().

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. For "extended descriptors", the buffer starts after the "extension tag".

Implements ts::AbstractDescriptor.

◆ buildXML()

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

◆ edid() [1/2]

EDID ts::AbstractDescriptor::edid ( TID  tid = TID_NULL) const
inherited

Get the extended descriptor id.

Parameters
[in]tidCheck if the descriptor is table-specific for this table-id.
Returns
The extended descriptor id.

◆ edid() [2/2]

EDID ts::AbstractDescriptor::edid ( const AbstractTable table) const
inherited

Get the extended descriptor id.

Parameters
[in]tableCheck if the descriptor is table-specific for this table.
Returns
The extended descriptor id.

◆ merge()

virtual bool ts::AbstractDescriptor::merge ( const AbstractDescriptor desc)
virtualinherited

Merge the content of a descriptor into this object.

This method implements the duplication mode DescriptorDuplication::MERGE and is specific to each descriptor subclass. By default, the merge fails.

Parameters
[in]descThe other descriptor to merge into this object. Usually, desc has the same subclass as this object, although this is not required. This is up to the implementation of the subclass to decide what to do.
Returns
True if the merge succeeded, false if it failed.

Reimplemented in ts::AbstractLogicalChannelDescriptor, ts::AbstractMultilingualDescriptor, ts::DVBAC3Descriptor, ts::DVBEnhancedAC3Descriptor, ts::LocalTimeOffsetDescriptor, ts::ServiceListDescriptor, ts::EutelsatChannelNumberDescriptor, and ts::NorDigLogicalChannelDescriptorV1.

◆ extendedTag()

virtual DID ts::AbstractDescriptor::extendedTag ( ) const
virtualinherited

For MPEG-defined and DVB-defined extension descriptors, get the extended descriptor tag (first byte in payload).

Returns
The extended descriptor tag or EDID_NULL if this is not an extended descriptor.

Reimplemented in ts::AudioPreselectionDescriptor, ts::C2BundleDeliverySystemDescriptor, ts::C2DeliverySystemDescriptor, ts::CIAncillaryDataDescriptor, ts::CPCMDeliverySignallingDescriptor, ts::CPDescriptor, ts::CPIdentifierDescriptor, ts::DTSHDDescriptor, ts::DTSNeuralDescriptor, ts::DVBAC4Descriptor, ts::DVBDTSUHDDescriptor, ts::DVBServiceProminenceDescriptor, ts::ImageIconDescriptor, ts::MessageDescriptor, ts::NetworkChangeNotifyDescriptor, ts::ProtectionMessageDescriptor, ts::S2XSatelliteDeliverySystemDescriptor, ts::S2Xv2SatelliteDeliverySystemDescriptor, ts::ServiceRelocatedDescriptor, ts::SHDeliverySystemDescriptor, ts::SupplementaryAudioDescriptor, ts::T2DeliverySystemDescriptor, ts::T2MIDescriptor, ts::TargetRegionDescriptor, ts::TargetRegionNameDescriptor, ts::TTMLSubtitlingDescriptor, ts::URILinkageDescriptor, ts::VideoDepthRangeDescriptor, ts::VVCSubpicturesDescriptor, ts::AFExtensionsDescriptor, ts::EVCTimingAndHRDDescriptor, ts::GreenExtensionDescriptor, ts::HEVCHierarchyExtensionDescriptor, ts::HEVCOperationPointDescriptor, ts::HEVCSubregionDescriptor, ts::HEVCTileSubstreamDescriptor, ts::HEVCTimingAndHRDDescriptor, ts::JPEGXSVideoDescriptor, ts::LCEVCLinkageDescriptor, ts::LCEVCVideoDescriptor, ts::MediaServiceKindDescriptor, ts::MPEGH3DAudioDescriptor, ts::MPEGH3DAudioMultiStreamDescriptor, ts::MPEGH3DAudioSceneDescriptor, ts::MPEGH3DAudioTextLabelDescriptor, ts::QualityExtensionDescriptor, ts::VirtualSegmentationDescriptor, and ts::VVCTimingAndHRDDescriptor.

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

◆ serialize()

bool ts::AbstractDescriptor::serialize ( DuckContext duck,
Descriptor bin 
) const
inherited

This method serializes a descriptor.

Parameters
[in,out]duckTSDuck execution context.
[out]binA binary descriptor object. Its content is replaced with a binary representation of this descriptor.
Returns
True in case of success, false if the descriptor is invalid.

◆ deserialize() [1/2]

bool ts::AbstractDescriptor::deserialize ( DuckContext duck,
const Descriptor bin 
)
inherited

This method deserializes a binary descriptor.

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.
Returns
True in case of success, false if the descriptor is invalid.

◆ deserialize() [2/2]

bool 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.
Returns
True in case of success, false if the descriptor is invalid.

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

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

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

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

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.

◆ DataName()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
static UString ts::AbstractSignalization::DataName ( const UChar xml_name,
const UChar section,
INT  value,
NamesFlags  flags = NamesFlags::NAME,
size_t  bits = 0,
INT  alternate = 0 
)
inlinestaticinherited

Get a name from a specified section in the DVB names file.

Template Parameters
INTAn integer type.
Parameters
[in]xml_nameTable or descriptor name, as used in XML structures.
[in]sectionName of section to search. Not case-sensitive. The actual section in the names file is prefixed by the XML name, followed by a dot.
[in]valueValue to get the name for.
[in]flagsPresentation flags.
[in]bitsNominal size in bits of the data, optional.
[in]alternateDisplay this integer value if flags ALTERNATE is set.
Returns
The corresponding name.

◆ dataName()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value, int >::type = 0>
UString ts::AbstractSignalization::dataName ( const UChar section,
INT  value,
NamesFlags  flags = NamesFlags::NAME,
size_t  bits = 0,
INT  alternate = 0 
)
inlineinherited

Get a name from a specified section in the DVB names file for that signalization structure.

Template Parameters
INTAn integer type.
Parameters
[in]sectionName of section to search. Not case-sensitive. The actual section in the names file is prefixed by the XML name of the structure, followed by a dot.
[in]valueValue to get the name for.
[in]flagsPresentation flags.
[in]bitsNominal size in bits of the data, optional.
[in]alternateDisplay this integer value if flags ALTERNATE is set.
Returns
The corresponding name.

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