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

General-purpose signalization demux. More...

#include <tsSignalizationDemux.h>

Inheritance diagram for ts::SignalizationDemux:
Collaboration diagram for ts::SignalizationDemux:

Public Member Functions

 SignalizationDemux (DuckContext &duck)
 Constructor for full services and PID's analysis.
 
 SignalizationDemux (DuckContext &duck, SignalizationHandlerInterface *handler, std::initializer_list< TID > tids=std::initializer_list< TID >())
 Constructor with handler and selected signalization.
 
void addFilteredService (const UString &name)
 Add a service to filter, by name or by id.
 
void addFilteredServiceId (uint16_t sid)
 Add a service id to filter.
 
bool addFilteredTableId (TID tid)
 Add a signalization table id to filter.
 
void addFilteredTableIds (std::initializer_list< TID > tids)
 Add signalization table ids to filter.
 
void addFullFilters ()
 Add table filtering for full services and PID's analysis.
 
bool atIntraFrame (PID pid) const
 Check if the past packet of a PID contained the start of a video intra-frame.
 
CodecType codecType (PID pid, CodecType deftype=CodecType::UNDEFINED) const
 Get the codec which is used in PID in the TS.
 
void feedPacket (const TSPacket &pkt)
 This method feeds the demux with a TS packet.
 
void getPIDs (PIDSet &pids) const
 Get the set of PID's in the TS.
 
void getServiceIds (PID pid, std::set< uint16_t > services) const
 Get the services of a PID.
 
void getServiceIds (std::set< uint16_t > &services) const
 Get the list of all service ids in the TS.
 
void getServices (ServiceList &services) const
 Get the list of all services in the TS.
 
bool hasNIT () const
 Check if a NIT Actual has been received.
 
bool hasPAT () const
 Check if a PAT has been received.
 
bool inAnyService (PID pid, std::set< uint16_t > service_ids) const
 Check if a PID is a component of any service in a set of services.
 
bool inService (PID pid, uint16_t service_id) const
 Check if a PID is a component of a service.
 
PacketCounter intraFrameCount (PID pid) const
 Get the number of video intra-frames in a PID.
 
PacketCounter intraFrameFirstIndex (PID pid) const
 Get the number of TS packets in a PID before its first video intra-frame.
 
PacketCounter intraFrameLastIndex (PID pid) const
 Get the number of TS packets in a PID before its last video intra-frame.
 
bool isFilteredServiceId (uint16_t sid) const
 Check if a service id is filtered.
 
bool isFilteredServiceName (const UString &name) const
 Check if a service name is filtered.
 
bool isFilteredTableId (TID tid) const
 Check if a signalization table id is filtered.
 
bool isScrambled (PID pid) const
 Check if a PID contains scrambled packets.
 
const NITlastNIT () const
 Return a constant reference to the last NIT Actual which has been received.
 
const PATlastPAT () const
 Return a constant reference to the last PAT which has been received.
 
Time lastUTC () const
 Get the last UTC time from a TOT/TDT (DVB, ISDB) or STT (ATSC).
 
uint16_t networkId () const
 Get the actual network id (from the NIT).
 
PID nitPID () const
 Get the NIT PID, either from last PAT or default PID.
 
uint16_t originalNetworkId () const
 Get the original network id (from the SDT).
 
PacketCounter packetCount (PID pid) const
 Get the number of TS packets in a PID.
 
PIDClass pidClass (PID pid, PIDClass defclass=PIDClass::UNDEFINED) const
 Get the class of a PID in the TS.
 
PacketCounter pusiCount (PID pid) const
 Get the number of TS packets with payload unit start indicator (PUSI) in a PID.
 
PacketCounter pusiFirstIndex (PID pid) const
 Get the number of TS packets in a PID before its first payload unit start indicator (PUSI).
 
PacketCounter pusiLastIndex (PID pid) const
 Get the number of TS packets in a PID before its last payload unit start indicator (PUSI).
 
void removeAllFilteredServices ()
 Remove all services to filter.
 
void removeFilteredService (const UString &name)
 Remove a service to filter, by name or by id.
 
void removeFilteredServiceId (uint16_t sid)
 Remove a service id to filter.
 
bool removeFilteredTableId (TID tid)
 Remove a signalization table id to filter.
 
