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

Send TS packets over datagrams (UDP, SRT, RIST, etc.) More...

#include <tsTSDatagramOutput.h>

Inheritance diagram for ts::TSDatagramOutput:
Collaboration diagram for ts::TSDatagramOutput:

Public Member Functions

 TSDatagramOutput (TSDatagramOutputOptions flags, TSDatagramOutputHandlerInterface *output=nullptr)
 Constructor.
 
bool close (const BitRate &bitrate, bool abort, Report &report)
 Close the TS packet output.
 
void defineArgs (Args &args)
 Add command line option definitions in an Args.
 
bool loadArgs (DuckContext &duck, Args &args)
 Load arguments from command line.
 
size_t maxPayloadSize () const
 Get the maximum datagram payload size, according to options –packet-burst and –rs204.
 
bool open (Report &report)
 Open and initialize the TS packet output.
 
bool send (const TSPacket *packets, const TSPacketMetadata *metadata, size_t packet_count, const BitRate &bitrate, Report &report)
 Send TS packets.
 

Static Public Attributes

static constexpr size_t DEFAULT_PACKET_BURST = 7
 Default number of TS packets in a UDP datagram.
 
static constexpr size_t MAX_PACKET_BURST = 128
 Maximum number of TS packets in a UDP datagram.
 

Detailed Description

Send TS packets over datagrams (UDP, SRT, RIST, etc.)

Constructor & Destructor Documentation

◆ TSDatagramOutput()

ts::TSDatagramOutput::TSDatagramOutput ( TSDatagramOutputOptions  flags,
TSDatagramOutputHandlerInterface output = nullptr 
)
explicit

Constructor.

Parameters
[in]flagsList of options.
[in]outputOutput handler for datagrams. If null, raw UDP output is used.

Member Function Documentation

◆ defineArgs()

void ts::TSDatagramOutput::defineArgs ( Args args)

Add command line option definitions in an Args.

Parameters
[in,out]argsCommand line arguments to update.

◆ loadArgs()

bool ts::TSDatagramOutput::loadArgs ( DuckContext duck,
Args args 
)

Load arguments from command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]duckTSDuck execution context.
[in,out]argsCommand line arguments.
Returns
True on success, false on error in argument line.

◆ open()

bool ts::TSDatagramOutput::open ( Report report)

Open and initialize the TS packet output.

Parameters
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ close()

bool ts::TSDatagramOutput::close ( const BitRate bitrate,
bool  abort,
Report report 
)

Close the TS packet output.

Flush pending packets, if any.

Parameters
[in]bitrateCurrent of last bitrate to compute timestamps for buffered packets. Ignored if zero.
[in]abortIf true, do not flush pending packets.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ send()

bool ts::TSDatagramOutput::send ( const TSPacket packets,
const TSPacketMetadata metadata,
size_t  packet_count,
const BitRate bitrate,
Report report 
)

Send TS packets.

Some of them can be buffered and sent later.

Parameters
[in]packetsAddress of first packet.
[in]metadataAddress of first packet metadata (can be null).
[in]packet_countNumber of packets to send.
[in]bitrateCurrent bitrate to compute timestamps. Ignored if zero.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ maxPayloadSize()

size_t ts::TSDatagramOutput::maxPayloadSize ( ) const
inline

Get the maximum datagram payload size, according to options –packet-burst and –rs204.

Returns
The maximum datagram payload size.

Member Data Documentation

◆ DEFAULT_PACKET_BURST

constexpr size_t ts::TSDatagramOutput::DEFAULT_PACKET_BURST = 7
staticconstexpr

Default number of TS packets in a UDP datagram.

This value is equivalent to 1316 bytes, the maximum number of TS packets which fit (with headers) in an Ethernet MTU (1500 bytes).

◆ MAX_PACKET_BURST

constexpr size_t ts::TSDatagramOutput::MAX_PACKET_BURST = 128
staticconstexpr

Maximum number of TS packets in a UDP datagram.

This value (approximately 24 kB) is not recommended since it will result in IP datagram fragmentation in most cases.


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