TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
Common definitions for MPEG Transport Stream layer. More...
Namespaces | |
namespace | ts |
TSDuck namespace, containing all TSDuck classes and functions. | |
Typedefs | |
using | ts::DTS = cn::duration< std::intmax_t, std::ratio< 1, SYSTEM_CLOCK_SUBFREQ > > |
Definition of a number of DTS units as a std::chrono::duration type. | |
using | ts::PacketCounter = uint64_t |
Number of Transport Stream packets. | |
using | ts::PCR = cn::duration< std::intmax_t, std::ratio< 1, SYSTEM_CLOCK_FREQ > > |
Definition of a number of PCR units as a std::chrono::duration type. | |
using | ts::PID = uint16_t |
PID value (13 bits). | |
using | ts::PIDSet = std::bitset< PID_MAX > |
A bit mask for PID values. | |
using | ts::PTS = cn::duration< std::intmax_t, std::ratio< 1, SYSTEM_CLOCK_SUBFREQ > > |
Definition of a number of PTS units as a std::chrono::duration type. | |
using | ts::SectionCounter = uint64_t |
Number of sections. | |
Functions | |
uint64_t | ts::AbsDiffPCR (uint64_t pcr1, uint64_t pcr2) |
Compute the absolute value of the difference between two PCR's, regardless of their order. | |
uint64_t | ts::AddPCR (uint64_t pcr, int64_t offset) |
Add a signed offset to a PCR. | |
template<class Rep , class Period > | |
int64_t | ts::BitDistance (size_t bits, const BitRate &bitrate, const cn::duration< Rep, Period > &duration) |
Compute the number of "data structures" (bytes, packets, etc) transmitted during a given duration. | |
template<class Rep , class Period > | |
int64_t | ts::ByteDistance (const BitRate &bitrate, const cn::duration< Rep, Period > &duration) |
Compute the number of bytes transmitted during a given duration. | |
template<class DURATION = cn::milliseconds> requires std::integral<typename DURATION::rep> | |
DURATION | ts::ByteInterval (const BitRate &bitrate, std::intmax_t distance) |
Compute the interval, in duration, between two bytes in the transport stream. | |
template<class Rep , class Period > | |
BitRate | ts::BytesBitRate (uint64_t bytes, const cn::duration< Rep, Period > &duration) |
Compute the bitrate from a number of bytes transmitted during a given duration. | |
uint64_t | ts::DiffPCR (uint64_t pcr1, uint64_t pcr2) |
Compute the difference between PCR2 and PCR1. | |
uint64_t | ts::DiffPTS (uint64_t pts1, uint64_t pts2) |
Compute the difference between PTS2 and PTS1. | |
uint64_t | ts::NextPCR (uint64_t last_pcr, PacketCounter distance, const BitRate &bitrate) |
Compute the PCR of a packet, based on the PCR of a previous packet. | |
template<class Rep , class Period > | |
BitRate | ts::PacketBitRate (PacketCounter packets, const cn::duration< Rep, Period > &duration) |
Compute the bitrate from a number of packets transmitted during a given duration. | |
template<class Rep , class Period > | |
PacketCounter | ts::PacketDistance (const BitRate &bitrate, const cn::duration< Rep, Period > &duration) |
Compute the number of packets transmitted during a given duration. | |
template<class DURATION = cn::milliseconds> requires std::integral<typename DURATION::rep> | |
DURATION | ts::PacketInterval (const BitRate &bitrate, PacketCounter distance) |
Compute the interval, in duration, between two packets. | |
UString | ts::PCRToString (uint64_t pcr, bool hexa=true, bool decimal=true, bool ms=true) |
Convert a PCR value to a string. | |
UString | ts::PTSToString (uint64_t pts, bool hexa=true, bool decimal=true, bool ms=true) |
Convert a PTS or DTS value to a string. | |
PacketCounter | ts::SectionPacketCount (size_t section_size) |
Compute the minimum number of TS packets required to transport a section. | |
BitRate | ts::SelectBitrate (const BitRate &bitrate1, BitRateConfidence brc1, const BitRate &bitrate2, BitRateConfidence brc2) |
Select a bitrate from two input values with potentially different levels of confidence. | |
bool | ts::SequencedPTS (uint64_t pts1, uint64_t pts2) |
Check if two Presentation Time Stamps are in sequence. | |
BitRate | ts::ToBitrate188 (const BitRate &bitrate204) |
Convert 204-byte packet bitrate into 188-byte packet bitrate. | |
BitRate | ts::ToBitrate204 (const BitRate &bitrate188) |
Convert 188-byte packet bitrate into 204-byte packet bitrate. | |
bool | ts::WrapUpPCR (uint64_t pcr1, uint64_t pcr2) |
Check if PCR2 follows PCR1 after wrap up. | |
bool | ts::WrapUpPTS (uint64_t pts1, uint64_t pts2) |
Check if PTS2 follows PTS1 after wrap up. | |
Variables | |
const PIDSet | ts::AllPIDs |
PIDSet constant with all PID's set. | |
constexpr size_t | ts::CC_BITS = 4 |
Size (in bits) of a Continuity Counter (CC) field. | |
constexpr uint8_t | ts::CC_MASK = 0x0F |
Mask to wrap a Continuity Counter (CC) value. | |
constexpr uint8_t | ts::CC_MAX = 1 << CC_BITS |
Maximum value of a Continuity Counter (CC). | |
constexpr uint8_t | ts::INVALID_CC = 0xFF |
An invalid Continuity Counter (CC) value, typically meaning "undefined". | |
constexpr uint64_t | ts::INVALID_DTS = 0xFFFFFFFFFFFFFFFF |
An invalid DTS value, can be used as a marker. | |
constexpr PacketCounter | ts::INVALID_PACKET_COUNTER = std::numeric_limits<PacketCounter>::max() |
A impossible value for PacketCounter, meaning "undefined". | |
constexpr uint64_t | ts::INVALID_PCR = 0xFFFFFFFFFFFFFFFF |
An invalid PCR (Program Clock Reference) value, can be used as a marker. | |
constexpr uint64_t | ts::INVALID_PTS = 0xFFFFFFFFFFFFFFFF |
An invalid PTS value, can be used as a marker. | |
constexpr size_t | ts::M2TS_HEADER_SIZE = 4 |
Size in bytes of a timestamp preceeding a TS packet in M2TS files (Blu-ray disc). | |
constexpr uint64_t | ts::MAX_PCR = PCR_SCALE - 1 |
The maximum value possible for a PCR (Program Clock Reference) value. | |
constexpr uint64_t | ts::MAX_PTS_DTS = PTS_DTS_SCALE - 1 |
The maximum value possible for a PTS/DTS value. | |
const PIDSet | ts::NoPID |
PIDSet constant with no PID set. | |
constexpr size_t | ts::PCR_BIT_SIZE = 42 |
Size in bits of a PCR (Program Clock Reference). | |
constexpr uint64_t | ts::PCR_SCALE = PTS_DTS_SCALE * SYSTEM_CLOCK_SUBFACTOR |
Scale factor for PCR values. | |
constexpr size_t | ts::PID_BITS = 13 |
Size (in bits) of a PID field. | |
constexpr PID | ts::PID_MAX = 1 << PID_BITS |
Maximum number of PID's (8192). | |
const PIDClassEnumWrapper | ts::PIDClassEnum |
Enumeration description of ts::PIDClass. | |
constexpr size_t | ts::PKT_HEADER_SIZE = 4 |
MPEG TS packet header size in bytes. | |
constexpr size_t | ts::PKT_M2TS_SIZE = M2TS_HEADER_SIZE + PKT_SIZE |
Size in bytes of an TS packet in M2TS files (Blu-ray disc). | |
constexpr size_t | ts::PKT_MAX_PAYLOAD_SIZE = PKT_SIZE - PKT_HEADER_SIZE |
MPEG TS packet maximum payload size in bytes. | |
constexpr size_t | ts::PKT_RS_SIZE = PKT_SIZE + RS_SIZE |
Size in bytes of a TS packet with trailing Reed-Solomon outer FEC. | |
constexpr size_t | ts::PKT_RS_SIZE_BITS = 8 * PKT_RS_SIZE |
Size in bits of a TS packet with trailing Reed-Solomon outer FEC. | |
constexpr size_t | ts::PKT_SIZE = 188 |
MPEG TS packet size in bytes. | |
constexpr size_t | ts::PKT_SIZE_BITS = 8 * PKT_SIZE |
MPEG TS packet size in bits. | |
constexpr size_t | ts::PTS_DTS_BIT_SIZE = 33 |
Size in bits of a PTS (Presentation Time Stamp) or DTS (Decoding Time Stamp). | |
constexpr uint64_t | ts::PTS_DTS_MASK = PTS_DTS_SCALE - 1 |
Mask for PTS and DTS values (wrap up at 2^33). | |
constexpr uint64_t | ts::PTS_DTS_SCALE = 1LL << PTS_DTS_BIT_SIZE |
Scale factor for PTS and DTS values (wrap up at 2^33). | |
constexpr size_t | ts::RS_SIZE = 16 |
Size in bytes of a Reed-Solomon outer FEC. | |
constexpr uint8_t | ts::SYNC_BYTE = 0x47 |
Value of a sync byte (first byte in a TS packet). | |
constexpr uint32_t | ts::SYSTEM_CLOCK_FREQ = 27000000 |
MPEG-2 System Clock frequency in Hz, used by PCR (27 Mb/s). | |
constexpr uint32_t | ts::SYSTEM_CLOCK_SUBFACTOR = 300 |
Subfactor of MPEG-2 System Clock subfrequency, used by PTS and DTS. | |
constexpr uint32_t | ts::SYSTEM_CLOCK_SUBFREQ = SYSTEM_CLOCK_FREQ / SYSTEM_CLOCK_SUBFACTOR |
MPEG-2 System Clock subfrequency in Hz, used by PTS and DTS (90 Kb/s). | |
Common definitions for MPEG Transport Stream layer.