From fe813cde98c0c550137b47dd7a75ec2d4d9e6f34 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Tue, 16 Aug 2005 01:02:55 +0000 Subject: - add getLength() call to iStaticServiceInformation - implementation for dvb pvr streams using tstools - start of implementing status information for PVR --- lib/service/servicedvb.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'lib/service/servicedvb.cpp') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 5618477c..955ceb0a 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -11,6 +11,7 @@ #include #include +#include class eStaticServiceDVBPVRInformation: public iStaticServiceInformation { @@ -20,6 +21,7 @@ class eStaticServiceDVBPVRInformation: public iStaticServiceInformation public: eStaticServiceDVBPVRInformation(const eServiceReference &ref); RESULT getName(const eServiceReference &ref, std::string &name); + int getLength(const eServiceReference &ref); }; DEFINE_REF(eStaticServiceDVBPVRInformation); @@ -36,6 +38,22 @@ RESULT eStaticServiceDVBPVRInformation::getName(const eServiceReference &ref, st name = m_parser.m_name.size() ? m_parser.m_name : ref.path; } +int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref) +{ + ASSERT(ref == m_ref); + + eDVBTSTools tstools; + + if (tstools.openFile(ref.path.c_str())) + return 0; + + pts_t len; + if (tstools.calcLen(len)) + return 0; + + return len / 90000; +} + DEFINE_REF(eServiceFactoryDVB) eServiceFactoryDVB::eServiceFactoryDVB() @@ -185,6 +203,8 @@ RESULT eServiceFactoryDVB::lookupService(ePtr &service, const eServ eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): m_reference(ref), m_dvb_service(service) { + m_is_pvr = !ref.path.empty(); + CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent); CONNECT(m_event_handler.m_eit_changed, eDVBServicePlay::gotNewEvent); eDebug("DVB start (play)"); @@ -285,7 +305,10 @@ void eDVBServicePlay::serviceEvent(int event) { m_decoder->setVideoPID(vpid); m_decoder->setAudioPID(apid, 0); - m_decoder->setSyncPCR(pcrpid); + if (m_is_pvr) + m_decoder->setSyncPCR(pcrpid); + else + m_decoder->setSyncPCR(-1); m_decoder->start(); // how we can do this better? // update cache pid when the user changed the audio track or video track -- cgit v1.2.3