1 #ifndef __include_lib_dvb_pvrparse_h
2 #define __include_lib_dvb_pvrparse_h
7 /* This module parses TS data and collects valuable information */
8 /* about it, like PTS<->offset correlations and sequence starts. */
10 /* At first, we define the collector class: */
11 class eMPEGStreamInformation
14 typedef unsigned long long Timestamp
;
15 typedef unsigned long long off_t
;
16 /* we order by off_t here, since the timestamp may */
18 /* we only record sequence start's pts values here. */
19 std::map
<off_t
, Timestamp
> accessPoints
;
20 /* timestampDelta is in fact the difference between */
21 /* the PTS in the stream and a real PTS from 0..max */
22 std::map
<off_t
, Timestamp
> timestampDeltas
;
24 int save(const char *filename
);
25 int load(const char *filename
);
27 /* recalculates timestampDeltas */
28 void fixupDiscontinuties();
30 /* get delta at specific offset */
31 Timestamp
getDelta(off_t offset
);
33 /* inter/extrapolate timestamp from offset */
34 Timestamp
getInterpolated(off_t offset
);
36 off_t
getAccessPoint(Timestamp ts
);
41 /* Now we define the parser's state: */
42 class eMPEGStreamParserTS
44 eMPEGStreamInformation
&streaminfo
;
45 unsigned char pkt
[188];
47 int processPacket(const unsigned char *pkt
, eMPEGStreamInformation::off_t offset
);
48 inline int wantPacket(const unsigned char *hdr
) const;
53 eMPEGStreamParserTS(eMPEGStreamInformation
&streaminfo
);
54 void parseData(eMPEGStreamInformation::off_t offset
, const void *data
, unsigned int len
);