From 593d7ac3a2a3c916eda486352bbcc25c4aede678 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:29:09 +0100 Subject: rawfile.h/cpp: add virtual baseclass for data sources (iDataSource) let eRawFile inherit from iDataSource --- lib/base/rawfile.cpp | 20 ++++++++++++++++++++ lib/base/rawfile.h | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/lib/base/rawfile.cpp b/lib/base/rawfile.cpp index c7e11feb..1552203a 100644 --- a/lib/base/rawfile.cpp +++ b/lib/base/rawfile.cpp @@ -4,7 +4,10 @@ #include #include +DEFINE_REF(eRawFile); + eRawFile::eRawFile() + :m_lock(true) { m_fd = -1; m_file = 0; @@ -232,3 +235,20 @@ off_t eRawFile::length() { return m_totallength; } + +off_t eRawFile::position() +{ + if (m_nrfiles < 2) + { + if (!m_cached) + return ::lseek(m_fd, 0, SEEK_CUR); + else + return ::fseeko(m_file, 0, SEEK_CUR); + } + return m_current_offset; +} + +eSingleLock &eRawFile::getLock() +{ + return m_lock; +} diff --git a/lib/base/rawfile.h b/lib/base/rawfile.h index a1c73d6a..bb39dc6e 100644 --- a/lib/base/rawfile.h +++ b/lib/base/rawfile.h @@ -2,24 +2,58 @@ #define __lib_base_rawfile_h #include +#include -class eRawFile +class iDataSource: public iObject { +public: + virtual off_t lseek(off_t offset, int whence)=0; + virtual ssize_t read(void *buf, size_t count)=0; /* NOTE: you must be able to handle short reads! */ + virtual off_t length()=0; + virtual off_t position()=0; + virtual int valid()=0; + virtual eSingleLock &getLock()=0; + virtual bool is_shared()=0; +}; + +class iDataSourcePositionRestorer +{ + ePtr &m_source; + off_t m_position; +public: + iDataSourcePositionRestorer(ePtr &source) + :m_source(source) + { + if (m_source->is_shared()) + m_position = m_source->position(); + } + ~iDataSourcePositionRestorer() + { + if (m_source->is_shared()) + m_source->lseek(m_position, SEEK_SET); + } +}; + +class eRawFile: public iDataSource +{ + DECLARE_REF(eRawFile); + eSingleLock m_lock; public: eRawFile(); ~eRawFile(); - int open(const char *filename, int cached = 0); void setfd(int fd); off_t lseek(off_t offset, int whence); int close(); ssize_t read(void *buf, size_t count); /* NOTE: you must be able to handle short reads! */ off_t length(); + off_t position(); int valid(); + eSingleLock &getLock(); + bool is_shared() { return ref.count > 1; } private: int m_fd; /* for uncached */ FILE *m_file; /* for cached */ - int m_cached; std::string m_basename; off_t m_splitsize, m_totallength, m_current_offset, m_base_offset, m_last_offset; -- cgit v1.2.3 From 2a0689a69ba995ec3adcf1cd6cc20146a6d4ef58 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:29:55 +0100 Subject: tstools.h/cpp: migrate to iDataSource --- lib/dvb/tstools.cpp | 83 +++++++++++++++++++++++++++++++++++------------------ lib/dvb/tstools.h | 8 ++++-- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index d5ad2494..7739f601 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -7,7 +7,6 @@ #include eDVBTSTools::eDVBTSTools() - :m_file_lock(true) { m_pid = -1; m_maxrange = 256*1024; @@ -23,19 +22,41 @@ eDVBTSTools::eDVBTSTools() m_futile = 0; } +void eDVBTSTools::closeSource() +{ + m_source = NULL; +} + eDVBTSTools::~eDVBTSTools() { - closeFile(); + closeSource(); } int eDVBTSTools::openFile(const char *filename, int nostreaminfo) +{ + eRawFile *f = new eRawFile(); + ePtr src = f; + + eSingleLocker l(f->getLock()); + + if (f->open(filename, 1) < 0) + return -1; + + setSource(src, filename); + + return 0; +} + +void eDVBTSTools::setSource(ePtr source, const char *stream_info_filename) { closeFile(); - - if (!nostreaminfo) + + m_source = source; + + if (stream_info_filename) { - eDebug("loading streaminfo for %s", filename); - m_streaminfo.load(filename); + eDebug("loading streaminfo for %s", stream_info_filename); + m_streaminfo.load(stream_info_filename); } if (!m_streaminfo.empty()) @@ -45,19 +66,16 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) // eDebug("no recorded stream information available"); m_use_streaminfo = 0; } - - m_samples_taken = 0; - eSingleLocker l(m_file_lock); - if (m_file.open(filename, 1) < 0) - return -1; - return 0; + m_samples_taken = 0; } void eDVBTSTools::closeFile() { - eSingleLocker l(m_file_lock); - m_file.close(); + if (m_source) { + eSingleLocker l(m_source->getLock()); + closeSource(); + } } void eDVBTSTools::setSyncPID(int pid) @@ -77,13 +95,16 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) if (!m_streaminfo.getPTS(offset, pts)) return 0; - if (!m_file.valid()) + if (!m_source->valid()) return -1; offset -= offset % 188; - eSingleLocker l(m_file_lock); - if (m_file.lseek(offset, SEEK_SET) < 0) + iDataSourcePositionRestorer r(m_source); + + eSingleLocker l(m_source->getLock()); + + if (m_source->lseek(offset, SEEK_SET) < 0) { eDebug("lseek failed"); return -1; @@ -94,7 +115,7 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) while (left >= 188) { unsigned char packet[188]; - if (m_file.read(packet, 188) != 188) + if (m_source->read(packet, 188) != 188) { eDebug("read error"); break; @@ -112,7 +133,7 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) break; ++i; } - offset = m_file.lseek(i - 188, SEEK_CUR); + offset = m_source->lseek(i - 188, SEEK_CUR); continue; } @@ -404,7 +425,7 @@ int eDVBTSTools::getNextAccessPoint(pts_t &ts, const pts_t &start, int direction void eDVBTSTools::calcBegin() { - if (!m_file.valid()) + if (!m_source->valid()) return; if (!(m_begin_valid || m_futile)) @@ -419,11 +440,14 @@ void eDVBTSTools::calcBegin() void eDVBTSTools::calcEnd() { - if (!m_file.valid()) + if (!m_source->valid()) return; - eSingleLocker l(m_file_lock); - off_t end = m_file.lseek(0, SEEK_END); + iDataSourcePositionRestorer r(m_source); + + eSingleLocker l(m_source->getLock()); + + off_t end = m_source->lseek(0, SEEK_END); if (llabs(end - m_last_filelength) > 1*1024*1024) { @@ -573,14 +597,17 @@ 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_file.valid()) + if (!m_source->valid()) { eDebug(" file not valid"); return -1; } - eSingleLocker l(m_file_lock); - if (m_file.lseek(0, SEEK_SET) < 0) + iDataSourcePositionRestorer r(m_source); + + eSingleLocker l(m_source->getLock()); + + if (m_source->lseek(0, SEEK_SET) < 0) { eDebug("seek failed"); return -1; @@ -591,7 +618,7 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) while (left >= 188) { unsigned char packet[188]; - if (m_file.read(packet, 188) != 188) + if (m_source->read(packet, 188) != 188) { eDebug("read error"); break; @@ -607,7 +634,7 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) break; ++i; } - m_file.lseek(i - 188, SEEK_CUR); + m_source->lseek(i - 188, SEEK_CUR); continue; } diff --git a/lib/dvb/tstools.h b/lib/dvb/tstools.h index ed8b9241..41312c4c 100644 --- a/lib/dvb/tstools.h +++ b/lib/dvb/tstools.h @@ -19,9 +19,12 @@ public: eDVBTSTools(); ~eDVBTSTools(); + void setSource(ePtr source, const char *streaminfo_filename=NULL); + void closeSource(); + int openFile(const char *filename, int nostreaminfo = 0); void closeFile(); - + void setSyncPID(int pid); void setSearchRange(int maxrange); @@ -77,8 +80,7 @@ private: int m_pid; int m_maxrange; - eSingleLock m_file_lock; - eRawFile m_file; + ePtr m_source; int m_begin_valid, m_end_valid; pts_t m_pts_begin, m_pts_end; -- cgit v1.2.3 From 6855a6ae6701f8d29540551fcff971316b5d49f1 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:30:14 +0100 Subject: filepush.h/cpp: migrate to iDataSource --- lib/base/filepush.cpp | 32 +++++++++++++++++++++----------- lib/base/filepush.h | 10 ++++++---- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index 91f24ba0..0d599f96 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -47,7 +47,7 @@ void eFilePushThread::thread() hasStarted(); - source_pos = m_raw_source.lseek(0, SEEK_CUR); + source_pos = m_raw_source->lseek(0, SEEK_CUR); /* m_stop must be evaluated after each syscall. */ while (!m_stop) @@ -141,7 +141,7 @@ void eFilePushThread::thread() ASSERT(!(current_span_remaining % m_blocksize)); if (source_pos != current_span_offset) - source_pos = m_raw_source.lseek(current_span_offset, SEEK_SET); + source_pos = m_raw_source->lseek(current_span_offset, SEEK_SET); bytes_read = 0; } @@ -159,7 +159,7 @@ void eFilePushThread::thread() m_buf_end = 0; if (maxread) - m_buf_end = m_raw_source.read(m_buffer, maxread); + m_buf_end = m_raw_source->read(m_buffer, maxread); if (m_buf_end < 0) { @@ -178,7 +178,7 @@ void eFilePushThread::thread() int d = m_buf_end % m_blocksize; if (d) { - m_raw_source.lseek(-d, SEEK_CUR); + m_raw_source->lseek(-d, SEEK_CUR); m_buf_end -= d; } @@ -218,7 +218,7 @@ void eFilePushThread::thread() } #if 0 eDebug("FILEPUSH: end-of-file! (currently unhandled)"); - if (!m_raw_source.lseek(0, SEEK_SET)) + if (!m_raw_source->lseek(0, SEEK_SET)) { eDebug("(looping)"); continue; @@ -239,20 +239,30 @@ void eFilePushThread::thread() eDebug("FILEPUSH THREAD STOP"); } -void eFilePushThread::start(int fd_source, int fd_dest) +void eFilePushThread::start(int fd, int fd_dest) { - m_raw_source.setfd(fd_source); + eRawFile *f = new eRawFile(); + f->setfd(fd); + m_raw_source = f; m_fd_dest = fd_dest; resume(); } -int eFilePushThread::start(const char *filename, int fd_dest) +int eFilePushThread::start(const char *file, int fd_dest) { - if (m_raw_source.open(filename) < 0) + eRawFile *f = new eRawFile(); + ePtr source = f; + if (f->open(file) < 0) return -1; + start(source, fd_dest); + return 0; +} + +void eFilePushThread::start(ePtr source, int fd_dest) +{ + m_raw_source = source; m_fd_dest = fd_dest; resume(); - return 0; } void eFilePushThread::stop() @@ -275,7 +285,7 @@ void eFilePushThread::pause() void eFilePushThread::seek(int whence, off_t where) { - m_raw_source.lseek(where, whence); + m_raw_source->lseek(where, whence); } void eFilePushThread::resume() diff --git a/lib/base/filepush.h b/lib/base/filepush.h index 71ee9979..75df7ab7 100644 --- a/lib/base/filepush.h +++ b/lib/base/filepush.h @@ -24,7 +24,9 @@ public: void stop(); void start(int sourcefd, int destfd); int start(const char *filename, int destfd); - + + void start(ePtr source, int destfd); + void pause(); void seek(int whence, off_t where); void resume(); @@ -58,10 +60,10 @@ private: int m_stream_mode; int m_blocksize; - eRawFile m_raw_source; - + ePtr m_raw_source; + eFixedMessagePump m_messagepump; - + void recvEvent(const int &evt); }; -- cgit v1.2.3 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(-) 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 b2e416ea9717c8f8e0143a90d823125e9b4a57b6 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:31:47 +0100 Subject: add addFactoryExtension/removeFactoryExtension to eServiceCenter --- lib/service/service.cpp | 19 +++++++++++++++++++ lib/service/service.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/lib/service/service.cpp b/lib/service/service.cpp index eb2757ab..8c674c5e 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -201,6 +201,25 @@ RESULT eServiceCenter::removeServiceFactory(int id) return 0; } +RESULT eServiceCenter::addFactoryExtension(int id, const char *extension) +{ + std::map >::iterator it = extensions.find(id); + if (it == extensions.end()) + return -1; + it->second.push_back(extension); + return 0; +} + +RESULT eServiceCenter::removeFactoryExtension(int id, const char *extension) +{ + std::map >::iterator it = extensions.find(id); + if (it == extensions.end()) + return -1; + it->second.remove(extension); + return 0; +} + + int eServiceCenter::getServiceTypeForExtension(const char *str) { for (std::map >::iterator sit(extensions.begin()); sit != extensions.end(); ++sit) diff --git a/lib/service/service.h b/lib/service/service.h index 6f6ab980..ffc7d275 100644 --- a/lib/service/service.h +++ b/lib/service/service.h @@ -40,6 +40,8 @@ public: static RESULT getPrivInstance(ePtr &ptr) { ptr = instance; return 0; } RESULT addServiceFactory(int id, iServiceHandler *hnd, std::list &extensions); RESULT removeServiceFactory(int id); + RESULT addFactoryExtension(int id, const char *extension); + RESULT removeFactoryExtension(int id, const char *extension); #endif static SWIG_VOID(RESULT) getInstance(ePtr &SWIG_NAMED_OUTPUT(ptr)) { ptr = instance; return 0; } }; -- cgit v1.2.3 From ff414e7874e0ab4fdf89cce159ea835ac5c5393d Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:11:47 +0100 Subject: move iDataSource to own header file, change read function for easier thread locking (seek must called with a offset/position every time) --- lib/base/idatasource.h | 19 +++++++++++++++++++ lib/base/rawfile.cpp | 41 ++++++++++++++++++++--------------------- lib/base/rawfile.h | 43 +++++++------------------------------------ 3 files changed, 46 insertions(+), 57 deletions(-) create mode 100644 lib/base/idatasource.h diff --git a/lib/base/idatasource.h b/lib/base/idatasource.h new file mode 100644 index 00000000..0daa5267 --- /dev/null +++ b/lib/base/idatasource.h @@ -0,0 +1,19 @@ +#ifndef __lib_base_idatasource_h +#define __lib_base_idatasource_h + +#include + +class iDataSource: public iObject +{ +public: + /* NOTE: should only be used to get current position or filelength */ + virtual off_t lseek(off_t offset, int whence)=0; + + /* NOTE: you must be able to handle short reads! */ + virtual ssize_t read(off_t offset, void *buf, size_t count)=0; /* NOTE: this is what you in normal case have to use!! */ + + virtual off_t length()=0; + virtual int valid()=0; +}; + +#endif diff --git a/lib/base/rawfile.cpp b/lib/base/rawfile.cpp index 1552203a..d4c16d79 100644 --- a/lib/base/rawfile.cpp +++ b/lib/base/rawfile.cpp @@ -55,6 +55,13 @@ void eRawFile::setfd(int fd) } off_t eRawFile::lseek(off_t offset, int whence) +{ + eSingleLocker l(m_lock); + m_current_offset = lseek_internal(offset, whence); + return m_current_offset; +} + +off_t eRawFile::lseek_internal(off_t offset, int whence) { // eDebug("lseek: %lld, %d", offset, whence); /* if there is only one file, use the native lseek - the file could be growing! */ @@ -64,7 +71,8 @@ off_t eRawFile::lseek(off_t offset, int whence) return ::lseek(m_fd, offset, whence); else { - ::fseeko(m_file, offset, whence); + if (::fseeko(m_file, offset, whence) < 0) + perror("fseeko"); return ::ftello(m_file); } } @@ -103,11 +111,19 @@ int eRawFile::close() } } -ssize_t eRawFile::read(void *buf, size_t count) +ssize_t eRawFile::read(off_t offset, void *buf, size_t count) { -// eDebug("read: %p, %d", buf, count); + eSingleLocker l(m_lock); + + if (offset != m_current_offset) + { + m_current_offset = lseek_internal(offset, SEEK_SET); + if (m_current_offset < 0) + return m_current_offset; + } + switchOffset(m_current_offset); - + if (m_nrfiles >= 2) { if (m_current_offset + count > m_totallength) @@ -235,20 +251,3 @@ off_t eRawFile::length() { return m_totallength; } - -off_t eRawFile::position() -{ - if (m_nrfiles < 2) - { - if (!m_cached) - return ::lseek(m_fd, 0, SEEK_CUR); - else - return ::fseeko(m_file, 0, SEEK_CUR); - } - return m_current_offset; -} - -eSingleLock &eRawFile::getLock() -{ - return m_lock; -} diff --git a/lib/base/rawfile.h b/lib/base/rawfile.h index bb39dc6e..1720d581 100644 --- a/lib/base/rawfile.h +++ b/lib/base/rawfile.h @@ -2,37 +2,7 @@ #define __lib_base_rawfile_h #include -#include - -class iDataSource: public iObject -{ -public: - virtual off_t lseek(off_t offset, int whence)=0; - virtual ssize_t read(void *buf, size_t count)=0; /* NOTE: you must be able to handle short reads! */ - virtual off_t length()=0; - virtual off_t position()=0; - virtual int valid()=0; - virtual eSingleLock &getLock()=0; - virtual bool is_shared()=0; -}; - -class iDataSourcePositionRestorer -{ - ePtr &m_source; - off_t m_position; -public: - iDataSourcePositionRestorer(ePtr &source) - :m_source(source) - { - if (m_source->is_shared()) - m_position = m_source->position(); - } - ~iDataSourcePositionRestorer() - { - if (m_source->is_shared()) - m_source->lseek(m_position, SEEK_SET); - } -}; +#include class eRawFile: public iDataSource { @@ -43,14 +13,13 @@ public: ~eRawFile(); int open(const char *filename, int cached = 0); void setfd(int fd); - off_t lseek(off_t offset, int whence); int close(); - ssize_t read(void *buf, size_t count); /* NOTE: you must be able to handle short reads! */ + + // iDataSource + off_t lseek(off_t offset, int whence); + ssize_t read(off_t offset, void *buf, size_t count); off_t length(); - off_t position(); int valid(); - eSingleLock &getLock(); - bool is_shared() { return ref.count > 1; } private: int m_fd; /* for uncached */ FILE *m_file; /* for cached */ @@ -61,6 +30,8 @@ private: void scan(); int m_current_file; int switchOffset(off_t off); + + off_t lseek_internal(off_t offset, int whence); FILE *openFileCached(int nr); int openFileUncached(int nr); }; -- cgit v1.2.3 From 96844b5bd92b331390597061efe140172979c34d Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:13:44 +0100 Subject: migrate eDVBTsTools to new iDataSource seek function --- lib/dvb/tstools.cpp | 47 +++++++++++------------------------------------ lib/dvb/tstools.h | 2 +- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 7739f601..c7d9a417 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -37,8 +37,6 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) eRawFile *f = new eRawFile(); ePtr src = f; - eSingleLocker l(f->getLock()); - if (f->open(filename, 1) < 0) return -1; @@ -47,7 +45,7 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) return 0; } -void eDVBTSTools::setSource(ePtr source, const char *stream_info_filename) +void eDVBTSTools::setSource(ePtr &source, const char *stream_info_filename) { closeFile(); @@ -72,10 +70,8 @@ void eDVBTSTools::setSource(ePtr source, const char *stream_info_fi void eDVBTSTools::closeFile() { - if (m_source) { - eSingleLocker l(m_source->getLock()); + if (m_source) closeSource(); - } } void eDVBTSTools::setSyncPID(int pid) @@ -100,29 +96,19 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) offset -= offset % 188; - iDataSourcePositionRestorer r(m_source); - - eSingleLocker l(m_source->getLock()); - - if (m_source->lseek(offset, SEEK_SET) < 0) - { - eDebug("lseek failed"); - return -1; - } - int left = m_maxrange; while (left >= 188) { unsigned char packet[188]; - if (m_source->read(packet, 188) != 188) + if (m_source->read(offset, packet, 188) != 188) { eDebug("read error"); break; } left -= 188; offset += 188; - + if (packet[0] != 0x47) { eDebug("resync"); @@ -132,8 +118,8 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) if (packet[i] == 0x47) break; ++i; + --offset; } - offset = m_source->lseek(i - 188, SEEK_CUR); continue; } @@ -443,10 +429,6 @@ void eDVBTSTools::calcEnd() if (!m_source->valid()) return; - iDataSourcePositionRestorer r(m_source); - - eSingleLocker l(m_source->getLock()); - off_t end = m_source->lseek(0, SEEK_END); if (llabs(end - m_last_filelength) > 1*1024*1024) @@ -603,28 +585,22 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) return -1; } - iDataSourcePositionRestorer r(m_source); - - eSingleLocker l(m_source->getLock()); - - if (m_source->lseek(0, SEEK_SET) < 0) - { - eDebug("seek failed"); - return -1; - } + off_t position=0; int left = 5*1024*1024; while (left >= 188) { unsigned char packet[188]; - if (m_source->read(packet, 188) != 188) + int ret = m_source->read(position, packet, 188); + if (ret != 188) { eDebug("read error"); break; } left -= 188; - + position += 188; + if (packet[0] != 0x47) { int i = 0; @@ -632,12 +608,11 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) { if (packet[i] == 0x47) break; + --position; ++i; } - m_source->lseek(i - 188, SEEK_CUR); continue; } - int pid = ((packet[1] << 8) | packet[2]) & 0x1FFF; int pusi = !!(packet[1] & 0x40); diff --git a/lib/dvb/tstools.h b/lib/dvb/tstools.h index 41312c4c..1192cd2d 100644 --- a/lib/dvb/tstools.h +++ b/lib/dvb/tstools.h @@ -19,7 +19,7 @@ public: eDVBTSTools(); ~eDVBTSTools(); - void setSource(ePtr source, const char *streaminfo_filename=NULL); + void setSource(ePtr &source, const char *streaminfo_filename=NULL); void closeSource(); int openFile(const char *filename, int nostreaminfo = 0); -- 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(-) 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 dd43e7a64a07bd5777e40cd46fed4fd9f545eb01 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:16:39 +0100 Subject: migrate eFilePushThread to new iDateSource read interface, remove no more supported seek function --- lib/base/filepush.cpp | 46 +++++++++++++--------------------------------- lib/base/filepush.h | 6 +++--- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index 0d599f96..af5a8bb6 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -29,7 +29,7 @@ void eFilePushThread::thread() { setIoPrio(prio_class, prio); - off_t dest_pos = 0, source_pos = 0; + off_t dest_pos = 0; size_t bytes_read = 0; off_t current_span_offset = 0; @@ -46,9 +46,7 @@ void eFilePushThread::thread() sigaction(SIGUSR1, &act, 0); hasStarted(); - - source_pos = m_raw_source->lseek(0, SEEK_CUR); - + /* m_stop must be evaluated after each syscall. */ while (!m_stop) { @@ -137,14 +135,12 @@ void eFilePushThread::thread() if (m_sg && !current_span_remaining) { - m_sg->getNextSourceSpan(source_pos, bytes_read, current_span_offset, current_span_remaining); + m_sg->getNextSourceSpan(m_current_position, bytes_read, current_span_offset, current_span_remaining); ASSERT(!(current_span_remaining % m_blocksize)); - - if (source_pos != current_span_offset) - source_pos = m_raw_source->lseek(current_span_offset, SEEK_SET); + m_current_position = current_span_offset; bytes_read = 0; } - + size_t maxread = sizeof(m_buffer); /* if we have a source span, don't read past the end */ @@ -157,9 +153,9 @@ void eFilePushThread::thread() m_buf_start = 0; m_filter_end = 0; m_buf_end = 0; - + if (maxread) - m_buf_end = m_raw_source->read(m_buffer, maxread); + m_buf_end = m_source->read(m_current_position, m_buffer, maxread); if (m_buf_end < 0) { @@ -177,10 +173,7 @@ void eFilePushThread::thread() /* a read might be mis-aligned in case of a short read. */ int d = m_buf_end % m_blocksize; if (d) - { - m_raw_source->lseek(-d, SEEK_CUR); m_buf_end -= d; - } if (m_buf_end == 0) { @@ -216,18 +209,10 @@ void eFilePushThread::thread() sleep(1); continue; } -#if 0 - eDebug("FILEPUSH: end-of-file! (currently unhandled)"); - if (!m_raw_source->lseek(0, SEEK_SET)) - { - eDebug("(looping)"); - continue; - } -#endif break; } else { - source_pos += m_buf_end; + m_current_position += m_buf_end; bytes_read += m_buf_end; if (m_sg) current_span_remaining -= m_buf_end; @@ -242,10 +227,9 @@ void eFilePushThread::thread() void eFilePushThread::start(int fd, int fd_dest) { eRawFile *f = new eRawFile(); + ePtr source = f; f->setfd(fd); - m_raw_source = f; - m_fd_dest = fd_dest; - resume(); + start(source, fd_dest); } int eFilePushThread::start(const char *file, int fd_dest) @@ -258,10 +242,11 @@ int eFilePushThread::start(const char *file, int fd_dest) return 0; } -void eFilePushThread::start(ePtr source, int fd_dest) +void eFilePushThread::start(ePtr &source, int fd_dest) { - m_raw_source = source; + m_source = source; m_fd_dest = fd_dest; + m_current_position = 0; resume(); } @@ -283,11 +268,6 @@ void eFilePushThread::pause() stop(); } -void eFilePushThread::seek(int whence, off_t where) -{ - m_raw_source->lseek(where, whence); -} - void eFilePushThread::resume() { m_stop = 0; diff --git a/lib/base/filepush.h b/lib/base/filepush.h index 75df7ab7..eb8e7924 100644 --- a/lib/base/filepush.h +++ b/lib/base/filepush.h @@ -25,10 +25,9 @@ public: void start(int sourcefd, int destfd); int start(const char *filename, int destfd); - void start(ePtr source, int destfd); + void start(ePtr &source, int destfd); void pause(); - void seek(int whence, off_t where); void resume(); /* flushes the internal readbuffer */ @@ -59,8 +58,9 @@ private: int m_send_pvr_commit; int m_stream_mode; int m_blocksize; + off_t m_current_position; - ePtr m_raw_source; + ePtr m_source; eFixedMessagePump m_messagepump; -- cgit v1.2.3 From f1905e060a3a947ac2d3825e43b3052b361c71e6 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:17:45 +0100 Subject: migrate eDVBServiceOfflineOperations to new iDataSource::read function --- lib/service/servicedvb.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index e498dd42..9cac25fa 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -503,18 +503,19 @@ RESULT eDVBPVRServiceOfflineOperations::reindex() int err = f.open(m_ref.path.c_str(), 0); if (err < 0) return -1; - + + off_t offset = 0; off_t length = f.length(); unsigned char buffer[188*256*4]; while (1) { - off_t offset = f.lseek(0, SEEK_CUR); eDebug("at %08llx / %08llx (%d %%)", offset, length, (int)(offset * 100 / length)); - int r = f.read(buffer, sizeof(buffer)); + int r = f.read(offset, buffer, sizeof(buffer)); if (!r) break; if (r < 0) return r; + offset += r; parser.parseData(offset, buffer, r); } -- cgit v1.2.3 From ed9038b0f131b63d3db62c51e7e195ddc5c26122 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:18:45 +0100 Subject: add new tuneExt function to eDVBServicePMTHandler to make the class more reusable --- lib/dvb/pmt.cpp | 11 ++++++++++- lib/dvb/pmt.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index ea4b96c5..ba5a3ade 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -674,6 +674,12 @@ void eDVBServicePMTHandler::SDTScanEvent(int event) } int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *cue, bool simulate, eDVBService *service) +{ + ePtr s; + return tuneExt(ref, use_decode_demux, s, cue, simulate, service); +} + +int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &source, eCueSheet *cue, bool simulate, eDVBService *service) { RESULT res=0; m_reference = ref; @@ -757,7 +763,10 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux, if (m_pvr_channel) { m_pvr_channel->setCueSheet(cue); - m_pvr_channel->playFile(ref.path.c_str()); + if (source) + m_pvr_channel->playSource(source); + else + m_pvr_channel->playFile(ref.path.c_str()); } } diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 483c06b1..0ea36e47 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -206,6 +206,8 @@ public: void resetCachedProgram() { m_have_cached_program = false; } int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0); + int tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0); + void free(); private: bool m_have_cached_program; -- cgit v1.2.3 From a6b9e53927e962e23ac55dc5c255081b17725d5d Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 17:19:46 +0100 Subject: lib/service/servicedvb.h: make eDVBService members protected better reusability --- lib/service/servicedvb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index dafaf35d..c49941b7 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -185,7 +185,7 @@ public: RESULT stream(ePtr &ptr); PyObject *getStreamingData(); -private: +protected: friend class eServiceFactoryDVB; eServiceReference m_reference; -- 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(-) 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 5ef54ea03e020f76be1aabeeff46453ca123a0f5 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 20:26:17 +0100 Subject: add possibility to pass the streaminfo file via tuneExt to tstools instance --- lib/dvb/pmt.cpp | 6 +++--- lib/dvb/pmt.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index ba5a3ade..2ca226ae 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -676,10 +676,10 @@ void eDVBServicePMTHandler::SDTScanEvent(int event) int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *cue, bool simulate, eDVBService *service) { ePtr s; - return tuneExt(ref, use_decode_demux, s, cue, simulate, service); + return tuneExt(ref, use_decode_demux, s, NULL, cue, simulate, service); } -int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &source, eCueSheet *cue, bool simulate, eDVBService *service) +int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &source, const char *streaminfo_file, eCueSheet *cue, bool simulate, eDVBService *service) { RESULT res=0; m_reference = ref; @@ -764,7 +764,7 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem { m_pvr_channel->setCueSheet(cue); if (source) - m_pvr_channel->playSource(source); + m_pvr_channel->playSource(source, streaminfo_file); else m_pvr_channel->playFile(ref.path.c_str()); } diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 0ea36e47..721a8fca 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -205,8 +205,11 @@ public: int getChannel(eUsePtr &channel); void resetCachedProgram() { m_have_cached_program = false; } + /* deprecated interface */ int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0); - int tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0); + + /* new interface */ + int tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &, const char *streaminfo_file, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0); void free(); private: -- cgit v1.2.3 From 55b8dd6115c2bb0921842c6dc77aafb8d0a40c4f Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 20:26:51 +0100 Subject: a little bit more error checking --- lib/dvb/tstools.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index c7d9a417..bd363089 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -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; -- 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(-) 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 From 8c55e2715c847f0dc5edd25af7ec3e4146592770 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 20:30:42 +0100 Subject: use newer eDVBServicePMTHandler::tuneExt call, add a virtual createDataSource function to make the code more re-usable --- lib/service/servicedvb.cpp | 20 ++++++++++++++++---- lib/service/servicedvb.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 9cac25fa..1e58d848 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1094,7 +1094,8 @@ void eDVBServicePlay::serviceEventTimeshift(int event) if (m_skipmode < 0) m_cue->seekTo(0, -1000); - m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ + ePtr source = createDataSource(r); + m_service_handler_timeshift.tuneExt(r, 1, source, r.path.c_str(), m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ m_event((iPlayableService*)this, evUser+1); } @@ -1123,7 +1124,8 @@ void eDVBServicePlay::serviceEventTimeshift(int event) m_service_handler_timeshift.free(); resetTimeshift(1); - m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ + ePtr source = createDataSource(r); + m_service_handler_timeshift.tuneExt(r, 1, source, m_timeshift_file_next.c_str(), m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ m_event((iPlayableService*)this, evUser+1); } @@ -1153,7 +1155,8 @@ RESULT eDVBServicePlay::start() m_event(this, evStart); m_first_program_info = 1; - m_service_handler.tune(service, m_is_pvr, m_cue, false, m_dvb_service); + ePtr source = createDataSource(service); + m_service_handler.tuneExt(service, m_is_pvr, source, service.path.c_str(), m_cue, false, m_dvb_service); if (m_is_pvr) { @@ -2357,6 +2360,13 @@ void eDVBServicePlay::resetTimeshift(int start) m_timeshift_active = 0; } +ePtr eDVBServicePlay::createDataSource(eServiceReferenceDVB &ref) +{ + eRawFile *f = new eRawFile(); + f->open(ref.path.c_str()); + return ePtr(f); +} + void eDVBServicePlay::switchToTimeshift() { if (m_timeshift_active) @@ -2368,7 +2378,9 @@ void eDVBServicePlay::switchToTimeshift() r.path = m_timeshift_file; m_cue->seekTo(0, -1000); - m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ + + ePtr source = createDataSource(r); + m_service_handler_timeshift.tuneExt(r, 1, source, m_timeshift_file.c_str(), m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ eDebug("eDVBServicePlay::switchToTimeshift, in pause mode now."); pause(); diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index c49941b7..23675bf6 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -289,6 +289,8 @@ protected: ePtr m_video_event_connection; void video_event(struct iTSMPEGDecoder::videoEvent); + + virtual ePtr createDataSource(eServiceReferenceDVB &ref); }; class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation -- cgit v1.2.3 From 7a92b402b7b837c1fed5335843dea9573e93050d Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Nov 2010 20:53:10 +0100 Subject: lib/base/rawfile.cpp: no recursive mutex is needed here (small speedup) --- lib/base/rawfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base/rawfile.cpp b/lib/base/rawfile.cpp index d4c16d79..3a09e07e 100644 --- a/lib/base/rawfile.cpp +++ b/lib/base/rawfile.cpp @@ -7,7 +7,7 @@ DEFINE_REF(eRawFile); eRawFile::eRawFile() - :m_lock(true) + :m_lock(false) { m_fd = -1; m_file = 0; -- cgit v1.2.3 From 7199d3c37e7e7065bd6943702b5864fa5186b9a8 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 23 Nov 2010 12:34:24 +0100 Subject: lib/dvb/pmt.cpp: migrate PMT pid search code to new iDataSource stuff --- lib/dvb/pmt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 2ca226ae..7b799662 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -710,7 +710,9 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem { eWarning("no .meta file found, trying to find PMT pid"); eDVBTSTools tstools; - if (tstools.openFile(ref.path.c_str())) + if (source) + tstools.setSource(source, streaminfo_file ? streaminfo_file : ref.path.c_str()); + else if (tstools.openFile(ref.path.c_str())) eWarning("failed to open file"); else { -- cgit v1.2.3