33 #define TS_SYNC_BYTE 0x47
36 #define TS_PAYLOAD_START 0x40
37 #define TS_TRANSPORT_PRIORITY 0x20
38 #define TS_PID_MASK_HI 0x1F
39 #define TS_SCRAMBLING_CONTROL 0xC0
40 #define TS_ADAPT_FIELD_EXISTS 0x20
41 #define TS_PAYLOAD_EXISTS 0x10
42 #define TS_CONT_CNT_MASK 0x0F
43 #define TS_ADAPT_DISCONT 0x80
44 #define TS_ADAPT_RANDOM_ACC 0x40 // would be perfect for detecting independent frames, but unfortunately not used by all broadcasters
45 #define TS_ADAPT_ELEM_PRIO 0x20
46 #define TS_ADAPT_PCR 0x10
47 #define TS_ADAPT_OPCR 0x08
48 #define TS_ADAPT_SPLICING 0x04
49 #define TS_ADAPT_TP_PRIVATE 0x02
50 #define TS_ADAPT_EXTENSION 0x01
52 #define PATPID 0x0000 // PAT PID (constant 0)
53 #define MAXPID 0x2000 // for arrays that use a PID as the index
132 return 6 + p[4] * 256 + p[5];
142 return (p[7] & 0x80) && p[8] >= 5;
147 return ((((int64_t)p[ 9]) & 0x0E) << 29) |
148 (( (int64_t)p[10]) << 22) |
149 ((((int64_t)p[11]) & 0xFE) << 14) |
150 (( (int64_t)p[12]) << 7) |
151 ((((int64_t)p[13]) & 0xFE) >> 1);
156 #define MAX_SECTION_SIZE 4096 // maximum size of an SI section
157 #define MAX_PMT_TS (MAX_SECTION_SIZE / TS_SIZE + 1)
239 int SectionLength(
const uchar *Data,
int Length) {
return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; }
255 bool GetVersions(
int &PatVersion,
int &PmtVersion)
const;
343 void TsDump(
const char *Name,
const u_char *Data,
int Length);
344 void PesDump(
const char *Name,
const u_char *Data,
int Length);
348 #define MIN_TS_PACKETS_FOR_FRAME_DETECTOR 5
371 int SkipPackets(
const uchar *&Data,
int &Length,
int &Processed,
int &FrameTypeOffset);
377 void SetPid(
int Pid,
int Type);