void removeFilteredTableIds (std::initializer_list< TID > tids)
 Remove signalization table ids to filter.
 
void reset ()
 Reset the demux, remove all signalization filters.
 
uint16_t serviceId (PID pid) const
 Get the service of a PID.
 
void setHandler (SignalizationHandlerInterface *handler)
 Replace the signalization handler.
 
uint8_t streamType (PID pid, uint8_t deftype=ST_NULL) const
 Get the stream type (from PMT) of a PID in the TS.
 
uint16_t transportStreamId () const
 Get the transport stream id.
 

Detailed Description

General-purpose signalization demux.

Constructor & Destructor Documentation

◆ SignalizationDemux() [1/2]

ts::SignalizationDemux::SignalizationDemux ( DuckContext duck)
explicit

Constructor for full services and PID's analysis.

All signalization is demuxed. A full map of services and PID's is internally built. This is the typical constructor to use the application only needs to query the structure of services and PID's. It is still possible to add a handler for signalization tables later.

When the demux is reset, the full filtered are restored.

Parameters
[in,out]duckTSDuck execution context. The reference is kept inside the demux. Contextual information (such as standards) are accumulated in the context from demuxed sections.

◆ SignalizationDemux() [2/2]

ts::SignalizationDemux::SignalizationDemux ( DuckContext duck,
SignalizationHandlerInterface handler,
std::initializer_list< TID tids = std::initializer_list< TID >() 
)
explicit

Constructor with handler and selected signalization.

This is the typical constructor to use when the application wants to be notified of some signalization tables only. The internal map of services and PID's may be incomplete, depending on the selected signalization.

Parameters
[in,out]duckTSDuck execution context. The reference is kept inside the demux. Contextual information (such as standards) are accumulated in the context from demuxed sections.
[in]handlerThe object to invoke when a new complete signalization table is extracted.
[in]tidsThe set of TID's to demux. Unsupported table ids are ignored. If TID_PMT is specified, all PMT's are filtered. To filter PMT's for selected services, use addServiceId().

Member Function Documentation

◆ feedPacket()

void ts::SignalizationDemux::feedPacket ( const TSPacket pkt)

This method feeds the demux with a TS packet.

Parameters
[in]pktA TS packet.

◆ setHandler()

void ts::SignalizationDemux::setHandler ( SignalizationHandlerInterface handler)
inline

Replace the signalization handler.

Parameters
[in]handlerThe new handler.

◆ reset()

void ts::SignalizationDemux::reset ( )

Reset the demux, remove all signalization filters.

If this object was built using the first constructor (one parameter), full filtering is reset to its default state.

◆ addFullFilters()

void ts::SignalizationDemux::addFullFilters ( )

Add table filtering for full services and PID's analysis.

All signalization is demuxed. A full map of services and PID's is internally built.

◆ addFilteredTableId()

bool ts::SignalizationDemux::addFilteredTableId ( TID  tid)

Add a signalization table id to filter.

Parameters
[in]tidThe table id to add. Unsupported table ids are ignored. If TID_PMT is specified, all PMT's are filtered. To filter PMT's for selected services, use addServiceId().
Returns
True if the table id is filtered, false if this table id is not supported.

◆ addFilteredTableIds()

void ts::SignalizationDemux::addFilteredTableIds ( std::initializer_list< TID tids)

Add signalization table ids to filter.

Parameters
[in]tidsThe table ids to add.

◆ removeFilteredTableId()

bool ts::SignalizationDemux::removeFilteredTableId ( TID  tid)

Remove a signalization table id to filter.

Parameters
[in]tidThe table id to remove. Unsupported table ids are ignored.
Returns
True if the table id was actually removed, false if this table id was not filtered or not supported.

◆ removeFilteredTableIds()

void ts::SignalizationDemux::removeFilteredTableIds ( std::initializer_list< TID tids)

Remove signalization table ids to filter.

Parameters
[in]tidsThe table ids to remove.

◆ isFilteredTableId()

bool ts::SignalizationDemux::isFilteredTableId ( TID  tid) const
inline

Check if a signalization table id is filtered.

Parameters
[in]tidThe table id to check.
Returns
True if tid is filtered, false otherwise.

◆ addFilteredServiceId()

void ts::SignalizationDemux::addFilteredServiceId ( uint16_t  sid)

