TSDuck Version 3.16-1064 (TSDuck - The MPEG Transport Stream Toolkit)
ts::Packetizer Class Reference

Packetization of MPEG sections into Transport Stream packets. More...

Inheritance diagram for ts::Packetizer:

Public Member Functions

 Packetizer (PID pid=PID_NULL, SectionProviderInterface *provider=nullptr)
 Default constructor. More...
 
virtual ~Packetizer ()
 Destructor.
 
bool atSectionBoundary () const
 Check if the packet stream is exactly at a section boundary. More...
 
virtual std::ostream & display (std::ostream &strm) const
 Display the internal state of the packetizer, mainly for debug. More...
 
bool getNextPacket (TSPacket &packet)
 Build the next MPEG packet for the list of sections. More...
 
PID getPID () const
 Get the default PID for subsequent MPEG packets. More...
 
uint8_t nextContinuityCounter () const
 Get the continuity counter value for next MPEG packet. More...
 
PacketCounter packetCount () const
 Get the number of generated packets so far. More...
 
virtual void reset ()
 Reset the content of a packetizer. More...
 
SectionCounter sectionCount () const
 Get the number of completely packetized sections so far. More...
 
SectionProviderInterfacesectionProvider () const
 Get the object which provides MPEG sections when the packetizer needs a new section. More...
 
void setNextContinuityCounter (uint8_t cc)
 Set the continuity counter value for next MPEG packet. More...
 
void setPID (PID pid)
 Set the default PID for subsequent MPEG packets. More...
 
void setSectionProvider (SectionProviderInterface *provider)
 Set the object which provides MPEG sections when the packetizer needs a new section. More...
 

Detailed Description

Packetization of MPEG sections into Transport Stream packets.

Sections are provided by an object implementing SectionProviderInterface.

Constructor & Destructor Documentation

◆ Packetizer()

ts::Packetizer::Packetizer ( PID  pid = PID_NULL,
SectionProviderInterface provider = nullptr 
)

Default constructor.

Parameters
[in]pidPID for generated TS packets.
[in]providerAn object which will be called each time a section is required.

Member Function Documentation

◆ setPID()

void ts::Packetizer::setPID ( PID  pid)
inline

Set the default PID for subsequent MPEG packets.

Parameters
[in]pidPID for generated TS packets.

◆ getPID()

PID ts::Packetizer::getPID ( ) const
inline

Get the default PID for subsequent MPEG packets.

Returns
PID for generated TS packets.

◆ setSectionProvider()

void ts::Packetizer::setSectionProvider ( SectionProviderInterface provider)
inline

Set the object which provides MPEG sections when the packetizer needs a new section.

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

◆ sectionProvider()

SectionProviderInterface* ts::Packetizer::sectionProvider ( ) const
inline

Get the object which provides MPEG sections when the packetizer needs a new section.

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

◆ setNextContinuityCounter()

void ts::Packetizer::setNextContinuityCounter ( uint8_t  cc)
inline

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::Packetizer::nextContinuityCounter ( ) const
inline

Get the continuity counter value for next MPEG packet.

Returns
Next continuity counter.

◆ atSectionBoundary()

bool ts::Packetizer::atSectionBoundary ( ) const
inline

Check if the packet stream is exactly at a section boundary.

Returns
True if the last returned packet contained the end of a section and no unfinished section.

◆ getNextPacket()

bool ts::Packetizer::getNextPacket ( TSPacket packet)

Build the next MPEG packet for the list of sections.

If there is no section 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.

◆ packetCount()

PacketCounter ts::Packetizer::packetCount ( ) const
inline

Get the number of generated packets so far.

Returns
The number of generated packets so far.

◆ sectionCount()

SectionCounter ts::Packetizer::sectionCount ( ) const
inline

Get the number of completely packetized sections so far.

Returns
The number of completely packetized sections so far.

◆ reset()

virtual void ts::Packetizer::reset ( )
virtual

Reset the content of a packetizer.

The packetizer becomes empty. If the last returned packet contained an unfinished section, this section will be lost.

Reimplemented in ts::CyclingPacketizer.

◆ display()

virtual std::ostream& ts::Packetizer::display ( std::ostream &  strm) const
virtual

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

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

Reimplemented in ts::CyclingPacketizer.


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