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

Packetization of PES data into Transport Stream packets in one shot. More...

#include <tsPESOneShotPacketizer.h>

Inheritance diagram for ts::PESOneShotPacketizer:
Collaboration diagram for ts::PESOneShotPacketizer:

Public Member Functions

 PESOneShotPacketizer (const DuckContext &duck, PID pid=PID_NULL)
 Constructor.
 
virtual ~PESOneShotPacketizer () override
 Destructor.
 
bool addPES (const PESPacket &pes, ShareMode mode)
 Add a PES packet to packetize.
 
bool addPES (const PESPacketPtr &pes)
 Add a PES packet to packetize.
 
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.
 
bool empty () const
 Check if the packetizer is empty (no more TS packet to produce).
 
void getPackets (TSPacketVector &packets)
 Get all enqueued PES packets as one list of TS packets.
 
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 setMaxQueuedPackets (size_t count)
 Set a limit to the number of internally queued PES packets.
 
void setNextContinuityCounter (uint8_t cc)
 Set the continuity counter value for next MPEG packet.
 
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 in one shot.

Constructor & Destructor Documentation

◆ PESOneShotPacketizer()

ts::PESOneShotPacketizer::PESOneShotPacketizer ( const DuckContext duck,
PID  pid = PID_NULL 
)

Constructor.

Parameters
[in]duckTSDuck execution context. The reference is kept inside the packetizer.
[in]pidPID for generated TS packets.

Member Function Documentation

◆ getPackets()

void ts::PESOneShotPacketizer::getPackets ( TSPacketVector packets)

Get all enqueued PES packets as one list of TS packets.

Parameters
[out]packetsReturned list of TS packets containing all TS packets.

◆ setMaxQueuedPackets()

void ts::PESStreamPacketizer::setMaxQueuedPackets ( size_t  count)
inlineinherited

Set a limit to the number of internally queued PES packets.

This is a way to limit the internal memory which is used by this instance.

Parameters
[in]countMaximum number of internally queued PES packets. If the number of already queued packets is already higher, none is dropped. If count is zero, there is no limit (this is the initial default).

◆ addPES() [1/2]

bool ts::PESStreamPacketizer::addPES ( const PESPacketPtr pes)
inherited

Add a PES packet to packetize.

Parameters
[in]pesA safe pointer to the PES packet.
Returns
True on success, false if the enqueue limit is reached.

◆ addPES() [2/2]

bool ts::PESStreamPacketizer::addPES ( const PESPacket pes,
ShareMode  mode 
)
inherited

Add a PES packet to packetize.

Parameters
[in]pesThe PES packet.
[in]modeThe enqueue PES packet's data are either shared (ShareMode::SHARE) between the provided pes or duplicated (ShareMode::COPY).
Returns
True on success, false if the enqueue limit is reached.

◆ empty()

bool ts::PESStreamPacketizer::empty ( ) const
inlineinherited

Check if the packetizer is empty (no more TS packet to produce).

Returns
True if the packetizer is empty, false otherwise.

◆ reset()

virtual void ts::PESStreamPacketizer::reset ( )
overridevirtualinherited

Reset the packetizer.

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

Reimplemented from ts::PESPacketizer.

◆ display()

virtual std::ostream & ts::PESStreamPacketizer::display ( std::ostream &  strm) const
overridevirtualinherited

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

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

Reimplemented from ts::PESPacketizer.

◆ pesProvider()

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

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
inlineinherited

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
inlineinherited

Get the number of completely packetized PES packets so far.

Returns
The number of completely packetized PES packets so far.

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