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;
}
}
+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)
*/
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();