QtlMovie 1.12 (A specialized FFmpeg front-end)
QtsDescriptorList Class Reference

List of MPEG PSI/SI descriptors. More...

Classes

struct  Element
 Each entry contains a descriptor and its corresponding private data specifier. More...
 

Public Member Functions

 QtsDescriptorList ()
 Default constructor: empty list. More...
 
 QtsDescriptorList (const QtsDescriptorList &other)
 Copy constructor: the descriptors objects are shared between the two lists. More...
 
bool append (const QtsDescriptorPtr &desc)
 Append one descriptor at end of list. More...
 
bool append (const QtsAbstractDescriptor &desc)
 Append one descriptor at end of list. More...
 
void append (const QtsDescriptorList &list)
 Append another list of descriptors at end of list. More...
 
bool append (const void *addr, int size)
 Append all descriptors from a memory area at end of list. More...
 
bool append (const void *addr)
 Append one descriptor from a memory area at end of list. More...
 
bool appendFromLength (const quint8 *&addr, int &size)
 Append all descriptors from a memory area at end of list. More...
 
void appendPrivateDataSpecifier (QtsPrivDataSpec pds)
 Append a private_data_specifier if necessary at end of list. More...
 
int binarySize () const
 Evaluate the total number of bytes that is required to serialize the list of descriptors. More...
 
void clear ()
 Clear the content of the descriptor list. More...
 
int lengthSerialize (quint8 *&addr, int &size, int startIndex=0) const
 Serialize the content of the descriptor list. More...
 
int lengthSerialize (QtlByteBlock &data, int maxDataSize, int startIndex=0) const
 Serialize the content of the descriptor list. More...
 
bool operator!= (const QtsDescriptorList &other) const
 Difference operator. More...
 
bool operator== (const QtsDescriptorList &other) const
 Comparison operator. More...
 
const QtsDescriptorPtroperator[] (int index) const
 Return a reference to the descriptor at specified index. More...
 
QtsPrivDataSpec privateDataSpecifier (int index) const
 Return the "private data specifier" associated to the descriptor at the specified index. More...
 
bool removeByIndex (int index)
 Remove the descriptor at the specified index in the list. More...
 
int removeByTag (QtsDescTag tag, QtsPrivDataSpec pds=0)
 Remove all descriptors with the specified tag. More...
 
int removeInvalidPrivateDescriptors ()
 Remove all private descriptors without preceding private_data_specifier_descriptor. More...
 
int search (QtsDescTag tag, int startIndex=0, QtsPrivDataSpec pds=0) const
 Search a descriptor with the specified tag. More...
 
int serialize (quint8 *&addr, int &size, int startIndex=0) const
 Serialize the content of the descriptor list. More...
 
int serialize (QtlByteBlock &data, int maxDataSize, int startIndex=0) const
 Serialize the content of the descriptor list. More...
 
int size () const
 Get the number of descriptors in the list. More...
 

Private Types

typedef QList< ElementElementList
 List of elements. More...
 

Private Member Functions

bool prepareRemovePds (int index)
 Prepare the removal of a private_data_specifier descriptor. More...
 

Private Attributes

ElementList _list
 The only data field is a list of elements. More...
 

Detailed Description

List of MPEG PSI/SI descriptors.

Member Typedef Documentation

◆ ElementList

typedef QList<Element> QtsDescriptorList::ElementList
private

List of elements.

Constructor & Destructor Documentation

◆ QtsDescriptorList() [1/2]

QtsDescriptorList::QtsDescriptorList ( )
inline

Default constructor: empty list.

◆ QtsDescriptorList() [2/2]

QtsDescriptorList::QtsDescriptorList ( const QtsDescriptorList other)
inline

Copy constructor: the descriptors objects are shared between the two lists.

Parameters
[in]otherOther instance to copy.

Member Function Documentation

◆ size()

int QtsDescriptorList::size ( ) const
inline

Get the number of descriptors in the list.

Returns
The number of descriptors in the list.

◆ operator==()

bool QtsDescriptorList::operator== ( const QtsDescriptorList other) const

Comparison operator.

Parameters
[in]otherOther instance to copy.
Returns
True if the two lists are identical.

◆ operator!=()

bool QtsDescriptorList::operator!= ( const QtsDescriptorList other) const
inline

