1 #ifndef __lib_dvb_tstools_h
2 #define __lib_dvb_tstools_h
5 #include <lib/dvb/pvrparse.h>
6 #include <lib/base/rawfile.h>
9 * Note: we're interested in PTS values, not STC values.
10 * thus we're evaluating PES headers, not adaption fields.
13 typedef long long pts_t;
21 int openFile(const char *filename);
24 void setSyncPID(int pid);
25 void setSearchRange(int maxrange);
27 /* get first PTS *after* the given offset. */
28 /* pts values are zero-based. */
29 int getPTS(off_t &offset, pts_t &pts, int fixed=0);
31 /* this fixes up PTS to end up in a [0..len) range.
32 discontinuities etc. are handled here.
35 offset - approximate offset in file to resolve ambiguities
36 pts - video-pts (i.e. current STC of video decoder)
38 pts - zero-based PTS value
40 int fixupPTS(const off_t &offset, pts_t &pts);
42 /* get (approximate) offset corresponding to PTS */
43 int getOffset(off_t &offset, pts_t &pts);
45 int getNextAccessPoint(pts_t &ts, const pts_t &start, int direction);
50 int calcLen(pts_t &len);
52 int calcBitrate(); /* in bits/sec */
56 int findPMT(int &pmt_pid, int &service_id);
63 int m_begin_valid, m_end_valid;
64 pts_t m_pts_begin, m_pts_end;
65 off_t m_offset_begin, m_offset_end;
67 /* for simple linear interpolation */
68 std::map<pts_t, off_t> m_samples;
71 eMPEGStreamInformation m_streaminfo;
73 off_t m_last_filelength;