add SeekRelative stuff
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 13 Nov 2005 04:31:21 +0000 (04:31 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 13 Nov 2005 04:31:21 +0000 (04:31 +0000)
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h

index f9a2672..15631fd 100644 (file)
@@ -207,6 +207,8 @@ class iSeekableService: public iObject
 public:
        virtual RESULT getLength(pts_t &SWIG_OUTPUT)=0;
        virtual RESULT seekTo(pts_t to)=0;
+       enum { dirForward = +1, dirBackward = -1 };
+       virtual RESULT seekRelative(int direction, pts_t to)=0;
        virtual RESULT getPlayPosition(pts_t &SWIG_OUTPUT)=0;
 };
 
@@ -290,6 +292,8 @@ public:
                // TODO: additional stuff, like a conversion interface?
 };
 
+TEMPLATE_TYPEDEF(ePtr<iServiceOfflineOperations>, iServiceOfflineOperationsPtr);
+
 class iServiceHandler: public iObject
 {
 public:
index f3215d8..76b0089 100644 (file)
@@ -173,11 +173,10 @@ RESULT eDVBPVRServiceOfflineOperations::getListOfFilenames(std::list<std::string
 {
        res.clear();
        res.push_back(m_ref.path);
+       res.push_back(m_ref.path + ".meta");
        return 0;
 }
 
-
-
 DEFINE_REF(eServiceFactoryDVB)
 
 eServiceFactoryDVB::eServiceFactoryDVB()
@@ -227,7 +226,7 @@ RESULT eDVBServiceList::startQuery()
        
        ePtr<eDVBChannelQuery> q;
        
-       if (m_parent.path.size())
+       if (!m_parent.path.empty())
        {
                eDVBChannelQuery::compile(q, m_parent.path);
                if (!q)
@@ -284,8 +283,15 @@ RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableServ
 
 RESULT eServiceFactoryDVB::record(const eServiceReference &ref, ePtr<iRecordableService> &ptr)
 {
-       ptr = new eDVBServiceRecord((eServiceReferenceDVB&)ref);
-       return 0;
+       if (ref.path.empty())
+       {
+               ptr = new eDVBServiceRecord((eServiceReferenceDVB&)ref);
+               return 0;
+       } else
+       {
+               ptr = 0;
+               return -1;
+       }
 }
 
 RESULT eServiceFactoryDVB::list(const eServiceReference &ref, ePtr<iListableService> &ptr)
@@ -309,7 +315,7 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic
                ptr = new eStaticServiceDVBBouquetInformation;
                return 0;
        }
-       else if (ref.path.size())
+       else if (!ref.path.empty())
        {
                ptr = new eStaticServiceDVBPVRInformation(ref);
                return 0;
@@ -327,10 +333,17 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic
        }
 }
 
-RESULT eServiceFactoryDVB::offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr)
+RESULT eServiceFactoryDVB::offlineOperations(const eServiceReference &ref, ePtr<iServiceOfflineOperations> &ptr)
 {
-       ptr = 0;
-       return -1;
+       if (ref.path.empty())
+       {
+               ptr = 0;
+               return -1;
+       } else
+       {
+               ptr = new eDVBPVRServiceOfflineOperations(ref);
+               return 0;
+       }
 }
 
 RESULT eServiceFactoryDVB::lookupService(ePtr<eDVBService> &service, const eServiceReference &ref)
@@ -578,6 +591,18 @@ RESULT eDVBServicePlay::seekTo(pts_t to)
        return -1;
 }
 
+RESULT eDVBServicePlay::seekRelative(int direction, pts_t to)
+{
+       eDebug("eDVBServicePlay::seekRelative: jump %d, %lld", direction, to);
+
+       ePtr<iDVBPVRChannel> pvr_channel;
+       
+       if (m_service_handler.getPVRChannel(pvr_channel))
+               return -1;
+       
+       return pvr_channel->seekToPosition(SEEK_CUR, to);
+}
+
 RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
 {
        ePtr<iDVBPVRChannel> pvr_channel;
index f47c390..9ebd277 100644 (file)
@@ -62,6 +62,7 @@ public:
                // iSeekableService
        RESULT getLength(pts_t &len);
        RESULT seekTo(pts_t to);
+       RESULT seekRelative(int direction, pts_t to);
        RESULT getPlayPosition(pts_t &pos);
 
                // iServiceInformation