Difference operator.

Parameters
[in]otherOther instance to copy.
Returns
True if the two lists are different.

◆ operator[]()

const QtsDescriptorPtr& QtsDescriptorList::operator[] ( int  index) const
inline

Return a reference to the descriptor at specified index.

Parameters
[in]indexIndex of descriptor in the list. Valid index are 0 to size()-1. Undefined behavior otherwise.
Returns
A reference to the descriptor at specified index.

◆ privateDataSpecifier()

QtsPrivDataSpec QtsDescriptorList::privateDataSpecifier ( int  index) const
inline

Return the "private data specifier" associated to the descriptor at the specified index.

Parameters
[in]indexIndex of descriptor in the list. Valid index are 0 to size()-1. Undefined behavior otherwise.
Returns
The private data specified for the descriptor or zero if there is none.

◆ append() [1/5]

bool QtsDescriptorList::append ( const QtsDescriptorPtr desc)

Append one descriptor at end of list.

Parameters
[in]descA smart pointer to a binary descriptor. The pointed binary descriptor is shared with the list.
Returns
True on success, false on error (invalid descriptor, etc.)

◆ append() [2/5]

bool QtsDescriptorList::append ( const QtsAbstractDescriptor desc)

Append one descriptor at end of list.

Parameters
[in]descA descriptor. A binary copy of the descriptor is stored in the list.
Returns
True on success, false on error (invalid descriptor, etc.)

◆ append() [3/5]

void QtsDescriptorList::append ( const QtsDescriptorList list)
inline

Append another list of descriptors at end of list.

The descriptors objects are shared between the two lists.

Parameters
[in]listA list of descriptors to append.

◆ append() [4/5]

bool QtsDescriptorList::append ( const void *  addr,
int  size 
)

Append all descriptors from a memory area at end of list.

Stop when an invalid descriptor is encountered.

Parameters
[in]addrAddress of memory area.
[in]sizeSize in bytes of memory area.
Returns
True on success, false on error (invalid descriptor, etc.)

◆ appendFromLength()

bool QtsDescriptorList::appendFromLength ( const quint8 *&  addr,
int &  size 
)

Append all descriptors from a memory area at end of list.

Same as append(const void*,int), but read a 2-byte length field before the descriptor list. The 2-byte length field has 4 reserved bits (all '1') and 12 bits for the length of the descriptor list.

Parameters
[in,out]addrAddress where to start reading the list. addr is updated to point after the last deserialized descriptor.
[in,out]sizeSize of the memory area from which to read descriptors. size is updated with the remaining space after the last deserialized descriptor.
Returns
True if a complete descriptor list was read or true if the designated area was too small.

◆ append() [5/5]

bool QtsDescriptorList::append ( const void *  addr)
inline

Append one descriptor from a memory area at end of list.

The size is extracted from the descriptor header.

Parameters
[in]addrAddress of memory area.
Returns
True on success, false on error (invalid descriptor, etc.)

◆ appendPrivateDataSpecifier()

void QtsDescriptorList::appendPrivateDataSpecifier ( QtsPrivDataSpec  pds)

Append a private_data_specifier if necessary at end of list.

If the current private data specified at end of list is already pds, do nothing.

Parameters
[in]pdsPrivate data descriptor value.

◆ removeByIndex()

bool QtsDescriptorList::removeByIndex ( int  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).

Parameters
[in]indexIndex of descriptor in the list.
Returns
True on success, false on error (index out of range or required private_data_specifier descriptor).

◆ removeByTag()

int QtsDescriptorList::removeByTag ( QtsDescTag  tag,
QtsPrivDataSpec  pds = 0 
)

Remove all descriptors with the specified tag.

If pds is non-zero and tag is >= 0x80, remove only descriptors with the corresponding "private data specifier". A private_data_specifier descriptor can be removed only if it is not necessary (no private descriptor ahead).

Parameters
[in]tagTag of descriptors to remove.
[in]pdsOptional associated private data descriptor.
Returns
The number of removed descriptors.

◆ removeInvalidPrivateDescriptors()

int QtsDescriptorList::removeInvalidPrivateDescriptors ( )

Remove all private descriptors without preceding private_data_specifier_descriptor.

