dvb/tstools.cpp: fix openFile without streaminfo
[vuplus_dvbapp] / lib / dvb / tstools.cpp
index c7d9a41..1403059 100644 (file)
@@ -35,17 +35,17 @@ eDVBTSTools::~eDVBTSTools()
 int eDVBTSTools::openFile(const char *filename, int nostreaminfo)
 {
        eRawFile *f = new eRawFile();
-       ePtr<iDataSource> src = f;
+       ePtr<iTsSource> src = f;
 
        if (f->open(filename, 1) < 0)
                return -1;
 
-       setSource(src, filename);
+       setSource(src, nostreaminfo ? NULL : filename);
 
        return 0;
 }
 
-void eDVBTSTools::setSource(ePtr<iDataSource> &source, const char *stream_info_filename)
+void eDVBTSTools::setSource(ePtr<iTsSource> &source, const char *stream_info_filename)
 {
        closeFile();
 
@@ -91,7 +91,7 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed)
                if (!m_streaminfo.getPTS(offset, pts))
                        return 0;
        
-       if (!m_source->valid())
+       if (!m_source || !m_source->valid())
                return -1;
 
        offset -= offset % 188;
@@ -411,7 +411,7 @@ int eDVBTSTools::getNextAccessPoint(pts_t &ts, const pts_t &start, int direction
 
 void eDVBTSTools::calcBegin()
 {
-       if (!m_source->valid())
+       if (!m_source || !m_source->valid())
                return;
 
        if (!(m_begin_valid || m_futile))
@@ -426,7 +426,7 @@ void eDVBTSTools::calcBegin()
 
 void eDVBTSTools::calcEnd()
 {
-       if (!m_source->valid())
+       if (!m_source || !m_source->valid())
                return;
 
        off_t end = m_source->lseek(0, SEEK_END);
@@ -579,7 +579,7 @@ int eDVBTSTools::takeSample(off_t off, pts_t &p)
 int eDVBTSTools::findPMT(int &pmt_pid, int &service_id)
 {
                /* FIXME: this will be factored out soon! */
-       if (!m_source->valid())
+       if (!m_source || !m_source->valid())
        {
                eDebug(" file not valid");
                return -1;