TSDuck v3.45-4777
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

Common definitions for MPEG Transport Stream layer. More...

Classes

class  ts::TimeSourceSuperTraits< T, typename std::enable_if< T==TimeSource::PCR||T==TimeSource::OPCR >::type >
 TimeSourceSuperTraits specialization for PCR and OPCR. More...
 
class  ts::TimeSourceSuperTraits< T, typename std::enable_if< T==TimeSource::PTS||T==TimeSource::DTS >::type >
 TimeSourceSuperTraits specialization for PTS and DTS. More...
 
class  ts::TimeSourceTraits< T >
 Traits class for TimeSource values. More...
 

Namespaces

namespace  ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Typedefs

using ts::DTS = DTSTraits::Duration
 DTS units as a std::chrono::duration type.
 
using ts::DTSTraits = TimeSourceTraits< TimeSource::DTS >
 DTS traits class.
 
using ts::PacketCounter = uint64_t
 Number of Transport Stream packets.
 
using ts::PCR = PCRTraits::Duration
 PCR units as a std::chrono::duration type.
 
using ts::PCRTraits = TimeSourceTraits< TimeSource::PCR >
 PCR traits class.
 
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 = PTSTraits::Duration
 PTS units as a std::chrono::duration type.
 
using ts::PTSTraits = TimeSourceTraits< TimeSource::PTS >
 PTS traits class.
 

Enumerations

enum  : uint8_t {
  ts::SC_CLEAR = 0 ,
  ts::SC_DVB_RESERVED = 1 ,
  ts::SC_EVEN_KEY = 2 ,
  ts::SC_ODD_KEY = 3
}
 Scrambling_control values (used in TS and PES packets headers) More...
 
enum  : PID {
  ts::PID_PAT = 0x0000 ,
  ts::PID_CAT = 0x0001 ,
  ts::PID_TSDT = 0x0002 ,
  ts::PID_MPEG_LAST = 0x000F ,
  ts::PID_DVB_FIRST = 0x0010 ,
  ts::PID_NIT = 0x0010 ,
  ts::PID_SDT = 0x0011 ,
  ts::PID_BAT = 0x0011 ,
  ts::PID_EIT = 0x0012 ,
  ts::PID_CIT = 0x0012 ,
  ts::PID_RST = 0x0013 ,
  ts::PID_TDT = 0x0014 ,
  ts::PID_TOT = 0x0014 ,
  ts::PID_NETSYNC = 0x0015 ,
  ts::PID_RNT = 0x0016 ,
  ts::PID_SAT = 0x001B ,
  ts::PID_INBSIGN = 0x001C ,
  ts::PID_MEASURE = 0x001D ,
  ts::PID_DIT = 0x001E ,
  ts::PID_SIT = 0x001F ,
  ts::PID_DVB_LAST = 0x001F ,
  ts::PID_DCT = 0x0017 ,
  ts::PID_ISDB_FIRST = 0x0020 ,
  ts::PID_LIT = 0x0020 ,
  ts::PID_ERT = 0x0021 ,
  ts::PID_PCAT = 0x0022 ,
  ts::PID_SDTT = 0x0023 ,
  ts::PID_BIT = 0x0024 ,
  ts::PID_NBIT = 0x0025 ,
  ts::PID_LDT = 0x0025 ,
  ts::PID_ISDB_EIT_2 = 0x0026 ,
  ts::PID_ISDB_EIT_3 = 0x0027 ,
  ts::PID_SDTT_TER = 0x0028 ,
  ts::PID_CDT = 0x0029 ,
  ts::PID_AMT = 0x002E ,
  ts::PID_ISDB_LAST = 0x002F ,
  ts::PID_IIP = 0x1FF0 ,
  ts::PID_ATSC_FIRST = 0x1FF0 ,
  ts::PID_ATSC_PAT_E = 0x1FF7 ,
  ts::PID_PSIP_TS_E = 0x1FF9 ,
  ts::PID_PSIP = 0x1FFB ,
  ts::PID_ATSC_LAST = 0x1FFE ,
  ts::PID_NULL = 0x1FFF
}
 Predefined PID values. More...
 