Returns
The number of removed descriptors.

◆ clear()

void QtsDescriptorList::clear ( )
inline

Clear the content of the descriptor list.

◆ search()

int QtsDescriptorList::search ( QtsDescTag  tag,
int  startIndex = 0,
QtsPrivDataSpec  pds = 0 
) const

Search a descriptor with the specified tag.

If pds is non-zero and tag is >= 0x80, search only descriptors with the corresponding "private data specifier".

Parameters
[in]tagTag of descriptor to search.
[in]startIndexStart searching at that index in the list.
[in]pdsOptional associated private data descriptor.
Returns
The the index of the descriptor in the list or size() if no such descriptor is found.

◆ binarySize()

int QtsDescriptorList::binarySize ( ) const

Evaluate the total number of bytes that is required to serialize the list of descriptors.

◆ serialize() [1/2]

int QtsDescriptorList::serialize ( quint8 *&  addr,
int &  size,
int  startIndex = 0 
) const

Serialize the content of the descriptor list.

Descriptors are written one by one until either the end of the list or until one descriptor does not fit in the memory area.

Parameters
[in,out]addrAddress where to start writing descriptors. addr is updated to point after the last written descriptor.
[in,out]sizeSize of the memory area to write descriptors. size is updated with the remaining free space after the list.
[in]startIndexStart serializing at that index in the list.
Returns
The index of the first descriptor that could not be serialized or size() if all descriptors were serialized. In the first case, the returned index can be used as startIndex to serialize the rest of the list, in another section for instance.

◆ serialize() [2/2]

int QtsDescriptorList::serialize ( QtlByteBlock data,
int  maxDataSize,
int  startIndex = 0 
) const

Serialize the content of the descriptor list.

Descriptors are written one by one until either the end of the list or until one descriptor does not fit in the byte block.

Parameters
[in,out]dataByte block into which the descriptor list is appended.
[in]maxDataSizeMaximum size of the byte block to write descriptors.
[in]startIndexStart serializing at that index in the list.
Returns
The index of the first descriptor that could not be serialized or size() if all descriptors were serialized. In the first case, the returned index can be used as startIndex to serialize the rest of the list, in another section for instance.

◆ lengthSerialize() [1/2]

int QtsDescriptorList::lengthSerialize ( quint8 *&  addr,
int &  size,
int  startIndex = 0 
) const

Serialize the content of the descriptor list.

Same as serialize(), but prepend a 2-byte length field before the descriptor list. The 2-byte length field has 4 reserved bits (all '1') and 12 bits for the length of the descriptor list.

Parameters
[in,out]addrAddress where to start writing descriptors. addr is updated to point after the last written descriptor.
[in,out]sizeSize of the memory area to write descriptors. size is updated with the remaining free space after the list.
[in]startIndexStart serializing at that index in the list.
Returns
The index of the first descriptor that could not be serialized or size() if all descriptors were serialized. In the first case, the returned index can be used as startIndex to serialize the rest of the list, in another section for instance.

◆ lengthSerialize() [2/2]

int QtsDescriptorList::lengthSerialize ( QtlByteBlock data,
int  maxDataSize,
int  startIndex = 0 
) const

Serialize the content of the descriptor list.

Same as serialize(), but prepend a 2-byte length field before the descriptor list. The 2-byte length field has 4 reserved bits (all '1') and 12 bits for the length of the descriptor list.

Parameters
[in,out]dataByte block into which the descriptor list is appended.
[in]maxDataSizeMaximum size of the byte block to write descriptors.
[in]startIndexStart serializing at that index in the list.
Returns
The index of the first descriptor that could not be serialized or size() if all descriptors were serialized. In the first case, the returned index can be used as startIndex to serialize the rest of the list, in another section for instance.

◆ prepareRemovePds()

bool QtsDescriptorList::prepareRemovePds ( int  index)
private

Prepare the removal of a private_data_specifier descriptor.

Return true if can be removed, false if it cannot (private descriptors ahead). When it can be removed, the current PDS of all subsequent descriptors is updated.

Parameters
[in]indexIndex in the list of the private_data_specifier descriptor is about to be removed.

Member Data Documentation

◆ _list

ElementList QtsDescriptorList::_list
private

The only data field is a list of elements.


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