![]() |
TSDuck v3.43-4480
MPEG Transport Stream Toolkit
|
Packetization of MPEG sections into Transport Stream packets in one shot. More...
#include <tsOneShotPacketizer.h>


Public Types | |
| enum class | StuffingPolicy { NEVER , AT_END , ALWAYS } |
| Specify where stuffing applies. More... | |
Public Member Functions | |
| OneShotPacketizer (const DuckContext &duck, PID pid=PID_NULL, bool do_stuffing=false, const BitRate &bitrate=0) | |
| Default constructor. | |
| virtual | ~OneShotPacketizer () override |
| Virtual destructor. | |
| void | addSection (const SectionPtr §ion, cn::milliseconds repetition_rate=cn::milliseconds::zero()) |
| Add one section into the packetizer. | |
| void | addSections (const SectionPtrVector §ions, cn::milliseconds repetition_rate=cn::milliseconds::zero()) |
| Add some sections into the packetizer. | |
| void | addTable (const BinaryTable &table, cn::milliseconds repetition_rate=cn::milliseconds::zero()) |
| Add all sections of a binary table into the packetizer. | |
| void | addTable (DuckContext &duck, const AbstractTable &table, cn::milliseconds repetition_rate=cn::milliseconds::zero()) |
| Add all sections of a typed table into the packetizer. | |
| void | allowHeaderSplit (bool allow) |
| Allow or disallow splitting section headers across TS packets. | |
| bool | atCycleBoundary () const |
| Check if the last generated packet was the last packet in the cycle. | |
| bool | atSectionBoundary () const |
| Check if the packet stream is exactly at a section boundary. | |
| BitRate | bitRate () const |
| Get the bitrate of the generated PID. | |
| virtual std::ostream & | display (std::ostream &strm) const override |
| Display the internal state of the packetizer, mainly for debug. | |
| const DuckContext & | duck () const |
| Get a reference to the TSDuck execution context. | |
| void | getPackets (TSPacketVector &packets) |
| Get a complete cycle as one list of TS packets. | |
| PID | getPID () const |
| Get the default PID for subsequent MPEG packets. | |
| bool | headerSplitAllowed () const |
| Check if splitting section headers across TS packets is allowed. | |
| 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. | |
| void | removeAll () |
| Remove all sections in the packetizer. | |
| void | removeSections (TID tid) |
| Remove all sections with the specified table id. | |
| void | removeSections (TID tid, uint16_t tid_ext) |
| Remove all sections with the specified table id and table id extension. | |
| void | removeSections (TID tid, uint16_t tid_ext, uint8_t sec_number) |
| Remove all sections with the specified table id, table id extension and section number. | |
| Report & | report () const |
| Get a reference to the debugging report. | |
| virtual void | reset () override |
| Reset the packetizer. | |
| SectionCounter | sectionCount () const |
| Get the number of completely packetized sections so far. | |
| SectionProviderInterface * | sectionProvider () const |
| Get the object which provides MPEG sections when the packetizer needs a new section. | |
| void | setBitRate (const BitRate &bitrate) |
| Set the bitrate of the generated PID. | |
| 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. | |
| void | setStuffingPolicy (bool do_stuffing) |
| Set the stuffing policy. | |
| SectionCounter | storedSectionCount () const |
| Get the number of stored sections to packetize. | |
| StuffingPolicy | stuffingPolicy () const |
| Get the TS packet stuffing policy at end of packet. | |
Protected Member Functions | |
| void | configurePacket (TSPacket &pkt, bool nullify) |
| Configure a TS packet with continuity and PID. | |
Packetization of MPEG sections into Transport Stream packets in one shot.
|
stronginherited |
| ts::OneShotPacketizer::OneShotPacketizer | ( | const DuckContext & | duck, |
| PID | pid = PID_NULL, |
||
| bool | do_stuffing = false, |
||
| const BitRate & | bitrate = 0 |
||
| ) |
Default constructor.
| [in] | duck | TSDuck execution context. The reference is kept inside the packetizer. |
| [in] | pid | PID for generated TS packets. |
| [in] | do_stuffing | TS packet stuffing at end of section. |
| [in] | bitrate | Output bitrate, zero if undefined. Useful only when using specific repetition rates for sections |
|
inline |
Set the stuffing policy.
| [in] | do_stuffing | TS packet stuffing at end of section. |
| void ts::OneShotPacketizer::getPackets | ( | TSPacketVector & | packets | ) |
Get a complete cycle as one list of TS packets.
| [out] | packets | Returned list of TS packets containing a complete cycle. |
|
inlineinherited |
Get the TS packet stuffing policy at end of packet.
|
inherited |
Set the bitrate of the generated PID.
Useful only when using specific repetition rates for sections
| [in] | bitrate | Output bitrate, zero if undefined. |
|
inlineinherited |
Get the bitrate of the generated PID.
|
inherited |
Add one section into the packetizer.
The contents of the sections are shared.
| [in] | section | A smart pointer to the section to packetize. |
| [in] | repetition_rate | Repetition rate of the section in milliseconds. If zero, simply packetize sections one after the other. |
|
inherited |
Add some sections into the packetizer.
The contents of the sections are shared.
| [in] | sections | A vector of smart pointer to the sections to packetize. |
| [in] | repetition_rate | Repetition rate of the sections in milliseconds. If zero, simply packetize sections one after the other. |
|
inherited |
Add all sections of a binary table into the packetizer.
The contents of the sections are shared. If the table is not complete (there are missing sections), the sections which are present are individually added.
| [in] | table | A binary table to packetize. |
| [in] | repetition_rate | Repetition rate of the sections in milliseconds. If zero, simply packetize sections one after the other. |
|
inherited |
Add all sections of a typed table into the packetizer.
| [in,out] | duck | TSDuck execution context. |
| [in] | table | A table to packetize. |
| [in] | repetition_rate | Repetition rate of the sections in milliseconds. If zero, simply packetize sections one after the other. |
|
inherited |
Remove all sections with the specified table id.
If one such section is currently being packetized, the rest of the section will be packetized.
| [in] | tid | The table id of the sections to remove. |
|
inherited |
Remove all sections with the specified table id and table id extension.
If one such section is currently being packetized, the rest of the section will be packetized.
| [in] | tid | The table id of the sections to remove. |
| [in] | tid_ext | The table id extension of the sections to remove. |
|
inherited |
Remove all sections with the specified table id, table id extension and section number.
If one such section is currently being packetized, the rest of the section will be packetized.
| [in] | tid | The table id of the sections to remove. |
| [in] | tid_ext | The table id extension of the sections to remove. |
| [in] | sec_number | The section number of the sections to remove. |
|
inherited |
Remove all sections in the packetizer.
If a section is currently being packetized, the rest of the section will be packetized.
|
inlineinherited |
Get the number of stored sections to packetize.
|
inherited |
Check if the last generated packet was the last packet in the cycle.
Note that if the stuffing policy is NEVER, this is not reliable since it is unlikely that a packet actually terminates a cycle.
|
overridevirtualinherited |
Reset the packetizer.
All unfinished items (sections or PES packets) are dropped.
Reimplemented from ts::Packetizer.
|
overridevirtualinherited |
Display the internal state of the packetizer, mainly for debug.
| [in,out] | strm | Output text stream. |
Reimplemented from ts::Packetizer.
|
inlineinherited |
Get the object which provides MPEG sections when the packetizer needs a new section.
|
inlineinherited |
Check if the packet stream is exactly at a section boundary.
|
inlineinherited |
Get the number of completely packetized sections so far.
|
inlineinherited |
Allow or disallow splitting section headers across TS packets.
By default, a Packetizer never splits a section header between two TS packets. This is not required by the MPEG standard but some STB are known to have problems with that.
| [in] | allow | If true, splitting section headers across TS packets is allowed. |
|
inlineinherited |
Check if splitting section headers across TS packets is allowed.
|
inlineinherited |
Set the default PID for subsequent MPEG packets.
| [in] | pid | PID for generated TS packets. |
|
inlineinherited |
Get the default PID for subsequent MPEG packets.
|
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.
| [in] | cc | Next continuity counter. |
|
inlineinherited |
Get the continuity counter value for next MPEG packet.
|
inlineinherited |
Get the number of generated TS packets so far.
|
inlineinherited |
Get a reference to the debugging report.
|
inlineinherited |
Get a reference to the TSDuck execution context.
|
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.
| [in,out] | pkt | TS packet to configure |
| [in] | nullify | Return a null packet instead (no data to return for now). |