Add a service id to filter.

Parameters
[in]sidThe service id to add.

◆ removeFilteredServiceId()

void ts::SignalizationDemux::removeFilteredServiceId ( uint16_t  sid)

Remove a service id to filter.

Parameters
[in]sidThe service id to remove.

◆ isFilteredServiceId()

bool ts::SignalizationDemux::isFilteredServiceId ( uint16_t  sid) const
inline

Check if a service id is filtered.

Parameters
[in]sidThe service id to check.
Returns
True if sid is filtered, false otherwise.

◆ addFilteredService()

void ts::SignalizationDemux::addFilteredService ( const UString name)

Add a service to filter, by name or by id.

Parameters
[in]nameThe service name or id to add.

◆ removeFilteredService()

void ts::SignalizationDemux::removeFilteredService ( const UString name)

Remove a service to filter, by name or by id.

Parameters
[in]nameThe service name or id to remove.

◆ isFilteredServiceName()

bool ts::SignalizationDemux::isFilteredServiceName ( const UString name) const

Check if a service name is filtered.

Parameters
[in]nameThe service name or id to check.
Returns
True if name is filtered, false otherwise.

◆ hasPAT()

bool ts::SignalizationDemux::hasPAT ( ) const
inline

Check if a PAT has been received.

Returns
True if a PAT has been received, false otherwise.

◆ lastPAT()

const PAT & ts::SignalizationDemux::lastPAT ( ) const
inline

Return a constant reference to the last PAT which has been received.

Returns
A constant reference to the last PAT.

◆ hasNIT()

bool ts::SignalizationDemux::hasNIT ( ) const
inline

Check if a NIT Actual has been received.

Returns
True if a NIT Actual has been received, false otherwise.

◆ lastNIT()

const NIT & ts::SignalizationDemux::lastNIT ( ) const
inline

Return a constant reference to the last NIT Actual which has been received.

Returns
A constant reference to the last NIT Actual.

◆ transportStreamId()

uint16_t ts::SignalizationDemux::transportStreamId ( ) const
inline

Get the transport stream id.

Returns
The transport stream id or 0xFFFF if unknown.

◆ originalNetworkId()

uint16_t ts::SignalizationDemux::originalNetworkId ( ) const
inline

Get the original network id (from the SDT).

Returns
The original network id or 0xFFFF if unknown.

◆ networkId()

uint16_t ts::SignalizationDemux::networkId ( ) const
inline

Get the actual network id (from the NIT).

Returns
The original network id or 0xFFFF if unknown.

◆ nitPID()

PID ts::SignalizationDemux::nitPID ( ) const

Get the NIT PID, either from last PAT or default PID.

Returns
The NIT PID.

◆ lastUTC()

Time ts::SignalizationDemux::lastUTC ( ) const
inline

Get the last UTC time from a TOT/TDT (DVB, ISDB) or STT (ATSC).

Returns
The last received UTC time or Time::Epoch if there was none.

◆ getServiceIds() [1/2]

void ts::SignalizationDemux::getServiceIds ( std::set< uint16_t > &  services) const

Get the list of all service ids in the TS.

Parameters
[out]servicesThe set of all services ids in the TS, as found so far.

◆ getServices()

void ts::SignalizationDemux::getServices ( ServiceList services) const

Get the list of all services in the TS.

Parameters
[out]servicesThe list of all services in the TS, as found so far.

◆ getPIDs()

void ts::SignalizationDemux::getPIDs ( PIDSet pids) const

Get the set of PID's in the TS.

Parameters
[out]pidsThe set of PID's in the TS.

◆ pidClass()

PIDClass ts::SignalizationDemux::pidClass ( PID  pid,
PIDClass  defclass = PIDClass::UNDEFINED 
) const

Get the class of a PID in the TS.

Parameters
[in]pidThe PID to check.
[in]defclassThe default PID class to use if the actual one is unknown.
Returns
The PID class.

◆ codecType()

CodecType ts::SignalizationDemux::codecType ( PID  pid,
CodecType  deftype = CodecType::UNDEFINED 
) const

Get the codec which is used in PID in the TS.

Parameters
[in]pidThe PID to check.
[in]deftypeThe default codec type to use if the actual type is unknown.
Returns
The codec type.

◆ streamType()

