aboutsummaryrefslogtreecommitdiff
path: root/lib/service/servicedvb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/service/servicedvb.cpp')
-rw-r--r--lib/service/servicedvb.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 90195d9b..dcd7017c 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -536,14 +536,25 @@ int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref)
eDVBTSTools tstools;
+ struct stat s;
+ stat(ref.path.c_str(), &s);
+
if (tstools.openFile(ref.path.c_str()))
return 0;
+ /* check if cached data is still valid */
+ if (m_parser.m_data_ok && (s.st_size == m_parser.m_filesize) && (m_parser.m_length))
+ return m_parser.m_length / 90000;
+
+ /* otherwise, re-calc length and update meta file */
pts_t len;
if (tstools.calcLen(len))
return 0;
- return len / 90000;
+ m_parser.m_length = len;
+ m_parser.m_filesize = s.st_size;
+ m_parser.updateMeta(ref.path);
+ return m_parser.m_length / 90000;
}
int eStaticServiceDVBPVRInformation::getInfo(const eServiceReference &ref, int w)