diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-02-27 03:06:55 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-02-27 03:06:55 +0000 |
| commit | aa3fdc5321e50af5b79085a0942e9b5cf2d82e30 (patch) | |
| tree | 5e2f3927f49601856ce55c4ea6386dbd969b93c6 | |
| parent | aee1fdd37eadd70de2af1b299af87e238b4ac388 (diff) | |
| download | enigma2-aa3fdc5321e50af5b79085a0942e9b5cf2d82e30.tar.gz enigma2-aa3fdc5321e50af5b79085a0942e9b5cf2d82e30.zip | |
add getOffset and fix pvrparse for that
| -rw-r--r-- | lib/dvb/pvrparse.cpp | 4 | ||||
| -rw-r--r-- | lib/dvb/tstools.cpp | 19 | ||||
| -rw-r--r-- | lib/dvb/tstools.h | 3 |
3 files changed, 23 insertions, 3 deletions
diff --git a/lib/dvb/pvrparse.cpp b/lib/dvb/pvrparse.cpp index 58b215ba..bde43765 100644 --- a/lib/dvb/pvrparse.cpp +++ b/lib/dvb/pvrparse.cpp @@ -208,9 +208,7 @@ off_t eMPEGStreamInformation::getAccessPoint(pts_t ts) off_t last = 0; for (std::map<off_t, pts_t>::const_iterator i(m_access_points.begin()); i != m_access_points.end(); ++i) { - std::map<off_t, pts_t>::const_iterator d = m_timestamp_deltas.find(i->first); - if (d != m_timestamp_deltas.end()) - delta = d->second; + pts_t delta = getDelta(i->first); pts_t c = i->second - delta; if (c > ts) break; diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 51cc994c..e440aeca 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -172,6 +172,25 @@ int eDVBTSTools::fixupPTS(const off_t &offset, pts_t &now) } } +int eDVBTSTools::getOffset(off_t &offset, pts_t &pts) +{ + if (m_use_streaminfo) + { + offset = m_streaminfo.getAccessPoint(pts); + return 0; + } else + { + int bitrate = calcBitrate(); /* in bits/s */ + if (bitrate <= 0) + return -1; + + offset = (pts * (pts_t)bitrate) / 8ULL / 90000ULL; + offset -= offset % 188; + + return 0; + } +} + void eDVBTSTools::calcBegin() { if (m_fd < 0) diff --git a/lib/dvb/tstools.h b/lib/dvb/tstools.h index 723207d3..f23d8108 100644 --- a/lib/dvb/tstools.h +++ b/lib/dvb/tstools.h @@ -38,6 +38,9 @@ public: */ int fixupPTS(const off_t &offset, pts_t &pts); + /* get (approximate) offset corresponding to PTS */ + int getOffset(off_t &offset, pts_t &pts); + void calcBegin(); void calcEnd(); |