uint8_t ts::SignalizationDemux::streamType ( PID  pid,
uint8_t  deftype = ST_NULL 
) const

Get the stream type (from PMT) of a PID in the TS.

Parameters
[in]pidThe PID to check.
[in]deftypeThe default stream type to use if the actual type is unknown.
Returns
The stream type (from PMT).

◆ isScrambled()

bool ts::SignalizationDemux::isScrambled ( PID  pid) const

Check if a PID contains scrambled packets.

Parameters
[in]pidThe PID to check.
Returns
True if at least one scrambled packets has been found in the PID.

◆ packetCount()

PacketCounter ts::SignalizationDemux::packetCount ( PID  pid) const

Get the number of TS packets in a PID.

Parameters
[in]pidThe PID to check.
Returns
The number of packets in that PID.

◆ pusiCount()

PacketCounter ts::SignalizationDemux::pusiCount ( PID  pid) const

Get the number of TS packets with payload unit start indicator (PUSI) in a PID.

Parameters
[in]pidThe PID to check.
Returns
The number of PUSI in that PID.

◆ pusiFirstIndex()

PacketCounter ts::SignalizationDemux::pusiFirstIndex ( PID  pid) const

Get the number of TS packets in a PID before its first payload unit start indicator (PUSI).

Parameters
[in]pidThe PID to check.
Returns
The number of TS packets in the PID before its first payload unit start indicator (PUSI) or INVALID_PACKET_COUNTER if there is no PUSI in the PID.

◆ pusiLastIndex()

PacketCounter ts::SignalizationDemux::pusiLastIndex ( PID  pid) const

Get the number of TS packets in a PID before its last payload unit start indicator (PUSI).

Parameters
[in]pidThe PID to check.
Returns
The number of TS packets in the PID before its last payload unit start indicator (PUSI) or INVALID_PACKET_COUNTER if there is no PUSI in the PID.

◆ intraFrameCount()

PacketCounter ts::SignalizationDemux::intraFrameCount ( PID  pid) const

Get the number of video intra-frames in a PID.

Parameters
[in]pidThe PID to check.
Returns
The number of video intra-frames in that PID.

◆ intraFrameFirstIndex()

PacketCounter ts::SignalizationDemux::intraFrameFirstIndex ( PID  pid) const

Get the number of TS packets in a PID before its first video intra-frame.

Parameters
[in]pidThe PID to check.
Returns
The number of TS packets in the PID before its first video intra-frame or INVALID_PACKET_COUNTER if there is no video intra-frame in the PID.

◆ intraFrameLastIndex()

PacketCounter ts::SignalizationDemux::intraFrameLastIndex ( PID  pid) const

Get the number of TS packets in a PID before its last video intra-frame.

Parameters
[in]pidThe PID to check.
Returns
The number of TS packets in the PID before its last video intra-frame or INVALID_PACKET_COUNTER if there is no video intra-frame in the PID.

◆ atIntraFrame()

bool ts::SignalizationDemux::atIntraFrame ( PID  pid) const

Check if the past packet of a PID contained the start of a video intra-frame.

Parameters
[in]pidThe PID to check.
Returns
True if the past packet of a PID contained the start of a video intra-frame.

◆ inService()

bool ts::SignalizationDemux::inService ( PID  pid,
uint16_t  service_id 
) const

Check if a PID is a component of a service.

Parameters
[in]pidThe PID to check.
[in]service_idService id.
Returns
True is pid is part of service_id.

◆ inAnyService()

bool ts::SignalizationDemux::inAnyService ( PID  pid,
std::set< uint16_t >  service_ids 
) const

Check if a PID is a component of any service in a set of services.

Parameters
[in]pidThe PID to check.
[in]service_idsA set of service ids.
Returns
True is pid is part of any service in service_ids.

◆ serviceId()

uint16_t ts::SignalizationDemux::serviceId ( PID  pid) const

Get the service of a PID.

Parameters
[in]pidThe PID to check.
Returns
The first service in which pid was found or 0xFFFF if there was none.

◆ getServiceIds() [2/2]

void ts::SignalizationDemux::getServiceIds ( PID  pid,
std::set< uint16_t >  services 
) const

Get the services of a PID.

Parameters
[in]pidThe PID to check.
[out]servicesThe set of services in which pid was found.

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