Merge branch 'bug_537_vobsub' into experimental
[vuplus_dvbapp] / lib / dvb / dvb.cpp
index 21ebecf..414ab8d 100644 (file)
@@ -1752,16 +1752,8 @@ RESULT eDVBChannel::getCurrentFrontendParameters(ePtr<iDVBFrontendParameters> &p
 
 RESULT eDVBChannel::playFile(const char *file)
 {
-       ASSERT(!m_frontend);
-       if (m_pvr_thread)
-       {
-               m_pvr_thread->stop();
-               delete m_pvr_thread;
-               m_pvr_thread = 0;
-       }
-
        eRawFile *f = new eRawFile();
-       ePtr<iDataSource> source = f;
+       ePtr<iTsSource> source = f;
 
        if (f->open(file) < 0)
        {
@@ -1772,9 +1764,23 @@ RESULT eDVBChannel::playFile(const char *file)
        return playSource(source, file);
 }
 
-RESULT eDVBChannel::playSource(ePtr<iDataSource> &source, const char *priv)
+RESULT eDVBChannel::playSource(ePtr<iTsSource> &source, const char *streaminfo_file)
 {
-       m_tstools.setSource(source, priv);
+       ASSERT(!m_frontend);
+       if (m_pvr_thread)
+       {
+               m_pvr_thread->stop();
+               delete m_pvr_thread;
+               m_pvr_thread = 0;
+       }
+
+       if (!source->valid())
+       {
+               eDebug("PVR source is not valid!");
+               return -ENOENT;
+       }
+
+       m_tstools.setSource(source, streaminfo_file);
 
                /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST,
                   THEN DO A REAL FIX HERE! */
@@ -1820,6 +1826,8 @@ void eDVBChannel::stopSource()
        }
        if (m_pvr_fd_dst >= 0)
                ::close(m_pvr_fd_dst);
+       ePtr<iTsSource> d;
+       m_tstools.setSource(d);
 }
 
 void eDVBChannel::stopFile()