+int eDVBTSTools::fixupPTS(const off_t &offset, pts_t &now)
+{
+ if (m_use_streaminfo)
+ {
+ return m_streaminfo.fixupPTS(offset, now);
+ } else
+ {
+ /* for the simple case, we assume one epoch, with up to one wrap around in the middle. */
+ calcBegin();
+ if (!m_begin_valid)
+ {
+ eDebug("begin not valid, can't fixup");
+ return -1;
+ }
+
+ pts_t pos = m_pts_begin;
+ if ((now < pos) && ((pos - now) < 90000 * 10))
+ {
+ pos = 0;
+ return 0;
+ }
+
+ if (now < pos) /* wrap around */
+ now = now + 0x200000000LL - pos;
+ else
+ now -= pos;
+ return 0;
+ }
+}
+