diff options
| author | Felix Domke <felix.domke@multimedia-labs.de> | 2009-08-10 22:52:36 +0200 |
|---|---|---|
| committer | Felix Domke <felix.domke@multimedia-labs.de> | 2009-08-10 22:52:36 +0200 |
| commit | b455ca34e1ab4a716e1b2f0c7228fb235b577ce4 (patch) | |
| tree | de1d3f682ddbc9975dc747df0b3b102050cb9d64 /lib/service/servicedvb.cpp | |
| parent | aabe98bebb2aa90435f5124c6151d718d18dfcd5 (diff) | |
| download | enigma2-b455ca34e1ab4a716e1b2f0c7228fb235b577ce4.tar.gz enigma2-b455ca34e1ab4a716e1b2f0c7228fb235b577ce4.zip | |
add reindex
Diffstat (limited to 'lib/service/servicedvb.cpp')
| -rw-r--r-- | lib/service/servicedvb.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 8017e3d6..497911c5 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -466,6 +466,7 @@ public: RESULT deleteFromDisk(int simulate); RESULT getListOfFilenames(std::list<std::string> &); + RESULT reindex(); }; DEFINE_REF(eDVBPVRServiceOfflineOperations); @@ -528,6 +529,42 @@ RESULT eDVBPVRServiceOfflineOperations::getListOfFilenames(std::list<std::string return 0; } +RESULT eDVBPVRServiceOfflineOperations::reindex() +{ + const char *filename = m_ref.path.c_str(); + eDebug("reindexing %s...", filename); + + eMPEGStreamInformation info; + eMPEGStreamParserTS parser(info); + + info.startSave(filename); + + eRawFile f; + + int err = f.open(m_ref.path.c_str(), 0); + if (err < 0) + return -1; + + 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)); + if (!r) + break; + if (r < 0) + return r; + parser.parseData(offset, buffer, r); + } + + info.stopSave(); + f.close(); + + return 0; +} + DEFINE_REF(eServiceFactoryDVB) eServiceFactoryDVB::eServiceFactoryDVB() @@ -2354,6 +2391,7 @@ void eDVBServicePlay::updateDecoder() } if (m_cue) m_cue->setDecodingDemux(m_decode_demux, m_decoder); + m_decoder->play(); /* pids will be set later. */ } m_timeshift_changed = 0; |
