23#define dbgpatpmt(a...) if (DebugPatPmt) fprintf(stderr, a)
24#define dbgframes(a...) if (DebugFrames) fprintf(stderr, a)
26#define MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION 6
27#define WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION (MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION / 2)
28#define WRN_TS_PACKETS_FOR_FRAME_DETECTOR (MIN_TS_PACKETS_FOR_FRAME_DETECTOR / 2)
30#define EMPTY_SCANNER (0xFFFFFFFF)
37 if ((Data[6] & 0xC0) == 0x80) {
45 if (ContinuationHeader)
46 *ContinuationHeader = ((Data[6] == 0x80) && !Data[7] && !Data[8]);
55 for (
int i = 0; i < 16; i++) {
71 if (ContinuationHeader)
72 *ContinuationHeader =
false;
86 if (ContinuationHeader)
87 *ContinuationHeader =
true;
98#define VIDEO_STREAM_S 0xE0
107 if (Data[i] == 0 && Data[i + 1] == 0 && Data[i + 2] == 1 && Data[i + 3] == 0xB8) {
108 if (!(Data[i + 7] & 0x40))
113 dsyslog(
"SetBrokenLink: no GOP header found in video packet");
116 dsyslog(
"SetBrokenLink: no video packet in frame");
123 p[1] &= ~TS_PAYLOAD_START;
125 p[3] &= ~TS_PAYLOAD_EXISTS;
128 memset(p + 6, 0xFF,
TS_SIZE - 6);
141 p[10] = (b << 7) | (p[10] & 0x7E) | ((e >> 8) & 0x01);
147int TsSync(
const uchar *Data,
int Length,
const char *File,
const char *Function,
int Line)
155 if (Skipped && File && Function && Line)
156 esyslog(
"ERROR: skipped %d bytes to sync on start of TS packet at %s/%s(%d)", Skipped, File, Function, Line);
218 p[ 9] = ((Pts >> 29) & 0x0E) | (p[9] & 0xF1);
220 p[11] = ((Pts >> 14) & 0xFE) | 0x01;
222 p[13] = ((Pts << 1) & 0xFE) | 0x01;
227 p[14] = ((Dts >> 29) & 0x0E) | (p[14] & 0xF1);
229 p[16] = ((Dts >> 14) & 0xFE) | 0x01;
231 p[18] = ((Dts << 1) & 0xFE) | 0x01;
236 int64_t d = Pts2 - Pts1;
256 Setup(Data, Length, Pid);
330 if (Index >= 0 && Index <
length)
336 int OldIndex =
index;
341 Scanner = (Scanner << 8) |
GetByte();
373 TsPacket[3] = (TsPacket[3] & 0xF0) | Counter;
374 if (++Counter > 0x0F)
380 if (++Version > 0x1F)
397 Target[i++] = 0xE0 | (Pid >> 8);
420 Target[i++] = *Language++;
421 Target[i++] = *Language++;
422 Target[i++] = *Language++;
423 Target[i++] = SubtitlingType;
424 Target[i++] = CompositionPageId >> 8;
425 Target[i++] = CompositionPageId & 0xFF;
426 Target[i++] = AncillaryPageId >> 8;
427 Target[i++] = AncillaryPageId & 0xFF;
437 Target[Length] = 0x00;
438 for (
const char *End = Language + strlen(Language); Language < End; ) {
439 Target[i++] = *Language++;
440 Target[i++] = *Language++;
441 Target[i++] = *Language++;
443 Target[Length] += 0x04;
444 if (*Language ==
'+')
455 Target[i++] = crc >> 24;
456 Target[i++] = crc >> 16;
457 Target[i++] = crc >> 8;
463#define P_PMT_PID 0x0084
468 bool Used[
MAXPID] = {
false };
469#define SETPID(p) { if ((p) >= 0 && (p) < MAXPID) Used[p] = true; }
470#define SETPIDS(l) { const int *p = l; while (*p) { SETPID(*p); p++; } }
483 memset(
pat, 0xFF,
sizeof(
pat));
491 int PayloadStart = i;
494 int SectionLength = i;
503 p[i++] = 0xE0 | (
pmtPid >> 8);
505 pat[SectionLength] = i - SectionLength - 1 + 4;
514 memset(buf, 0xFF,
sizeof(buf));
517 int Vpid = Channel->
Vpid();
518 int Ppid = Channel->
Ppid();
522 int SectionLength = i;
530 p[i++] = 0xE0 | (Ppid >> 8);
537 for (
int n = 0; Channel->
Apid(n); n++) {
539 const char *Alang = Channel->
Alang(n);
542 for (
int n = 0; Channel->
Dpid(n); n++) {
547 for (
int n = 0; Channel->
Spid(n); n++) {
552 int sl = i - SectionLength - 2 + 4;
553 buf[SectionLength] |= (sl >> 8) & 0x0F;
554 buf[SectionLength + 1] = sl;
631 Data += PayloadOffset;
632 Length -= PayloadOffset;
634 if ((Length -= Data[0] + 1) <= 0)
656 esyslog(
"ERROR: can't parse PAT");
664 Data += PayloadOffset;
665 Length -= PayloadOffset;
669 if ((Length -= Data[0] + 1) <= 0)
673 if (Length <=
int(
sizeof(
pmt))) {
674 memcpy(
pmt, Data, Length);
678 esyslog(
"ERROR: PMT packet length too big (%d byte)!", Length);
690 esyslog(
"ERROR: PMT section length too big (%d byte)!",
pmtSize + Length);
745 char *s =
alangs[NumApids];
795 char *s =
slangs[NumSpids];
829 dpids[NumDpids] = dpid;
915 esyslog(
"ERROR: can't parse PMT");
924 int Pid =
TsPid(Data);
957 int L = (M < 3) ? 1 : 0;
958 return 14956 + D + int((Y - L) * 365.25) + int((M + 1 + L * 12) * 30.6001);
968 *p++ = ParentalRating;
976 uchar *DescriptorsStart;
977 memset(
eit, 0xFF,
sizeof(
eit));
979 time_t t = time(NULL) - 3600;
980 tm *tm = localtime_r(&t, &tm_r);
981 uint16_t MJD =
YMDtoMJD(tm->tm_year, tm->tm_mon + 1, tm->tm_mday);
987 *p++ = 0x10 | (
counter++ & 0x0F);
1018 DescriptorsStart = p;
1021 *(SectionStart - 1) = p - SectionStart + 4;
1022 *(DescriptorsStart - 1) = p - DescriptorsStart;
1024 int crc =
SI::CRC32::crc32((
char *)PayloadStart, p - PayloadStart, 0xFFFFFFFF);
1064 esyslog(
"ERROR: out of memory");
1073#define MAXPESLENGTH 0xFFF0
1093 memmove(p,
data, 4);
1138void BlockDump(
const char *Name,
const u_char *Data,
int Length)
1140 printf(
"--- %s\n", Name);
1141 for (
int i = 0; i < Length; i++) {
1142 if (i && (i % 16) == 0)
1144 printf(
" %02X", Data[i]);
1149void TsDump(
const char *Name,
const u_char *Data,
int Length)
1151 printf(
"%s: %04X", Name, Length);
1152 int n =
min(Length, 20);
1153 for (
int i = 0; i < n; i++)
1154 printf(
" %02X", Data[i]);
1157 n =
max(n, Length - 10);
1158 for (n =
max(n, Length - 10); n < Length; n++)
1159 printf(
" %02X", Data[n]);
1164void PesDump(
const char *Name,
const u_char *Data,
int Length)
1166 TsDump(Name, Data, Length);
1218 virtual int Parse(
const uchar *Data,
int Length,
int Pid);
1258 virtual int Parse(
const uchar *Data,
int Length,
int Pid);
1272 bool SeenPayloadStart =
false;
1275 SeenPayloadStart =
true;
1281 uint32_t OldScanner =
scanner;
1283 if (!SeenPayloadStart && tsPayload.
AtTsStart())
1293 int TemporalReference = (b1 << 2 ) + ((b2 & 0xC0) >> 6);
1294 uchar FrameType = (b2 >> 3) & 0x07;
1295 if (tsPayload.
Find(0x000001B5)) {
1296 if (((tsPayload.
GetByte() & 0xF0) >> 4) == 0x08) {
1299 if (PictureStructure == 0x02)
1313 static const char FrameTypes[] =
"?IPBD???";
1326 uchar frame_rate_value = b & 0x0F;
1327 if (frame_rate_value > 0 && frame_rate_value <= 8)
1331 if ((tsPayload.
GetByte() & 0xF0) == 0x10) {
1345 return tsPayload.
Used();
1386 virtual int Parse(
const uchar *Data,
int Length,
int Pid);
1427 return (
byte & (1 <<
bit--)) ? 1 : 0;
1441 for (
int b = 0; !b && z < 32; z++)
1443 return (1 << z) - 1 +
GetBits(z);
1450 if ((v & 0x01) != 0)
1453 return -int32_t(v / 2);
1471 if ((
scanner & 0xFFFFFF00) == 0x00000100) {
1473 switch (NalUnitType) {
1510 int chroma_format_idc = 0;
1516 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 244 || profile_idc == 44 || profile_idc == 83 || profile_idc == 86 || profile_idc ==118 || profile_idc == 128) {
1518 if (chroma_format_idc == 3)
1524 for (
int i = 0; i < ((chroma_format_idc != 3) ? 8 : 12); i++) {
1526 int SizeOfScalingList = (i < 6) ? 16 : 64;
1529 for (
int j = 0; j < SizeOfScalingList; j++) {
1531 NextScale = (LastScale +
GetGolombSe() + 256) % 256;
1533 LastScale = NextScale;
1541 if (pic_order_cnt_type == 0)
1543 else if (pic_order_cnt_type == 1) {
1562 bool frame_cropping_flag =
GetBit();
1563 if (frame_cropping_flag) {
1567 uint16_t frame_crop_bottom_offset =
GetGolombUe();
1568 uint16_t CropUnitX = 1;
1571 if (chroma_format_idc == 1) {
1575 else if (chroma_format_idc == 2)
1578 frame_Width -= CropUnitX * (frame_crop_left_offset + frame_crop_right_offset);
1579 frame_Height -= CropUnitY * (frame_crop_top_offset + frame_crop_bottom_offset);
1586 int aspect_ratio_idc =
GetBits(8);
1587 if (aspect_ratio_idc == 255)
1602 uint32_t num_units_in_tick =
GetBits(32);
1603 uint32_t time_scale =
GetBits(32);
1604 if (num_units_in_tick > 0)
1628 static const char SliceTypes[] =
"PBIpi";
1629 dbgframes(
"%c", SliceTypes[slice_type % 5]);
1683 virtual int Parse(
const uchar *Data,
int Length,
int Pid);
1701 if ((
scanner & 0xFFFFFF00) == 0x00000100) {
1728 uint8_t sub_layer_profile_present_flag[8];
1729 uint8_t sub_layer_level_present_flag[8];
1731 int sps_max_sub_layers_minus1 =
GetBits(3);
1739 bool general_progressive_source_flag =
GetBit();
1749 for (
int i = 0; i < sps_max_sub_layers_minus1; i++ ) {
1750 sub_layer_profile_present_flag[i] =
GetBit();
1751 sub_layer_level_present_flag[i] =
GetBit();
1753 if (sps_max_sub_layers_minus1 > 0) {
1754 for (
int i = sps_max_sub_layers_minus1; i < 8; i++ )
1757 for (
int i = 0; i < sps_max_sub_layers_minus1; i++ ) {
1758 if (sub_layer_profile_present_flag[i] )
1760 if (sub_layer_level_present_flag[i])
1766 if (chroma_format_idc == 3)
1770 bool conformance_window_flag =
GetBit();
1771 if (conformance_window_flag) {
1776 uint16_t SubWidthC = 1;
1777 uint16_t SubHeightC = 1;
1779 if (chroma_format_idc == 1) {
1783 else if (chroma_format_idc == 2)
1786 frameWidth -= SubWidthC * (conf_win_left_offset + conf_win_right_offset);
1787 frameHeight -= SubHeightC * (conf_win_top_offset + conf_win_bottom_offset);
1791 int log2_max_pic_order_cnt_lsb_minus4 =
GetGolombUe();
1792 int sps_sub_layer_ordering_info_present_flag =
GetBit();
1793 for (
int i = sps_sub_layer_ordering_info_present_flag ? 0 : sps_max_sub_layers_minus1; i <= sps_max_sub_layers_minus1; ++i) {
1807 for (
int sizeId = 0; sizeId < 4; ++sizeId) {
1808 for (
int matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1) {
1812 int coefNum =
min(64, (1 << (4 + (sizeId << 1))));
1815 for (
int i = 0; i < coefNum; ++i)
1830 uint32_t num_short_term_ref_pic_sets =
GetGolombUe();
1831 uint32_t NumDeltaPocs[num_short_term_ref_pic_sets];
1832 for (uint32_t stRpsIdx = 0; stRpsIdx < num_short_term_ref_pic_sets; ++stRpsIdx) {
1834 bool inter_ref_pic_set_prediction_flag =
false;
1836 inter_ref_pic_set_prediction_flag =
GetBit();
1837 if (inter_ref_pic_set_prediction_flag) {
1838 uint32_t RefRpsIdx, delta_idx_minus1 = 0;
1839 if (stRpsIdx == num_short_term_ref_pic_sets)
1843 RefRpsIdx = stRpsIdx - (delta_idx_minus1 + 1);
1844 NumDeltaPocs[stRpsIdx] = 0;
1845 for (uint32_t j = 0; j <= NumDeltaPocs[RefRpsIdx]; ++j) {
1848 NumDeltaPocs[stRpsIdx]++;
1851 NumDeltaPocs[stRpsIdx]++;
1857 for (uint32_t j = 0; j < num_negative_pics; ++j) {
1861 for (uint32_t j = 0; j < num_positive_pics; ++j) {
1865 NumDeltaPocs[stRpsIdx] = num_negative_pics + num_positive_pics;
1870 uint32_t num_long_term_ref_pics_sps =
GetGolombUe();
1871 for (uint32_t i = 0; i < num_long_term_ref_pics_sps; ++i) {
1872 GetBits(log2_max_pic_order_cnt_lsb_minus4 + 4);
1880 int aspect_ratio_idc =
GetBits(8);
1881 if (aspect_ratio_idc == 255)
1903 uint32_t vui_num_units_in_tick =
GetBits(32);
1904 uint32_t vui_time_scale =
GetBits(32);
1905 if (vui_num_units_in_tick > 0)
1933 if (*(uint32_t *)p1 < *(uint32_t *)p2)
return -1;
1934 if (*(uint32_t *)p1 > *(uint32_t *)p2)
return 1;
1947 else if (
type == 0x1B)
1949 else if (
type == 0x24)
1954 esyslog(
"ERROR: unknown stream type %d (PID %d) in frame detector",
type,
pid);
1965 if (
int Skipped =
TS_SYNC(Data, Length))
1966 return Processed + Skipped;
1970 int Pid =
TsPid(Data);
2042 else if (abs(Delta - 3600) <= 1)
2044 else if (Delta % 3003 == 0)
2046 else if (abs(Delta - 1800) <= 1)
2048 else if (Delta == 1501)
2069 Processed += Handled;
static u_int32_t crc32(const char *d, int len, u_int32_t CRCvalue)
Descriptor * getNext(Iterator &it)
DescriptorTag getDescriptorTag() const
StructureLoop< Language > languageLoop
bool getCurrentNextIndicator() const
int getSectionNumber() const
int getLastSectionNumber() const
int getVersionNumber() const
StructureLoop< Association > associationLoop
int getTransportStreamId() const
DescriptorLoop streamDescriptors
int getStreamType() const
StructureLoop< Stream > streamLoop
int getSubtitlingType() const
int getAncillaryPageId() const
int getCompositionPageId() const
StructureLoop< Subtitling > subtitlingLoop
virtual int Parse(const uchar *Data, int Length, int Pid)
Parses the given Data, which is a sequence of Length bytes of TS packets.
const int * Dpids(void) const
uint16_t AncillaryPageId(int i) const
uint16_t CompositionPageId(int i) const
const char * Slang(int i) const
uchar SubtitlingType(int i) const
const char * Dlang(int i) const
const int * Apids(void) const
const char * Alang(int i) const
const int * Spids(void) const
static cDevice * PrimaryDevice(void)
Returns the primary device.
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language=NULL, const char *Description=NULL)
Sets the track of the given Type and Index to the given values.
uchar * AddParentalRatingDescriptor(uchar *p, uchar ParentalRating=0)
uint16_t YMDtoMJD(int Y, int M, int D)
uchar * Generate(int Sid)
uint32_t ptsValues[MaxPtsValues]
cFrameDetector(int Pid=0, int Type=0)
Sets up a frame detector for the given Pid and stream Type.
int Analyze(const uchar *Data, int Length)
Analyzes the TS packets pointed to by Data.
void SetPid(int Pid, int Type)
Sets the Pid and stream Type to detect frames for.
uint16_t FrameWidth(void)
void SetDebug(bool Debug)
double FramesPerSecond(void)
bool IndependentFrame(void)
int iFrameTemporalReferenceOffset
virtual int Parse(const uchar *Data, int Length, int Pid)=0
Parses the given Data, which is a sequence of Length bytes of TS packets.
uint16_t FrameHeight(void)
int IFrameTemporalReferenceOffset(void)
uint32_t GetBits(int Bits)
void ParseAccessUnitDelimiter(void)
@ nutSequenceParameterSet
bool separate_colour_plane_flag
bool gotAccessUnitDelimiter
virtual int Parse(const uchar *Data, int Length, int Pid)
Parses the given Data, which is a sequence of Length bytes of TS packets.
uint32_t GetGolombUe(void)
uchar GetByte(bool Raw=false)
Gets the next data byte.
void ParseSliceHeader(void)
void ParseSequenceParameterSet(void)
bool gotSequenceParameterSet
int32_t GetGolombSe(void)
cH264Parser(void)
Sets up a new H.264 parser.
virtual int Parse(const uchar *Data, int Length, int Pid)
Parses the given Data, which is a sequence of Length bytes of TS packets.
@ nutSliceSegmentIDRWRADL
@ nutSliceSegmentBLAWRADL
@ nutSliceSegmentTrailingR
@ nutSequenceParameterSet
@ nutSliceSegmentTrailingN
void ParseSequenceParameterSet(void)
bool seenIndependentFrame
int lastIFrameTemporalReference
virtual int Parse(const uchar *Data, int Length, int Pid)
Parses the given Data, which is a sequence of Length bytes of TS packets.
const double frame_rate_table[9]
int MakeCRC(uchar *Target, const uchar *Data, int Length)
uchar * GetPmt(int &Index)
Returns a pointer to the Index'th TS packet of the PMT section.
void SetChannel(const cChannel *Channel)
Sets the Channel for which the PAT/PMT shall be generated.
void IncEsInfoLength(int Length)
void IncCounter(int &Counter, uchar *TsPacket)
cPatPmtGenerator(const cChannel *Channel=NULL)
void SetVersions(int PatVersion, int PmtVersion)
Sets the version numbers for the generated PAT and PMT, in case this generator is used to,...
int MakeAC3Descriptor(uchar *Target, uchar Type)
void GeneratePat(void)
Generates a PAT section for later use with GetPat().
uchar * GetPat(void)
Returns a pointer to the PAT section, which consists of exactly one TS packet.
uchar pmt[MAX_PMT_TS][TS_SIZE]
int MakeLanguageDescriptor(uchar *Target, const char *Language)
void GeneratePmt(const cChannel *Channel)
Generates a PMT section for the given Channel, for later use with GetPmt().
void GeneratePmtPid(const cChannel *Channel)
Generates a PMT pid that doesn't collide with any of the actual pids of the Channel.
int MakeStream(uchar *Target, uchar Type, int Pid)
int MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId)
void IncVersion(int &Version)
bool GetVersions(int &PatVersion, int &PmtVersion) const
Returns true if a valid PAT/PMT has been parsed and stores the current version numbers in the given v...
uchar pmt[MAX_SECTION_SIZE]
cPatPmtParser(bool UpdatePrimaryDevice=false)
void Reset(void)
Resets the parser.
void ParsePat(const uchar *Data, int Length)
Parses the PAT data from the single TS packet in Data.
char dlangs[MAXDPIDS][MAXLANGCODE2]
bool ParsePatPmt(const uchar *Data, int Length)
Parses the given Data (which may consist of several TS packets, typically an entire frame) and extrac...
int pmtPids[MAX_PMT_PIDS+1]
uchar subtitlingTypes[MAXSPIDS]
uint16_t ancillaryPageIds[MAXSPIDS]
int SectionLength(const uchar *Data, int Length)
void ParsePmt(const uchar *Data, int Length)
Parses the PMT data from the single TS packet in Data.
bool IsPmtPid(int Pid) const
Returns true if Pid the one of the PMT pids as defined by the current PAT.
uint16_t compositionPageIds[MAXSPIDS]
char alangs[MAXAPIDS][MAXLANGCODE2]
char slangs[MAXSPIDS][MAXLANGCODE2]
static void SetBrokenLink(uchar *Data, int Length)
static cString sprintf(const char *fmt,...) __attribute__((format(printf
bool AtPayloadStart(void)
Returns true if this payload handler is currently pointing to the first byte of a TS packet that star...
int Used(void)
Returns the number of raw bytes that have already been used (e.g.
bool Eof(void) const
Returns true if all available bytes of the TS payload have been processed.
void SetByte(uchar Byte, int Index)
Sets the TS data byte at the given Index to the value Byte.
uchar GetByte(void)
Gets the next byte of the TS payload, skipping any intermediate TS header data.
bool AtTsStart(void)
Returns true if this payload handler is currently pointing to first byte of a TS packet.
int GetLastIndex(void)
Returns the index into the TS data of the payload byte that has most recently been read.
void Setup(uchar *Data, int Length, int Pid=-1)
Sets up this TS payload handler with the given Data, which points to a sequence of Length bytes of co...
bool SkipPesHeader(void)
Skips all bytes belonging to the PES header of the payload.
void Statistics(void) const
May be called after a new frame has been detected, and will log a warning if the number of TS packets...
bool Find(uint32_t Code)
Searches for the four byte sequence given in Code and returns true if it was found within the payload...
bool SkipBytes(int Bytes)
Skips the given number of bytes in the payload and returns true if there is still data left to read.
void PutTs(const uchar *Data, int Length)
Puts the payload data of the single TS packet at Data into the converter.
void SetRepeatLast(void)
Makes the next call to GetPes() return exactly the same data as the last one (provided there was no c...
const uchar * GetPes(int &Length)
Gets a pointer to the complete PES packet, or NULL if the packet is not complete yet.
void Reset(void)
Resets the converter.
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
@ EnhancedAC3DescriptorTag
@ SubtitlingDescriptorTag
@ ISO639LanguageDescriptorTag
@ ParentalRatingDescriptorTag
#define DEFAULTFRAMESPERSECOND
void TsSetPcr(uchar *p, int64_t Pcr)
#define WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION
#define WRN_TS_PACKETS_FOR_FRAME_DETECTOR
void PesDump(const char *Name, const u_char *Data, int Length)
int64_t PtsDiff(int64_t Pts1, int64_t Pts2)
Returns the difference between two PTS values.
void TsHidePayload(uchar *p)
static int CmpUint32(const void *p1, const void *p2)
void PesSetDts(uchar *p, int64_t Dts)
int64_t TsGetDts(const uchar *p, int l)
void TsSetDts(uchar *p, int l, int64_t Dts)
void TsSetPts(uchar *p, int l, int64_t Pts)
ePesHeader AnalyzePesHeader(const uchar *Data, int Count, int &PesPayloadOffset, bool *ContinuationHeader)
void PesSetPts(uchar *p, int64_t Pts)
int64_t TsGetPts(const uchar *p, int l)
void BlockDump(const char *Name, const u_char *Data, int Length)
int TsSync(const uchar *Data, int Length, const char *File, const char *Function, int Line)
void TsDump(const char *Name, const u_char *Data, int Length)
#define MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION
bool TsError(const uchar *p)
int TsPid(const uchar *p)
bool TsHasPayload(const uchar *p)
int PesPayloadOffset(const uchar *p)
bool TsIsScrambled(const uchar *p)
int TsGetPayload(const uchar **p)
bool PesHasPts(const uchar *p)
bool PesLongEnough(int Length)
int64_t PesGetDts(const uchar *p)
#define TS_ADAPT_FIELD_EXISTS
int64_t PesGetPts(const uchar *p)
bool TsPayloadStart(const uchar *p)
#define TS_SYNC(Data, Length)
int TsPayloadOffset(const uchar *p)
bool PesHasDts(const uchar *p)
bool PesHasLength(const uchar *p)
bool TsHasAdaptationField(const uchar *p)
ePesHeader AnalyzePesHeader(const uchar *Data, int Count, int &PesPayloadOffset, bool *ContinuationHeader=NULL)
#define MIN_TS_PACKETS_FOR_FRAME_DETECTOR
int PesLength(const uchar *p)