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

Packetization of PES data into Transport Stream packets. More...

#include <tsPESPacketizer.h>

Inheritance diagram for ts::PESPacketizer:
Collaboration diagram for ts::PESPacketizer:

Public Member Functions

 PESPacketizer (const DuckContext &duck, PID pid=PID_NULL, PESProviderInterface *provider=nullptr)
 Constructor.
 
virtual ~PESPacketizer () override
 Destructor.
 
bool atPESBoundary () const
 Check if the TS packet stream is exactly at a PES packet boundary.
 
virtual std::ostream & display (std::ostream &strm) const override
 Display the internal state of the packetizer, mainly for debug.
 
const DuckContextduck () const
 Get a reference to the TSDuck execution context.
 
virtual bool getNextPacket (TSPacket &packet) override
 Build the next MPEG packet for the list of items (sections or PES) to pacjetize.
 
PID getPID () const
 Get the default PID for subsequent MPEG packets.
 
uint8_t nextContinuityCounter () const
 Get the continuity counter value for next MPEG packet.
 
PacketCounter packetCount () const
 Get the number of generated TS packets so far.
 
PacketCounter pesCount () const
 Get the number of completely packetized PES packets so far.
 
PESProviderInterfacepesProvider () const
 Get the object which provides PES packets when the packetizer needs more data.
 
Reportreport () const
 Get a reference to the debugging report.
 
virtual void reset () override
 Reset the packetizer.
 
void setNextContinuityCounter (uint8_t cc)
 Set the continuity counter value for next MPEG packet.
 
void setPESProvider (PESProviderInterface *provider)
 Set the object which provides PES packets when the packetizer needs more data.
 
void setPID (PID pid)
 Set the default PID for subsequent MPEG packets.
 

Protected Member Functions

void configurePacket (TSPacket &pkt, bool nullify)
 Configure a TS packet with continuity and PID.
 

Detailed Description

Packetization of PES data into Transport Stream packets.

PES packets are provided by an object implementing PESProviderInterface. This means that this class works in "pull" mode; it pulls new PES packets from the application when needed. If you need a PES packetizer working in "push" mode, check class PESStreamPacketizer.

Constructor & Destructor Documentation

◆ PESPacketizer()

ts::PESPacketizer::PESPacketizer ( const DuckContext duck,
PID  pid = PID_NULL,
PESProviderInterface provider = nullptr 
)

Constructor.

Parameters
[in]duckTSDuck execution context. The reference is kept inside the packetizer.
[in]pidPID for generated TS packets.
[in]providerAn object which will be called each time a PES packet is required.

Member Function Documentation

◆ setPESProvider()

void ts::PESPacketizer::setPESProvider ( PESProviderInterface provider)
inline

Set the object which provides PES packets when the packetizer needs more data.

Parameters
[in]providerAn object which will be called each time a PES packet is required.

◆ pesProvider()

PESProviderInterface * ts::PESPacketizer::pesProvider ( ) const
inline

Get the object which provides PES packets when the packetizer needs more data.

Returns
The object which will be called each time a PES packet is required.

◆ atPESBoundary()

bool ts::PESPacketizer::atPESBoundary ( ) const
inline

Check if the TS packet stream is exactly at a PES packet boundary.

Returns
True if the last returned TS packet contained the end of a PES packet.

◆ pesCount()

PacketCounter ts::PESPacketizer::pesCount ( ) const
inline

Get the number of completely packetized PES packets so far.

Returns
The number of completely packetized PES packets so far.

◆ reset()

virtual void ts::PESPacketizer::reset ( )
overridevirtual

Reset the packetizer.

All unfinished items (sections or PES packets) are dropped.

Reimplemented from ts::AbstractPacketizer.

Reimplemented in ts::PESStreamPacketizer.

◆ getNextPacket()

virtual bool ts::PESPacketizer::getNextPacket ( TSPacket packet)
overridevirtual

Build the next MPEG packet for the list of items (sections or PES) to pacjetize.

If there is nothing to packetize, generate a null packet on PID_NULL.

Parameters
[out]packetThe next TS packet.
Returns
True if a real packet is returned, false if a null packet was returned.

Implements ts::AbstractPacketizer.

◆ display()

virtual std::ostream & ts::PESPacketizer::display ( std::ostream &  strm) const
overridevirtual

Display the internal state of the packetizer, mainly for debug.

Parameters
[in,out]strmOutput text stream.
Returns
A reference to strm.

Reimplemented from ts::AbstractPacketizer.

Reimplemented in ts::PESStreamPacketizer.

◆ setPID()

void ts::AbstractPacketizer::setPID ( PID  pid)
inlineinherited

Set the default PID for subsequent MPEG packets.

Parameters
[in]pidPID for generated TS packets.

◆ getPID()

PID ts::AbstractPacketizer::getPID ( ) const
inlineinherited

Get the default PID for subsequent MPEG packets.

Returns
PID for generated TS packets.

◆ setNextContinuityCounter()

void ts::AbstractPacketizer::setNextContinuityCounter ( uint8_t  cc)
inlineinherited

Set the continuity counter value for next MPEG packet.

This counter is automatically incremented at each packet. It is usually never a good idea to change this, except maybe before generating the first packet if the continuity must be preserved with the previous content of the PID.

Parameters
[in]ccNext continuity counter.

◆ nextContinuityCounter()

uint8_t ts::AbstractPacketizer::nextContinuityCounter ( ) const
inlineinherited

Get the continuity counter value for next MPEG packet.

Returns
Next continuity counter.

◆ packetCount()

PacketCounter ts::AbstractPacketizer::packetCount ( ) const
inlineinherited

Get the number of generated TS packets so far.

Returns
The number of generated TS packets so far.

◆ report()

Report & ts::AbstractPacketizer::report ( ) const
inlineinherited

Get a reference to the debugging report.

Returns
A reference to the debugging report.

◆ duck()

const DuckContext & ts::AbstractPacketizer::duck ( ) const
inlineinherited

Get a reference to the TSDuck execution context.

Returns
A reference to the TSDuck execution context.

◆ configurePacket()

void ts::AbstractPacketizer::configurePacket ( TSPacket pkt,
bool  nullify 
)
protectedinherited

Configure a TS packet with continuity and PID.

Also increment the number of generated packet. So this method must be called exactly once per packet.

Parameters
[in,out]pktTS packet to configure
[in]nullifyReturn a null packet instead (no data to return for now).

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