add getNextAccessPoint
[enigma2.git] / lib / dvb / tstools.cpp
index 51cc994c560758c9b4480e34423e6e48798b643c..b6792c65c48c9e243a370d5bcc019f435b6559b2 100644 (file)
@@ -172,6 +172,36 @@ 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;
+       }
+}
+
+int eDVBTSTools::getNextAccessPoint(pts_t &ts, const pts_t &start, int direction)
+{
+       if (m_use_streaminfo)
+               return m_streaminfo.getNextAccessPoint(ts, start, direction);
+       else
+       {
+               eDebug("can't get next access point without streaminfo");
+               return -1;
+       }
+}
+
 void eDVBTSTools::calcBegin()
 {
        if (m_fd < 0)