From 2f085dd58effc19da8e5fec68bb5d73b0b64eb3f Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:31:05 +0100 Subject: dvb.cpp: migrate to iDataSource, use shared iDataSource for tstools and filepush thread --- lib/dvb/dvb.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 51629452..1807b87e 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1760,7 +1760,15 @@ RESULT eDVBChannel::playFile(const char *file) m_pvr_thread = 0; } - m_tstools.openFile(file); + eRawFile *f = new eRawFile(); + if (f->open(file) < 0) + { + eDebug("can't open PVR file %s (%m)", file); + return -ENOENT; + } + + ePtr source = f; + m_tstools.setSource(source, file); /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST, THEN DO A REAL FIX HERE! */ @@ -1787,15 +1795,7 @@ RESULT eDVBChannel::playFile(const char *file) m_event(this, evtPreStart); - if (m_pvr_thread->start(file, m_pvr_fd_dst)) - { - delete m_pvr_thread; - m_pvr_thread = 0; - ::close(m_pvr_fd_dst); - m_pvr_fd_dst = -1; - eDebug("can't open PVR file %s (%m)", file); - return -ENOENT; - } + m_pvr_thread->start(source, m_pvr_fd_dst); CONNECT(m_pvr_thread->m_event, eDVBChannel::pvrEvent); m_state = state_ok; -- cgit v1.2.3 From 6fdb2d2094c50a2bc324f4094473c2107d2ea943 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:15:15 +0100 Subject: add new playSource / stopSource interface to iDVBChannel and eDVBChannel --- lib/dvb/dvb.cpp | 17 ++++++++++++++--- lib/dvb/dvb.h | 7 +++++-- lib/dvb/idvb.h | 5 +++++ 3 files changed, 24 insertions(+), 5 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 1807b87e..21ebecf1 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1761,14 +1761,20 @@ RESULT eDVBChannel::playFile(const char *file) } eRawFile *f = new eRawFile(); + ePtr source = f; + if (f->open(file) < 0) { eDebug("can't open PVR file %s (%m)", file); return -ENOENT; } - ePtr source = f; - m_tstools.setSource(source, file); + return playSource(source, file); +} + +RESULT eDVBChannel::playSource(ePtr &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; diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index fb925807..92771604 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -259,7 +259,10 @@ public: /* iDVBPVRChannel */ RESULT playFile(const char *file); void stopFile(); - + + RESULT playSource(ePtr& source, const char *priv=NULL); + void stopSource(); + void setCueSheet(eCueSheet *cuesheet); RESULT getLength(pts_t &len); @@ -301,7 +304,7 @@ private: std::list > 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; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index f1217a6a..3996b6b6 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -605,6 +606,10 @@ public: virtual RESULT playFile(const char *file) = 0; virtual void stopFile() = 0; + /* new interface */ + virtual RESULT playSource(ePtr &source, const char *priv=NULL) = 0; + virtual void stopSource() = 0; + virtual void setCueSheet(eCueSheet *cuesheet) = 0; virtual RESULT getLength(pts_t &pts) = 0; -- cgit v1.2.3 From 7d044888ef99903c5cb880cc5a83d03336726ea2 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 18:18:32 +0100 Subject: dvb.cpp: small fix for playSource --- lib/dvb/dvb.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 21ebecf1..640f327c 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1752,14 +1752,6 @@ RESULT eDVBChannel::getCurrentFrontendParameters(ePtr &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 source = f; @@ -1774,6 +1766,14 @@ RESULT eDVBChannel::playFile(const char *file) RESULT eDVBChannel::playSource(ePtr &source, const char *priv) { + ASSERT(!m_frontend); + if (m_pvr_thread) + { + m_pvr_thread->stop(); + delete m_pvr_thread; + m_pvr_thread = 0; + } + m_tstools.setSource(source, priv); /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST, -- cgit v1.2.3 From 961f33b8fa7a02154a5da9504ca0056990b424bd Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 20:29:15 +0100 Subject: eDVBChannel: invalidate iDataSource in stopSource call --- lib/dvb/dvb.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 640f327c..c980ac5a 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1764,7 +1764,7 @@ RESULT eDVBChannel::playFile(const char *file) return playSource(source, file); } -RESULT eDVBChannel::playSource(ePtr &source, const char *priv) +RESULT eDVBChannel::playSource(ePtr &source, const char *streaminfo_file) { ASSERT(!m_frontend); if (m_pvr_thread) @@ -1774,7 +1774,13 @@ RESULT eDVBChannel::playSource(ePtr &source, const char *priv) m_pvr_thread = 0; } - m_tstools.setSource(source, priv); + 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 d; + m_tstools.setSource(d); } void eDVBChannel::stopFile() -- cgit v1.2.3