diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-08-16 01:02:55 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-08-16 01:02:55 +0000 |
| commit | fe813cde98c0c550137b47dd7a75ec2d4d9e6f34 (patch) | |
| tree | 6aac164b9b49a35bb2c3eff0e61a305118fcab42 /lib/service | |
| parent | 4fcbd4dd4bee8c65b46b7185879c445beae6ca29 (diff) | |
| download | enigma2-fe813cde98c0c550137b47dd7a75ec2d4d9e6f34.tar.gz enigma2-fe813cde98c0c550137b47dd7a75ec2d4d9e6f34.zip | |
- add getLength() call to iStaticServiceInformation
- implementation for dvb pvr streams using tstools
- start of implementing status information for PVR
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 5 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 25 | ||||
| -rw-r--r-- | lib/service/servicedvb.h | 2 | ||||
| -rw-r--r-- | lib/service/servicefs.cpp | 1 | ||||
| -rw-r--r-- | lib/service/servicemp3.cpp | 5 | ||||
| -rw-r--r-- | lib/service/servicemp3.h | 1 |
6 files changed, 38 insertions, 1 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 7e24f9c1..61695a91 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -134,6 +134,8 @@ public: } }; +typedef unsigned long long pts_t; + /* the reason we have the servicereference as additional argument is that we don't have to create one object for every entry in a possibly large list, provided that no state information is nessesary to deliver @@ -143,6 +145,9 @@ class iStaticServiceInformation: public iObject { public: virtual RESULT getName(const eServiceReference &ref, std::string &name)=0; + + // doesn't need to be implemented, should return -1 then. + virtual int getLength(const eServiceReference &ref)=0; // FOR SWIG std::string getName(const eServiceReference &ref) { std::string temp; getName(ref, temp); return temp; } 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 <lib/service/servicedvbrecord.h> #include <lib/dvb/metaparser.h> +#include <lib/dvb/tstools.h> 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<eDVBService> &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 diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 5c750430..78444158 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -57,6 +57,8 @@ private: void serviceEvent(int event); Signal2<void,iPlayableService*,int> m_event; + + int m_is_pvr; public: virtual ~eDVBServicePlay(); diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index b0d53922..67b99c08 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -18,6 +18,7 @@ class eStaticServiceFSInformation: public iStaticServiceInformation DECLARE_REF(eStaticServiceFSInformation); public: RESULT getName(const eServiceReference &ref, std::string &name); + int getLength(const eServiceReference &ref) { return -1; } }; DEFINE_REF(eStaticServiceFSInformation); diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 21c6cba0..f550afc0 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -79,6 +79,11 @@ RESULT eStaticServiceMP3Info::getName(const eServiceReference &ref, std::string return 0; } +int eStaticServiceMP3Info::getLength(const eServiceReference &ref) +{ + return -1; +} + // eServiceMP3 void eServiceMP3::test_end() diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 12ad7706..d46f6bd7 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -29,6 +29,7 @@ class eStaticServiceMP3Info: public iStaticServiceInformation eStaticServiceMP3Info(); public: RESULT getName(const eServiceReference &ref, std::string &name); + int getLength(const eServiceReference &ref); }; class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object |
