aboutsummaryrefslogtreecommitdiff
path: root/lib/service
diff options
context:
space:
mode:
authorFelix Domke <felix.domke@multimedia-labs.de>2009-08-10 22:52:36 +0200
committerFelix Domke <felix.domke@multimedia-labs.de>2009-08-10 22:52:36 +0200
commitb455ca34e1ab4a716e1b2f0c7228fb235b577ce4 (patch)
treede1d3f682ddbc9975dc747df0b3b102050cb9d64 /lib/service
parentaabe98bebb2aa90435f5124c6151d718d18dfcd5 (diff)
downloadenigma2-b455ca34e1ab4a716e1b2f0c7228fb235b577ce4.tar.gz
enigma2-b455ca34e1ab4a716e1b2f0c7228fb235b577ce4.zip
add reindex
Diffstat (limited to 'lib/service')
-rw-r--r--lib/service/iservice.h3
-rw-r--r--lib/service/servicedvb.cpp38
-rw-r--r--lib/service/servicemp3.cpp6
3 files changed, 47 insertions, 0 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 24c2e341..c477f11d 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -719,6 +719,9 @@ public:
/* for transferring a service... */
virtual SWIG_VOID(RESULT) getListOfFilenames(std::list<std::string> &SWIG_OUTPUT)=0;
+
+ /* a blocking call to reindex a file */
+ virtual int reindex() = 0;
// TODO: additional stuff, like a conversion interface?
};
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;
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index 3e6de282..2844b477 100644
--- a/lib/service/servicemp3.cpp
+++ b/lib/service/servicemp3.cpp
@@ -101,6 +101,7 @@ public:
RESULT deleteFromDisk(int simulate);
RESULT getListOfFilenames(std::list<std::string> &);
+ RESULT reindex();
};
DEFINE_REF(eMP3ServiceOfflineOperations);
@@ -143,6 +144,11 @@ RESULT eMP3ServiceOfflineOperations::getListOfFilenames(std::list<std::string> &
return 0;
}
+RESULT eMP3ServiceOfflineOperations::reindex()
+{
+ return -1;
+}
+
RESULT eServiceFactoryMP3::offlineOperations(const eServiceReference &ref, ePtr<iServiceOfflineOperations> &ptr)
{