diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-12-17 14:58:54 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-12-17 15:15:25 +0100 |
| commit | b64b791cb481944585fceaf5bcac9e2c699dbeb0 (patch) | |
| tree | dba3f33f2804fabec8f4288eb33c864176031ed6 /lib/dvb/tstools.cpp | |
| parent | 5e05afa7dbc5acfc92a158dcc88b0be12c52af62 (diff) | |
| download | enigma2-b64b791cb481944585fceaf5bcac9e2c699dbeb0.tar.gz enigma2-b64b791cb481944585fceaf5bcac9e2c699dbeb0.zip | |
lib/dvb/tstools.h/cpp: make eDVBTSTool thread safe (i.e. this fixes seeking in timeshift and seeking in files without additional startcode/accespoint file
Diffstat (limited to 'lib/dvb/tstools.cpp')
| -rw-r--r-- | lib/dvb/tstools.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index a9eef406..2c261837 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -7,6 +7,7 @@ #include <stdio.h> eDVBTSTools::eDVBTSTools() + :m_file_lock(true) { m_pid = -1; m_maxrange = 256*1024; @@ -47,6 +48,7 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) m_samples_taken = 0; + eSingleLocker l(m_file_lock); if (m_file.open(filename, 1) < 0) return -1; return 0; @@ -54,6 +56,7 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) void eDVBTSTools::closeFile() { + eSingleLocker l(m_file_lock); m_file.close(); } @@ -78,7 +81,8 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) return -1; offset -= offset % 188; - + + eSingleLocker l(m_file_lock); if (m_file.lseek(offset, SEEK_SET) < 0) { eDebug("lseek failed"); @@ -355,7 +359,8 @@ void eDVBTSTools::calcEnd() { if (!m_file.valid()) return; - + + eSingleLocker l(m_file_lock); off_t end = m_file.lseek(0, SEEK_END); if (llabs(end - m_last_filelength) > 1*1024*1024) @@ -504,6 +509,7 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) return -1; } + eSingleLocker l(m_file_lock); if (m_file.lseek(0, SEEK_SET) < 0) { eDebug("seek failed"); |
