TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
List of MPEG PSI/SI descriptors. More...
#include <tsDescriptorList.h>
Public Member Functions | |
DescriptorList (const AbstractTable *table) | |
Basic constructor. | |
DescriptorList (const AbstractTable *table, const DescriptorList &dl) | |
Basic copy-like constructor. | |
DescriptorList (const AbstractTable *table, DescriptorList &&dl) noexcept | |
Basic move-like constructor. | |
void | add (const DescriptorList &dl) |
Add another list of descriptors at end of list. | |
bool | add (const DescriptorPtr &desc) |
Add one descriptor at end of list. | |
bool | add (const void *addr) |
Add one descriptor from a memory area at end of list. | |
bool | add (const void *addr, size_t size) |
Add descriptors from a memory area at end of list. | |
bool | add (DuckContext &duck, const AbstractDescriptor &desc) |
Add one descriptor at end of list. | |
void | addPrivateDataSpecifier (PDS pds) |
Add a private_data_specifier descriptor if necessary at end of list. | |
size_t | binarySize (size_t start=0, size_t count=NPOS) const |
Total number of bytes that is required to serialize the list of descriptors. | |
void | clear () |
Clear the content of the descriptor list. | |
size_t | count () const |
Get the number of descriptors in the list (same as size()). | |
EDID | edid (size_t index) const |
Get the extended descriptor id of a descriptor in the list. | |
bool | empty () const |
Check if the descriptor list is empty. | |
bool | fromXML (DuckContext &duck, const xml::Element *parent) |
This method decodes an XML list of descriptors. | |
bool | fromXML (DuckContext &duck, xml::ElementVector &others, const xml::Element *parent, const UString &allowedOthers) |
This method decodes an XML list of descriptors. | |
bool | fromXML (DuckContext &duck, xml::ElementVector &others, const xml::Element *parent, const UStringList &allowedOthers) |
This method decodes an XML list of descriptors. | |
size_t | lengthSerialize (uint8_t *&addr, size_t &size, size_t start=0, uint16_t reserved_bits=0x000F, size_t length_bits=12) const |
Same as serialize(), but prepend a 2-byte length field before the descriptor list. | |
void | merge (DuckContext &duck, const AbstractDescriptor &desc) |
Merge one descriptor in the list. | |
void | merge (DuckContext &duck, const DescriptorList &other) |
Merge another descriptor list in this list. | |
DescriptorList & | operator= (const DescriptorList &dl) |
Assignment operator. | |
DescriptorList & | operator= (DescriptorList &&dl) noexcept |
Move assignment operator. | |
bool | operator== (const DescriptorList &other) const |
Comparison operator. | |
const DescriptorPtr & | operator[] (size_t index) const |
Get a reference to the descriptor at a specified index. | |
PDS | privateDataSpecifier (size_t index) const |
Return the "private data specifier" associated to a descriptor in the list. | |
bool | removeByIndex (size_t index) |
Remove the descriptor at the specified index in the list. | |
size_t | removeByTag (DID tag, PDS pds=0) |
Remove all descriptors with the specified tag. | |
size_t | removeInvalidPrivateDescriptors () |
Remove all private descriptors without preceding private_data_specifier_descriptor. | |
size_t | search (const EDID &edid, size_t start_index=0) const |
Search a descriptor with the specified extended tag. | |
size_t | search (DID tag, size_t start_index=0, PDS pds=0) const |
Search a descriptor with the specified tag. | |
template<class DESC , typename std::enable_if< std::is_base_of< AbstractDescriptor, DESC >::value >::type * = nullptr> | |
size_t | search (DuckContext &duck, DID tag, DESC &desc, size_t start_index=0, PDS pds=0) const |
Search a descriptor with the specified tag. | |
size_t | searchLanguage (const DuckContext &duck, const UString &language, size_t start_index=0) const |
Search a descriptor for the specified language. | |
size_t | searchSubtitle (const UString &language=UString(), size_t start_index=0) const |
Search any kind of subtitle descriptor. | |
size_t | serialize (ByteBlock &bb, size_t start=0) const |
Serialize the content of the descriptor list in a byte block. | |
size_t | serialize (uint8_t *&addr, size_t &size, size_t start=0) const |
Serialize the content of the descriptor list. | |
size_t | size () const |
Get the number of descriptors in the list (same as count()). | |
const AbstractTable * | table () const |
Get the parent table. | |
TID | tableId () const |
Get the table id of the parent table. | |
bool | toXML (DuckContext &duck, xml::Element *parent) const |
This method converts a descriptor list to XML. | |
List of MPEG PSI/SI descriptors.
|
explicit |
Basic constructor.
[in] | table | Parent table. A descriptor list is always attached to a table it is part of. Use zero for a descriptor list object outside a table. There is no default value because zero is considered as an unusual use case and we want to avoid missing table pointer in constructors of the various tables. |
ts::DescriptorList::DescriptorList | ( | const AbstractTable * | table, |
const DescriptorList & | dl | ||
) |
Basic copy-like constructor.
We forbid a real copy constructor because we want to copy the descriptors only, while the parent table is usually different. The descriptors objects are shared between the two lists.
[in] | table | Parent table. A descriptor list is always attached to a table it is part of. Use zero for a descriptor list object outside a table. |
[in] | dl | Another instance to copy. |
|
noexcept |
Basic move-like constructor.
We forbid a real move constructor because we want to copy the descriptors only, while the parent table is usually different.
[in] | table | Parent table. A descriptor list is always attached to a table it is part of. Use zero for a descriptor list object outside a table. |
[in,out] | dl | Another instance to move. |
DescriptorList & ts::DescriptorList::operator= | ( | const DescriptorList & | dl | ) |
Assignment operator.
The descriptors objects are shared between the two lists. The parent table remains unchanged.
[in] | dl | Another instance to copy. |
|
noexcept |
Move assignment operator.
The descriptors objects are moved. The parent table remains unchanged.
[in,out] | dl | Another instance to move. |
|
inline |
Check if the descriptor list is empty.
|
inline |
Get the number of descriptors in the list (same as count()).
|
inline |
Get the number of descriptors in the list (same as size()).
TID ts::DescriptorList::tableId | ( | ) | const |
Get the table id of the parent table.
|
inline |
Get the parent table.
bool ts::DescriptorList::operator== | ( | const DescriptorList & | other | ) | const |
Comparison operator.
[in] | other | Another instance to compare. |
const DescriptorPtr & ts::DescriptorList::operator[] | ( | size_t | index | ) | const |
Get a reference to the descriptor at a specified index.
[in] | index | Index in the list. Valid index are 0 to count()-1. |
EDID ts::DescriptorList::edid | ( | size_t | index | ) | const |
Get the extended descriptor id of a descriptor in the list.
[in] | index | Index of a descriptor in the list. Valid index are 0 to count()-1. |
PDS ts::DescriptorList::privateDataSpecifier | ( | size_t | index | ) | const |
Return the "private data specifier" associated to a descriptor in the list.
[in] | index | Index of a descriptor in the list. Valid index are 0 to count()-1. |
bool ts::DescriptorList::add | ( | const DescriptorPtr & | desc | ) |
Add one descriptor at end of list.
[in] | desc | The binary descriptor to add. |
bool ts::DescriptorList::add | ( | DuckContext & | duck, |
const AbstractDescriptor & | desc | ||
) |
Add one descriptor at end of list.
[in,out] | duck | TSDuck execution context. |
[in] | desc | The descriptor to add. |
|
inline |
Add another list of descriptors at end of list.
The descriptors objects are shared between the two lists.
[in] | dl | The descriptor list to add. |
bool ts::DescriptorList::add | ( | const void * | addr, |
size_t | size | ||
) |
Add descriptors from a memory area at end of list.
[in] | addr | Address of descriptors in memory. |
[in] | size | Size in bytes of descriptors in memory. |
|
inline |
Add one descriptor from a memory area at end of list.
The size is extracted from the descriptor header.
[in] | addr | Address of the descriptor in memory. |
void ts::DescriptorList::addPrivateDataSpecifier | ( | PDS | pds | ) |
Add a private_data_specifier descriptor if necessary at end of list.
If the current private data specifier at end of list is not pds, a private_data_specifier descriptor is added. If pds is already the current private data specifier, the list is unchanged.
[in] | pds | A private data specifier. |
void ts::DescriptorList::merge | ( | DuckContext & | duck, |
const AbstractDescriptor & | desc | ||
) |
Merge one descriptor in the list.
If a descriptor of the same type is already present in the list, the DescriptorDuplication mode of the descriptor class is applied. If there is no descriptor of the same type, the descriptor is added at the end of the list.
[in,out] | duck | TSDuck execution context. |
[in] | desc | The descriptor to merge. |
void ts::DescriptorList::merge | ( | DuckContext & | duck, |
const DescriptorList & | other | ||
) |
Merge another descriptor list in this list.
All descriptors are merged one by one.
[in,out] | duck | TSDuck execution context. |
[in] | other | The other descriptor list to merge. |
bool ts::DescriptorList::removeByIndex | ( | size_t | index | ) |
Remove the descriptor at the specified index in the list.
A private_data_specifier descriptor can be removed only if it is not necessary (no private descriptor ahead).
[in] | index | Index of the descriptor to remove. |
Remove all descriptors with the specified tag.
A private_data_specifier descriptor can be removed only if it is not necessary (no private descriptor ahead).
[in] | tag | Tag of descriptors to remove. |
[in] | pds | Private data specifier. If pds is non-zero and tag is >= 0x80, remove only descriptors with the corresponding private data specifier. |
size_t ts::DescriptorList::removeInvalidPrivateDescriptors | ( | ) |
Remove all private descriptors without preceding private_data_specifier_descriptor.
Search a descriptor with the specified tag.
[in] | tag | Tag of descriptor to search. |
[in] | start_index | Start searching at this index. |
[in] | pds | Private data specifier. If pds is non-zero and tag is >= 0x80, return only a descriptor with the corresponding private data specifier. |
size_t ts::DescriptorList::search | ( | const EDID & | edid, |
size_t | start_index = 0 |
||
) | const |
Search a descriptor with the specified extended tag.
[in] | edid | Extended tag of descriptor to search. |
[in] | start_index | Start searching at this index. |
size_t ts::DescriptorList::searchLanguage | ( | const DuckContext & | duck, |
const UString & | language, | ||
size_t | start_index = 0 |
||
) | const |
Search a descriptor for the specified language.
This can be an audio, subtitles or other component descriptor.
[in] | duck | TSDuck execution context. |
[in] | language | The 3-character language name to search. |
[in] | start_index | Start searching at this index. |
size_t ts::DescriptorList::searchSubtitle | ( | const UString & | language = UString() , |
size_t | start_index = 0 |
||
) | const |
Search any kind of subtitle descriptor.
[in] | language | The language name to search. If language is non-empty, look only for a subtitle descriptor matching the specified language. In this case, if some kind of subtitle descriptor exists in the list but none matches the language, return count()+1. |
[in] | start_index | Start searching at this index. |
size_t ts::DescriptorList::search | ( | DuckContext & | duck, |
DID | tag, | ||
DESC & | desc, | ||
size_t | start_index = 0 , |
||
PDS | pds = 0 |
||
) | const |
Search a descriptor with the specified tag.
DESC | A subclass of AbstractDescriptor. |
[in,out] | duck | TSDuck execution context. |
[in] | tag | Tag of descriptor to search. |
[out] | desc | When a descriptor with the specified tag is found, it is deserialized into desc. Always check desc.isValid() on return to check if the deserialization was successful. |
[in] | start_index | Start searching at this index. |
[in] | pds | Private data specifier. If pds is non-zero and tag is >= 0x80, return only a descriptor with the corresponding private data specifier. |
size_t ts::DescriptorList::binarySize | ( | size_t | start = 0 , |
size_t | count = NPOS |
||
) | const |
Total number of bytes that is required to serialize the list of descriptors.
[in] | start | Starting index in the descriptor list. |
[in] | count | Maximum number of descriptors to include in the size. |
size_t ts::DescriptorList::serialize | ( | uint8_t *& | addr, |
size_t & | size, | ||
size_t | start = 0 |
||
) | const |
Serialize the content of the descriptor list.
[in,out] | addr | Address of the memory area where the descriptors are serialized. Upon return, addr is updated to contain the next address in memory, after the last serialized byte. |
[in,out] | size | Size in bytes of the memory area where the descriptors are serialized. Upon return, size is updated to the remaining size of the buffer. Descriptors are written one by one until either the end of the list or until one descriptor does not fit. |
[in] | start | Start searializing at this index. |
size_t ts::DescriptorList::serialize | ( | ByteBlock & | bb, |
size_t | start = 0 |
||
) | const |
Serialize the content of the descriptor list in a byte block.
[in,out] | bb | A byte block into which the descriptor list is appended. |
[in] | start | Start searializing at this index. |
size_t ts::DescriptorList::lengthSerialize | ( | uint8_t *& | addr, |
size_t & | size, | ||
size_t | start = 0 , |
||
uint16_t | reserved_bits = 0x000F , |
||
size_t | length_bits = 12 |
||
) | const |
Same as serialize(), but prepend a 2-byte length field before the descriptor list.
The 2-byte length field has 4 reserved bits and 12 bits for the length of the descriptor list. In fact, the number of bits in the length can be set in length_bits.
[in,out] | addr | Address of the memory area where the descriptors are serialized. Upon return, addr is updated to contain the next address in memory, after the last serialized byte. |
[in,out] | size | Size in bytes of the memory area where the descriptors are serialized. Upon return, size is updated to the remaining size of the buffer. Descriptors are written one by one until either the end of the list or until one descriptor does not fit. |
[in] | start | Start serializing at this index in the descriptor list. |
[in] | reserved_bits | Value of the upper bits of the length field. |
[in] | length_bits | Number of meaningful bits in the length field. |
bool ts::DescriptorList::toXML | ( | DuckContext & | duck, |
xml::Element * | parent | ||
) | const |
This method converts a descriptor list to XML.
[in,out] | duck | TSDuck execution context. |
[in,out] | parent | The parent node for the XML descriptors. |
bool ts::DescriptorList::fromXML | ( | DuckContext & | duck, |
xml::ElementVector & | others, | ||
const xml::Element * | parent, | ||
const UStringList & | allowedOthers | ||
) |
This method decodes an XML list of descriptors.
[in,out] | duck | TSDuck execution context. |
[out] | others | Returned list of non-descriptor XML elements. All these elements are not null and their names are in allowedOthers. |
[in] | parent | The XML element containing all descriptors. |
[in] | allowedOthers | A list of allowed element names inside parent which are not descriptors. |
bool ts::DescriptorList::fromXML | ( | DuckContext & | duck, |
xml::ElementVector & | others, | ||
const xml::Element * | parent, | ||
const UString & | allowedOthers | ||
) |
This method decodes an XML list of descriptors.
[in,out] | duck | TSDuck execution context. |
[out] | others | Returned list of non-descriptor XML elements. All these elements are not null and their names are in allowedOthers. |
[in] | parent | The XML element containing all descriptors. |
[in] | allowedOthers | A comma-separated list of allowed element names inside parent which are not descriptors. |
bool ts::DescriptorList::fromXML | ( | DuckContext & | duck, |
const xml::Element * | parent | ||
) |
This method decodes an XML list of descriptors.
[in,out] | duck | TSDuck execution context. |
[in] | parent | The XML element containing all descriptors. All children must be valid descriptors. |