TSDuck Version 3.20-1669 (TSDuck - The MPEG Transport Stream Toolkit)
ts::CVCT Class Reference

Representation of an ATSC Cable Virtual Channel Table (CVCT) More...

Inheritance diagram for ts::CVCT:
Collaboration diagram for ts::CVCT:

Public Types

typedef EntryWithDescriptorsList< ChannelChannelList
 List of channels.
 

Public Member Functions

 CVCT (uint8_t version=0, bool is_current=true)
 Default constructor. More...
 
 CVCT (DuckContext &duck, const BinaryTable &table)
 Constructor from a binary table. More...
 
virtual ~CVCT ()
 Virtual destructor.
 
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...
 
ChannelList::const_iterator findService (uint16_t id, bool same_ts=true) const
 Search a service by id. More...
 
ChannelList::const_iterator findService (uint16_t major, uint16_t minor, bool same_ts=true) const
 Search a service by major.minor id. More...
 
ChannelList::const_iterator findService (const UString &name, bool exact_match=false, bool same_ts=true) const
 Search a service by name. More...
 
bool findService (Service &service, bool exact_match=false, bool same_ts=true) const
 Search a service by name or ATSC major.minor, using a ts::Service class. 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 UString DeserializeLanguageCode (const uint8_t *data)
 This static method deserializes a 3-byte language or country code. More...
 
static void DisplaySection (ts::TablesDisplay &display, const ts::Section &section, int indent)
 A static method to display a section. 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

ChannelList channels
 List of channels which are described in this VCT.
 
DescriptorList descs
 Program-level descriptor list.
 
bool is_current
 True if table is current, false if table is next.
 
uint8_t protocol_version
 ATSC protocol version.
 
uint16_t transport_stream_id
 Transport stream id.
 
uint8_t version
 Table version number.
 

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 void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML. More...
 
bool checkXMLName (const xml::Element *element, const UChar *legacy_name=nullptr) const
 Check that an XML element has the right name for this table. 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...
 
virtual void deserializeContent (DuckContext &, const BinaryTable &) override
 This abstract method deserializes the content of a binary table. 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 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...
 

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 an ATSC Cable Virtual Channel Table (CVCT)

See also
ATSC A/65, section 6.3.2.

Constructor & Destructor Documentation

◆ CVCT() [1/2]

ts::CVCT::CVCT ( uint8_t  version = 0,
bool  is_current = true 
)

Default constructor.

Parameters
[in]versionTable version number.
[in]is_currentTrue if table is current, false if table is next.

◆ CVCT() [2/2]

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

Constructor from a binary table.

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

Member Function Documentation

◆ findService() [1/4]

ChannelList::const_iterator ts::VCT::findService ( uint16_t  id,
bool  same_ts = true 
) const
inherited

Search a service by id.

Parameters
[in]idService id to search.
[in]same_tsIf true, only look for services in the same TS as the VCT.
Returns
An iterator to the service if found, channels.end() if not found.

◆ findService() [2/4]

ChannelList::const_iterator ts::VCT::findService ( uint16_t  major,
uint16_t  minor,
bool  same_ts = true 
) const
inherited

Search a service by major.minor id.

Parameters
[in]majorMajor id to search.
[in]minorMinor id to search.
[in]same_tsIf true, only look for services in the same TS as the VCT.
Returns
An iterator to the service if found, channels.end() if not found.

◆ findService() [3/4]

ChannelList::const_iterator ts::VCT::findService ( const UString name,
bool  exact_match = false,
bool  same_ts = true 
) const
inherited

Search a service by name.

Parameters
[in]nameService name to search.
[in]exact_matchIf true, the service name must be exactly identical to name. If it is false, the search is case-insensitive and blanks are ignored.
[in]same_tsIf true, only look for services in the same TS as the VCT.
Returns
An iterator to the service if found, channels.end() if not found.

◆ findService() [4/4]

bool ts::VCT::findService ( Service service,
bool  exact_match = false,
bool  same_ts = true 
) const
inherited

Search a service by name or ATSC major.minor, using a ts::Service class.

Parameters
[in,out]serviceService description. Use service name or major.minor to search. Set the service id if found.
[in]exact_matchIf true, the service name must be exactly identical to the name in service. If it is false, the search is case-insensitive and blanks are ignored.
[in]same_tsIf true, only look for services in the same TS as the VCT.
Returns
True if the service is found, false if not found.

◆ fromXML()

virtual void ts::VCT::fromXML ( DuckContext duck,
const xml::Element element 
)
overridevirtualinherited

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::VCT::DisplaySection ( ts::TablesDisplay display,
const ts::Section section,
int  indent 
)
staticinherited

A static method to display a section.

Parameters
[in,out]displayDisplay engine.
[in]sectionThe section to display.
[in]indentIndentation width.

◆ serializeContent()

virtual void ts::VCT::serializeContent ( DuckContext duck,
BinaryTable bin 
) const
overrideprotectedvirtualinherited

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::VCT::deserializeContent ( DuckContext duck,
const BinaryTable bin 
)
overrideprotectedvirtualinherited

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::VCT::buildXML ( DuckContext duck,
xml::Element root 
) const
overrideprotectedvirtualinherited

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

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.

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

◆ checkXMLName()

bool ts::AbstractSignalization::checkXMLName ( const xml::Element element,
const UChar legacy_name = nullptr 
) const
protectedinherited

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

Parameters
[in]elementXML element to check.
[in]legacy_nameIf not null, specifies an alternate legacy name.
Returns
True on success, false on error.

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