aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/tstools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dvb/tstools.cpp')
-rw-r--r--lib/dvb/tstools.cpp19
1 files changed, 19 insertions, 0 deletions
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)