TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::SpliceInsert Class Reference

Representation of an SCTE 35 SpliceInsert command. More...

#include <tsSpliceInsert.h>

Inheritance diagram for ts::SpliceInsert:
Collaboration diagram for ts::SpliceInsert:

Public Types

using SpliceByComponent = std::map< uint8_t, SpliceTime >
 A map of 64-bit PTS time values, indexed by 8-bit component tags.
 

Public Member Functions

 SpliceInsert ()
 Default constructor.
 
void adjustPTS (uint64_t adjustment)
 Adjust PTS time values using the "PTS adjustment" field from a splice information section.
 
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.
 
int deserialize (const uint8_t *data, size_t size)
 Deserialize a SpliceInsert command from binary data.
 
void display (TablesDisplay &display, const UString &margin) const
 Display the splice insert command.
 
virtual void fromXML (DuckContext &duck, const xml::Element *element)
 This method converts an XML structure to a table or descriptor in this object.
 
uint64_t highestPTS () const
 Get the highest PTS value in the command.
 
void invalidate ()
 Invalidate this object.
 
bool isValid () const
 Check if this object is valid.
 
uint64_t lowestPTS () const
 Get the lowest PTS value in the command.
 
bool programSplice () const
 Rebuild the value of the documented "program_splice_flag" field.
 
void serialize (ByteBlock &data) const
 Serialize the SpliceInsert command.
 
virtual 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

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.
 

Public Attributes

bool auto_return = false
 When true, there won't be an explicit "splice in" event, use duration_pts (valid if !canceled && use_duration).
 
uint8_t avail_num = 0
 Identification for a specific avail within one program_id.
 
uint8_t avails_expected = 0
 Expected number of individual avails within the current viewing event.
 
bool canceled = true
 When true, event is canceled, other fields are ignored.
 
SpliceByComponent components_pts {}
 PTS time value of the event by component (valid if !canceled && !program_splice && !immediate).
 
uint64_t duration_pts = INVALID_PTS
 Duration of the splice out / splice in sequence (valid if !canceled && use_duration).
 
uint32_t event_id = 0
 Splice event id.
 
bool immediate = false
 When true, should splice asap, time fields are ignored.
 
uint16_t program_id = 0
 Unique program id.
 
SpliceTime program_pts {}
 PTS time value of the event for the program (valid if !canceled && !immediate && components_pts.empty()).
 
bool splice_out = false
 When true, this is a "splice out" event, "splice in" otherwise.
 
bool use_duration = false
 When true, the duration of the splice out / splice in sequence is given.
 

Static Public Attributes

static constexpr uint32_t INVALID_EVENT_ID = 0xFFFFFFFF
 An invalid value for event id, can be used as place-holder.
 
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.
 

Detailed Description

Representation of an SCTE 35 SpliceInsert command.

See also
ANSI/SCTE 35, 9.3.3.

Member Typedef Documentation

◆ SpliceByComponent

using ts::SpliceInsert::SpliceByComponent = std::map<uint8_t, SpliceTime>

A map of 64-bit PTS time values, indexed by 8-bit component tags.

Used when the program is splice component by component, not as a whole.

Member Function Documentation

◆ adjustPTS()

void ts::SpliceInsert::adjustPTS ( uint64_t  adjustment)

Adjust PTS time values using the "PTS adjustment" field from a splice information section.

Parameters
adjustmentPTS adjustment value.

◆ highestPTS()

uint64_t ts::SpliceInsert::highestPTS ( ) const

Get the highest PTS value in the command.

Returns
The highest PTS value in the command or INVALID_PTS if none found.

◆ lowestPTS()

uint64_t ts::SpliceInsert::lowestPTS ( ) const

Get the lowest PTS value in the command.

Returns
The lowest PTS value in the command or INVALID_PTS if none found.

◆ programSplice()

bool ts::SpliceInsert::programSplice ( ) const
inline

Rebuild the value of the documented "program_splice_flag" field.

Returns
The "program_splice_flag" value.

◆ display()

void ts::SpliceInsert::display ( TablesDisplay display,
const UString margin 
) const

Display the splice insert command.

Parameters
[in,out]displayDisplay engine.
[in]marginLeft margin content.

◆ deserialize()

int ts::SpliceInsert::deserialize ( const uint8_t *  data,
size_t  size 
)

Deserialize a SpliceInsert command from binary data.

Parameters
[in]dataAddress of data to deserialize.
[in]sizeSize of data buffer, possibly larger than the SpliceInsert command.
Returns
Deserialized size, -1 on incorrect data.

◆ serialize()

void ts::SpliceInsert::serialize ( ByteBlock data) const

Serialize the SpliceInsert command.

Parameters
[in,out]dataThe SpliceInsert command is serialized at the end of this byte block.

◆ clearContent()

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

◆ buildXML()

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

◆ 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::AbstractTable, and 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()

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, this method creates a root node with the default XML name and then invokes buildXML() in the subclass to populate the XML node.

Important: Implementers of signalization classes shall not override this class. Implement the protected method buildXML() instead.

Parameters
[in,out]duckTSDuck execution context.
[in,out]parentThe parent node for the new XML tree.
Returns
The new XML element.

Reimplemented in ts::AbstractTable.

◆ fromXML()

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

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.

Important: Implementers of signalization classes shall not override this class. Implement the protected method analyzeXML() instead.

Parameters
[in,out]duckTSDuck execution context.
[in]elementXML element to convert.

Reimplemented in ts::AbstractTable.

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