TSDuck v3.43-4480
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

Compute a clock, based real time, TS time, PCR or input timestamps. More...

#include <tsTSClock.h>

Inheritance diagram for ts::TSClock:
Collaboration diagram for ts::TSClock:

Public Member Functions

 TSClock (DuckContext &duck, int severity=Severity::Verbose)
 Constructor.
 
Time clock () const
 Get the current clock, in UTC or local time, depending on TSClockArgs.
 
Time clockUTC () const
 Get the current clock in UTC time.
 
cn::milliseconds durationMS () const
 Get the estimated playout duration since first packets in milliseconds.
 
PCR durationPCR () const
 Get the estimated playout duration since first packets in PCR units.
 
void feedPacket (const TSPacket &pkt, const TSPacketMetadata &mdata)
 The following method feeds the analyzer with a TS packet.
 
Time initialClock () const
 Get the clock of the first packet, in UTC or local time, depending on TSClockArgs.
 
Time initialClockUTC () const
 Get the clock in UTC time of the first packet.
 
bool isValid () const
 Check if the clock is valid.
 
void reset (const TSClockArgs &args)
 Reset all collected information.
 

Detailed Description

Compute a clock, based real time, TS time, PCR or input timestamps.

Depending on parameters, the clock can be:

  • Real time (system clock)
  • Time from the first TDT, TOT ot ATSC STT.
  • Explicit start time from parameters. The progression of the clock is based on TS packets in the last two cases. By default, the clock is based on real UTC time and TS packets are unused.

Constructor & Destructor Documentation

◆ TSClock()

ts::TSClock::TSClock ( DuckContext duck,
int  severity = Severity::Verbose 
)

Constructor.

Parameters
[in,out]duckTSDuck execution context. A reference is kept inside this object.
[in]severitySeverity of the messages when switching sources.

Member Function Documentation

◆ reset()

void ts::TSClock::reset ( const TSClockArgs args)

Reset all collected information.

Parameters
[in]argsClock parameters.

◆ feedPacket()

void ts::TSClock::feedPacket ( const TSPacket pkt,
const TSPacketMetadata mdata 
)

The following method feeds the analyzer with a TS packet.

Parameters
[in]pktA new transport stream packet.
[in]mdataAssociated metadata, including the input timestamp.

◆ isValid()

bool ts::TSClock::isValid ( ) const
inline

Check if the clock is valid.

The clock is invalid when based on the TS clock, before the first TDT, TOT or STT.

Returns
True if the clock is valid, false otherwise.

◆ initialClockUTC()

Time ts::TSClock::initialClockUTC ( ) const
inline

Get the clock in UTC time of the first packet.

Returns
The clock of the first packet in UTC time or Time::Epoch if the clock is not yet valid.

◆ initialClock()

Time ts::TSClock::initialClock ( ) const

Get the clock of the first packet, in UTC or local time, depending on TSClockArgs.

Returns
The clock of the first packet or Time::Epoch if the clock is not yet valid.

◆ clockUTC()

Time ts::TSClock::clockUTC ( ) const

Get the current clock in UTC time.

Returns
The computed clock in UTC or Time::Epoch if the clock is not yet valid.

◆ clock()

Time ts::TSClock::clock ( ) const

Get the current clock, in UTC or local time, depending on TSClockArgs.

Returns
The computed clock or Time::Epoch if the clock is not yet valid.

◆ durationMS()

cn::milliseconds ts::TSClock::durationMS ( ) const

Get the estimated playout duration since first packets in milliseconds.

The returned duration depends on the TSClockArgs. If real time is used, this is the number of actual milliseconds since the first packet. Otherwise, this is the same as durationPCR(), converted in milliseconds.

Returns
The estimated playout duration in milliseconds.

◆ durationPCR()

PCR ts::TSClock::durationPCR ( ) const
inline

Get the estimated playout duration since first packets in PCR units.

The returned duration is always based on the timestamps from the stream, never on real time.

Returns
The estimated playout duration in PCR units.

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