+int eDVBTSTools::fixupPTS(const off_t &offset, pts_t &now)
+{
+ if (m_use_streaminfo)
+ {
+ eDebug("streaminfo fixup, before %08llx", now);
+ int r = m_streaminfo.fixupPTS(offset, now);
+ eDebug("streaminfo fixup, after %08llx", now);
+ return r;
+ } else
+ {
+ /* for the simple case, we assume one epoch, with up to one wrap around in the middle. */
+ calcBegin();
+ off_t begin = 0;
+ pts_t pos;
+ if (getPTS(begin, pos))
+ return -1;
+ if ((now < pos) && ((pos - now) < 90000 * 10))
+ {
+ pos = 0;
+ return 0;
+ }
+ if (now < pos) /* wrap around */
+ pos = now + 0x200000000LL - pos;
+ else
+ pos = now - pos;
+ return 0;
+ }
+}
+