diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-08-17 02:16:32 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-08-17 02:16:32 +0000 |
| commit | 0af11516cabc973907890f548925a66313c8d18c (patch) | |
| tree | c31b0f76274fbc23d24f0b0188c54282b96442bc /lib/service | |
| parent | 17647e30993cc20d8f94f2de4a0bc78ce6b593cb (diff) | |
| download | enigma2-0af11516cabc973907890f548925a66313c8d18c.tar.gz enigma2-0af11516cabc973907890f548925a66313c8d18c.zip | |
- add iSeekableService, implement it for serviceDvb
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 12 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 54 | ||||
| -rw-r--r-- | lib/service/servicedvb.h | 8 | ||||
| -rw-r--r-- | lib/service/servicemp3.cpp | 1 | ||||
| -rw-r--r-- | lib/service/servicemp3.h | 1 |
5 files changed, 71 insertions, 5 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 61695a91..4a19378c 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -1,6 +1,7 @@ #ifndef __lib_dvb_iservice_h #define __lib_dvb_iservice_h +#include <lib/python/swig.h> #include <lib/base/object.h> #include <string> #include <connection.h> @@ -177,6 +178,16 @@ public: TEMPLATE_TYPEDEF(ePtr<iPauseableService>, iPauseableServicePtr); +class iSeekableService: public iObject +{ +public: + virtual RESULT getLength(pts_t &SWIG_OUTPUT)=0; + virtual RESULT seekTo(pts_t to)=0; + virtual RESULT getPlayPosition(pts_t &SWIG_OUTPUT)=0; +}; + +TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr); + class iPlayableService: public iObject { friend class iServiceHandler; @@ -192,6 +203,7 @@ public: virtual RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)=0; virtual RESULT start()=0; virtual RESULT stop()=0; + virtual RESULT seek(ePtr<iSeekableService> &ptr)=0; virtual RESULT pause(ePtr<iPauseableService> &ptr)=0; virtual RESULT info(ePtr<iServiceInformation> &ptr)=0; }; diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 955ceb0a..ac224562 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -313,9 +313,14 @@ void eDVBServicePlay::serviceEvent(int event) // how we can do this better? // update cache pid when the user changed the audio track or video track // TODO handling of difference audio types.. default audio types.. - m_dvb_service->setCachePID(eDVBService::cVPID, vpid); - m_dvb_service->setCachePID(eDVBService::cAPID, apid); - m_dvb_service->setCachePID(eDVBService::cPCRPID, pcrpid); + + /* don't worry about non-existing services, nor pvr services */ + if (m_dvb_service && !m_is_pvr) + { + m_dvb_service->setCachePID(eDVBService::cVPID, vpid); + m_dvb_service->setCachePID(eDVBService::cAPID, apid); + m_dvb_service->setCachePID(eDVBService::cPCRPID, pcrpid); + } } break; @@ -325,9 +330,10 @@ void eDVBServicePlay::serviceEvent(int event) RESULT eDVBServicePlay::start() { + int r; eDebug("starting DVB service"); + r = m_service_handler.tune((eServiceReferenceDVB&)m_reference); m_event(this, evStart); - return m_service_handler.tune((eServiceReferenceDVB&)m_reference); } RESULT eDVBServicePlay::stop() @@ -349,6 +355,46 @@ RESULT eDVBServicePlay::pause(ePtr<iPauseableService> &ptr) return -1; } +RESULT eDVBServicePlay::seek(ePtr<iSeekableService> &ptr) +{ + if (m_is_pvr) + { + ptr = this; + return 0; + } + + ptr = 0; + return -1; +} + +RESULT eDVBServicePlay::getLength(pts_t &len) +{ + ePtr<iDVBPVRChannel> pvr_channel; + + if (m_service_handler.getPVRChannel(pvr_channel)) + { + eDebug("getPVRChannel failed!"); + return -1; + } + + return pvr_channel->getLength(len); +} + +RESULT eDVBServicePlay::seekTo(pts_t to) +{ + return -1; +} + +RESULT eDVBServicePlay::getPlayPosition(pts_t &pos) +{ + ePtr<iDVBPVRChannel> pvr_channel; + + if (m_service_handler.getPVRChannel(pvr_channel)) + return -1; + + return pvr_channel->getCurrentPosition(pos); +} + RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr) { ptr = this; diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 78444158..1dd66e40 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -37,7 +37,7 @@ public: RESULT getNext(eServiceReference &ptr); }; -class eDVBServicePlay: public iPlayableService, public Object, public iServiceInformation +class eDVBServicePlay: public iPlayableService, iSeekableService, public Object, public iServiceInformation { DECLARE_REF(eDVBServicePlay); private: @@ -66,9 +66,15 @@ public: RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection); RESULT start(); RESULT stop(); + RESULT seek(ePtr<iSeekableService> &ptr); RESULT pause(ePtr<iPauseableService> &ptr); RESULT info(ePtr<iServiceInformation> &ptr); + // iSeekableService + RESULT getLength(pts_t &len); + RESULT seekTo(pts_t to); + RESULT getPlayPosition(pts_t &pos); + // iServiceInformation RESULT getName(std::string &name); RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext); diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index f550afc0..549a288a 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -140,6 +140,7 @@ RESULT eServiceMP3::stop() } RESULT eServiceMP3::pause(ePtr<iPauseableService> &ptr) { ptr=this; return 0; } +RESULT eServiceMP3::seek(ePtr<iSeekableService> &ptr) { ptr = 0; return -1; } // iPausableService RESULT eServiceMP3::pause() { printf("mp3 pauses!\n"); return 0; } diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index d46f6bd7..92117857 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -55,6 +55,7 @@ public: RESULT start(); RESULT stop(); RESULT pause(ePtr<iPauseableService> &ptr); + RESULT seek(ePtr<iSeekableService> &ptr); // iPausableService RESULT pause(); |
