32 unsigned int getPID()
const;
35 void setPCR(int64_t NewVal);
59 operator bool()
const;
66 int fillFree(
const char * PackageData,
int maxLen);
68 void updPos(
unsigned int newPos);
71 static std::string &
getPESVideoLeadIn(
unsigned int len,
unsigned long long PTS,
unsigned long long offset,
bool isAligned);
75 std::string
toPrettyString(
size_t indent = 0,
int detailLevel = 3)
const;
88 char getOffset()
const;
89 char getTableId()
const;
90 short getSectionLength()
const;
91 short getTransportStreamId()
const;
92 char getVersionNumber()
const;
93 bool getCurrentNextIndicator()
const;
94 char getSectionNumber()
const;
95 char getLastSectionNumber()
const;
96 short getProgramCount()
const;
97 short getProgramNumber(
short index)
const;
98 short getProgramPID(
short index)
const;
107 operator bool()
const;
109 int getStreamType()
const;
110 void setStreamType(
int newType);
111 std::string getCodec()
const;
112 std::string getStreamTypeString()
const;
113 int getElementaryPid()
const;
114 void setElementaryPid(
int newElementaryPid);
115 int getESInfoLength()
const;
116 const char * getESInfo()
const;
117 void setESInfo(
const std::string & newInfo);
128 char getOffset()
const;
129 void setOffset(
char newVal);
130 char getTableId()
const;
131 void setTableId(
char newVal);
132 short getSectionLength()
const;
133 void setSectionLength(
short newVal);
134 short getProgramNumber()
const;
135 void setProgramNumber(
short newVal);
136 char getVersionNumber()
const;
137 void setVersionNumber(
char newVal);
138 bool getCurrentNextIndicator()
const;
139 void setCurrentNextIndicator(
bool newVal);
140 char getSectionNumber()
const;
141 void setSectionNumber(
char newVal);
142 char getLastSectionNumber()
const;
143 void setLastSectionNumber(
char newVal);
144 short getPCRPID()
const;
145 void setPCRPID(
short newVal);
146 short getProgramInfoLength()
const;
147 void setProgramInfoLength(
short newVal);
160 char StandardHeader[7] = {0xFF, 0xF1, 0x00, 0x00, 0x00, 0x1F, 0xFC};
162 StandardHeader[2] = ((((initData[0] >> 3) - 1) << 6) & 0xC0);
163 StandardHeader[2] |= ((((initData[0] & 0x07) << 1) | ((initData[1] >> 7) & 0x01)) << 2);
164 StandardHeader[2] |= ((initData[1] & 0x20) >> 5);
165 StandardHeader[3] = ((initData[1] & 0x18) << 3);
166 StandardHeader[3] |= ((FrameLen & 0x00001800) >> 11);
167 StandardHeader[4] = ((FrameLen & 0x000007F8) >> 3);
168 StandardHeader[5] |= ((FrameLen & 0x00000007) << 5);
169 return std::string(StandardHeader, 7);
188 static char PAT[188] = {0x47, 0x40, 0x00, 0x10, 0x00, 0x00, 0xB0, 0x0D, 0x00, 0x01, 0xC1, 0x00, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x2A, 0xB1, 0x04,
189 0xB2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
190 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
191 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
192 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
193 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
194 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
195 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
198 const char *
createPMT(std::set<unsigned long>& selectedTracks,
DTSC::Meta& myMeta,
int contCounter=0);
Definition: ts_packet.h:124
int getAdaptationFieldLen() const
Gets the current length of the adaptationfield.
Definition: ts_packet.cpp:215
unsigned int pos
Definition: ts_packet.h:82
Definition: ts_packet.h:103
bool hasSplicingPoint() const
Gets the value of the splicing point flag.
Definition: ts_packet.cpp:379
void setPID(int NewPID)
Sets the PID of a single Packet.
Definition: ts_packet.cpp:74
Definition: ts_packet.h:85
void setUnitStart(bool newVal)
Sets the start of a new unit in this Packet.
Definition: ts_packet.cpp:316
char strBuf[189]
Definition: ts_packet.h:81
void setDiscontinuity(bool newVal)
Definition: ts_packet.cpp:334
static std::string getAudioHeader(int FrameLen, std::string initData)
Constructs an audio header to be used on each audio frame.
Definition: ts_packet.h:159
void setAdaptationField(int NewVal)
Sets the selection value for an adaptationfield of a Packet.
Definition: ts_packet.cpp:124
static std::string & getPESAudioLeadIn(unsigned int len, unsigned long long PTS)
Generates a PES Lead-in for an audio frame.
Definition: ts_packet.cpp:475
char * boundary
Definition: ts_packet.h:121
bool hasPriority() const
Gets the transport priority of a Packet.
Definition: ts_packet.cpp:203
bool FromPointer(const char *data)
This funtion fills a Packet from a char array.
Definition: ts_packet.cpp:55
unsigned int getDataSize() const
Definition: ts_packet.cpp:304
const char * getPayload() const
returns the character buffer with a std::string wrapper
Definition: ts_packet.cpp:561
void addStuffing()
Adds stuffing to the Packet depending on how much content you want to send.
Definition: ts_packet.cpp:504
void setContinuityCounter(int NewContinuity)
Sets the Continuity Counter of a single Packet.
Definition: ts_packet.cpp:88
unsigned int getBytesFree() const
Gets the amount of bytes that are not written yet in a Packet.
Definition: ts_packet.cpp:101
bool hasESpriority() const
Gets the elementary stream priority indicator of a Packet.
Definition: ts_packet.cpp:326
Holds all TS processing related code.
Definition: ts_packet.cpp:20
void setDefaultPAT()
Transforms the Packet into a standard Program Association Table.
Definition: ts_packet.cpp:408
const char * checkAndGetBuffer() const
Checks the size of the internal packet buffer (prints error if size !=188), then returns a pointer to...
Definition: ts_packet.cpp:418
bool FromFile(FILE *data)
This function fills a Packet from a file.
Definition: ts_packet.cpp:37
void setPCR(int64_t NewVal)
Sets the PCR (Program Clock Reference) of a Packet.
Definition: ts_packet.cpp:143
Class for reading and writing TS Streams.
Definition: ts_packet.h:21
void clear()
Sets the packet pos to 4, and resets the first 4 fields to defaults (including sync byte on pos 0) ...
Definition: ts_packet.cpp:110
void setRandomAccess(bool newVal)
Gets the value of the transport private data point flag.
Definition: ts_packet.cpp:385
void updPos(unsigned int newPos)
update position in character array (pos),
Definition: ts_packet.cpp:66
bool hasPCR() const
Gets the value of the PCR flag.
Definition: ts_packet.cpp:367
bool hasTransportError() const
Gets the transport error inficator of a Packet.
Definition: ts_packet.cpp:191
static char PAT[188]
A standard Program Association Table, as generated by FFMPEG.
Definition: ts_packet.h:188
~Packet()
The deconstructor deletes all space that may be occupied by a Packet.
Definition: ts_packet.cpp:62
static std::string & getPESVideoLeadIn(unsigned int len, unsigned long long PTS, unsigned long long offset, bool isAligned)
Generates a PES Lead-in for a video frame.
Definition: ts_packet.cpp:449
char * data
Definition: ts_packet.h:120
int getContinuityCounter() const
Gets the Continuity Counter of a single Packet.
Definition: ts_packet.cpp:95
std::string toPrettyString(size_t indent=0, int detailLevel=3) const
Prints a packet to stdout, for analyser purposes.
Definition: ts_packet.cpp:227
bool getUnitStart() const
Gets the payload unit start inficator of a Packet.
Definition: ts_packet.cpp:197
bool hasOPCR() const
Gets the value of the OPCR flag.
Definition: ts_packet.cpp:373
bool getRandomAccess() const
Gets whether this Packet can be accessed at random (indicates keyframe).
Definition: ts_packet.cpp:358
int64_t getOPCR() const
Gets the OPCR (Original Program Clock Reference) of a Packet.
Definition: ts_packet.cpp:175
int getAdaptationField() const
Gets whether a Packet contains an adaptationfield.
Definition: ts_packet.cpp:137
unsigned int getTransportScramblingControl() const
Gets the transport scrambling control of a Packet.
Definition: ts_packet.cpp:209
bool hasDiscontinuity() const
Definition: ts_packet.cpp:330
const char * createPMT(std::set< unsigned long > &selectedTracks, DTSC::Meta &myMeta, int contCounter)
Construct a PMT (special 188B ts packet) from a set of selected tracks and metadata.
Definition: ts_packet.cpp:967
bool isPMT() const
Returns true if this PID contains a PMT.
Definition: ts_packet.cpp:310
int fillFree(const char *PackageData, int maxLen)
Fills the free bytes of the Packet.
Definition: ts_packet.cpp:494
unsigned int getPID() const
Gets the PID of a single Packet.
Definition: ts_packet.cpp:82
int getPayloadLength() const
Gets the length of the payload for this apcket.
Definition: ts_packet.cpp:567
Packet()
This constructor creates an empty Packet, ready for use for either reading or writing.
Definition: ts_packet.cpp:23
int64_t getPCR() const
Gets the PCR (Program Clock Reference) of a Packet.
Definition: ts_packet.cpp:160