add new playSource / stopSource interface to iDVBChannel and eDVBChannel
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 10 Nov 2010 16:15:15 +0000 (17:15 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 10 Nov 2010 16:15:15 +0000 (17:15 +0100)
lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/idvb.h

index 1807b87..21ebecf 100644 (file)
@@ -1761,14 +1761,20 @@ RESULT eDVBChannel::playFile(const char *file)
        }
 
        eRawFile *f = new eRawFile();
+       ePtr<iDataSource> source = f;
+
        if (f->open(file) < 0)
        {
                eDebug("can't open PVR file %s (%m)", file);
                return -ENOENT;
        }
 
-       ePtr<iDataSource> source = f;
-       m_tstools.setSource(source, file);
+       return playSource(source, file);
+}
+
+RESULT eDVBChannel::playSource(ePtr<iDataSource> &source, const char *priv)
+{
+       m_tstools.setSource(source, priv);
 
                /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST,
                   THEN DO A REAL FIX HERE! */
@@ -1804,7 +1810,7 @@ RESULT eDVBChannel::playFile(const char *file)
        return 0;
 }
 
-void eDVBChannel::stopFile()
+void eDVBChannel::stopSource()
 {
        if (m_pvr_thread)
        {
@@ -1816,6 +1822,11 @@ void eDVBChannel::stopFile()
                ::close(m_pvr_fd_dst);
 }
 
+void eDVBChannel::stopFile()
+{
+       stopSource();
+}
+
 void eDVBChannel::setCueSheet(eCueSheet *cuesheet)
 {
        m_conn_cueSheetEvent = 0;
index fb92580..9277160 100644 (file)
@@ -259,7 +259,10 @@ public:
                /* iDVBPVRChannel */
        RESULT playFile(const char *file);
        void stopFile();
-       
+
+       RESULT playSource(ePtr<iDataSource>& source, const char *priv=NULL);
+       void stopSource();
+
        void setCueSheet(eCueSheet *cuesheet);
        
        RESULT getLength(pts_t &len);
@@ -301,7 +304,7 @@ private:
        std::list<std::pair<off_t, off_t> > m_source_span;
        void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size);
        void flushPVR(iDVBDemux *decoding_demux=0);
-       
+
        eSingleLock m_cuesheet_lock;
 
        friend class eUsePtr<eDVBChannel>;
index f1217a6..3996b6b 100644 (file)
@@ -15,6 +15,7 @@
 #include <lib/base/object.h>
 #include <lib/base/ebase.h>
 #include <lib/base/elock.h>
+#include <lib/base/idatasource.h>
 #include <lib/service/service.h>
 #include <libsig_comp.h>
 #include <connection.h>
@@ -605,6 +606,10 @@ public:
        virtual RESULT playFile(const char *file) = 0;
        virtual void stopFile() = 0;
        
+       /* new interface */
+       virtual RESULT playSource(ePtr<iDataSource> &source, const char *priv=NULL) = 0;
+       virtual void stopSource() = 0;
+       
        virtual void setCueSheet(eCueSheet *cuesheet) = 0;
        
        virtual RESULT getLength(pts_t &pts) = 0;