enum  : uint8_t {
  ts::AFDID_TIMELINE = 0x04 ,
  ts::AFDID_LOCATION = 0x05 ,
  ts::AFDID_BASEURL = 0x06 ,
  ts::AFDID_CETS_BRANGE = 0x07 ,
  ts::AFDID_3DA_EXTSTREAM = 0x08 ,
  ts::AFDID_3DA_MULTISTREAM = 0x09 ,
  ts::AFDID_3DA_COMMAND = 0x0A ,
  ts::AFDID_BOUNDARY = 0x0B ,
  ts::AFDID_LABELING = 0x0C ,
  ts::AFDID_HEVC_TILE = 0x0D
}
 Adaptation field descriptor tags. More...
 
enum class  ts::BitRateConfidence {
  ts::LOW ,
  ts::PCR_CONTINUOUS ,
  ts::PCR_AVERAGE ,
  ts::CLOCK ,
  ts::HARDWARE ,
  ts::OVERRIDE
}
 Confidence in a bitrate value. More...
 
enum  ts::PacketProcessStatus {
  ts::TSP_OK = 0 ,
  ts::TSP_END = 1 ,
  ts::TSP_DROP = 2 ,
  ts::TSP_NULL = 3
}
 Status of a packet processing. More...
 
enum class  ts::PIDClass {
  ts::UNDEFINED ,
  ts::PSI ,
  ts::EMM ,
  ts::ECM ,
  ts::VIDEO ,
  ts::AUDIO ,
  ts::SUBTITLES ,
  ts::DATA ,
  ts::PCR_ONLY ,
  ts::STUFFING
}
 Classification of PID's. More...
 
enum class  ts::TimeSource : uint8_t {
  ts::UNDEFINED = 0 ,
  ts::HARDWARE ,
  ts::KERNEL ,
  ts::TSP ,
  ts::RTP ,
  ts::SRT ,
  ts::M2TS ,
  ts::PCR ,
  ts::OPCR ,
  ts::DTS ,
  ts::PTS ,
  ts::PCAP ,
  ts::RIST
}
 Sources of time information for transport streams. More...
 

Functions

const PIDSetts::AllPIDs ()
 PIDSet constant with all PID's set.
 
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.
 
bool ts::MonotonicTimeSource (TimeSource source)
 Check if a ts::TimeSource value is a monotonic clock.
 
const PIDSetts::NoPID ()
 PIDSet constant with no PID set.
 
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.
 
const Namests::PacketProcessingStatusNames ()
 Names of packet procesing status values.
 
const Namests::PIDClassEnum ()
 Enumeration description of ts::PIDClass with meaningful names.
 
const Namests::PIDClassIdentifier ()
 Enumeration description of ts::PIDClass with simple lowercase identifiers.
 
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.
 
const Namests::TimeSourceEnum ()
 Enumeration description of ts::TimeSource.
 
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.
 

Variables

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 = DTSTraits::INVALID
 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 = PCRTraits::INVALID
 An invalid PCR value, can be used as a marker.
 
constexpr uint64_t ts::INVALID_PTS = PTSTraits::INVALID
 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::PCR_SCALE = PCRTraits::SCALE
 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).
 
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 uint64_t ts::PTS_DTS_MASK = PTSTraits::SCALE - 1
 Mask for PTS and DTS values (wrap up at 2^33).
 
constexpr uint64_t ts::PTS_DTS_SCALE = PTSTraits::SCALE
 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 uint64_t ts::SYSTEM_CLOCK_FREQ = PCRTraits::TICKS
 MPEG-2 System Clock frequency in Hz, used by PCR (27 Mb/s).
 
constexpr uint64_t ts::SYSTEM_CLOCK_SUBFACTOR = PCRTraits::TICKS / PTSTraits::TICKS
 Subfactor of MPEG-2 System Clock subfrequency, used by PTS and DTS.
 
constexpr uint64_t ts::SYSTEM_CLOCK_SUBFREQ = PTSTraits::TICKS
 MPEG-2 System Clock subfrequency in Hz, used by PTS and DTS (90 Kb/s).
 

Detailed Description

Common definitions for MPEG Transport Stream layer.