aboutsummaryrefslogtreecommitdiff
path: root/lib/service
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-11-23 13:58:30 +0100
committerghost <andreas.monzner@multimedia-labs.de>2010-11-23 13:58:30 +0100
commit7b2960a205f3c3e3b421d1664cd38644b3ffb679 (patch)
treed57819fb0ff1eb5e64638bc584c54ae18816043f /lib/service
parentfc83dfbe60f36712953498b20a1c2f10737e7685 (diff)
parent7199d3c37e7e7065bd6943702b5864fa5186b9a8 (diff)
downloadenigma2-7b2960a205f3c3e3b421d1664cd38644b3ffb679.tar.gz
enigma2-7b2960a205f3c3e3b421d1664cd38644b3ffb679.zip
Merge branch 'bug_615_replace_rawfile'
Diffstat (limited to 'lib/service')
-rw-r--r--lib/service/service.cpp19
-rw-r--r--lib/service/service.h2
-rw-r--r--lib/service/servicedvb.cpp27
-rw-r--r--lib/service/servicedvb.h4
4 files changed, 44 insertions, 8 deletions
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<int, std::list<std::string> >::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<int, std::list<std::string> >::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<int, std::list<std::string> >::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<eServiceCenter> &ptr) { ptr = instance; return 0; }
RESULT addServiceFactory(int id, iServiceHandler *hnd, std::list<std::string> &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<iServiceHandler> &SWIG_NAMED_OUTPUT(ptr)) { ptr = instance; return 0; }
};
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index e498dd42..1e58d848 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);
}
@@ -1093,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<iDataSource> 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);
}
@@ -1122,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<iDataSource> 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);
}
@@ -1152,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<iDataSource> 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)
{
@@ -2356,6 +2360,13 @@ void eDVBServicePlay::resetTimeshift(int start)
m_timeshift_active = 0;
}
+ePtr<iDataSource> eDVBServicePlay::createDataSource(eServiceReferenceDVB &ref)
+{
+ eRawFile *f = new eRawFile();
+ f->open(ref.path.c_str());
+ return ePtr<iDataSource>(f);
+}
+
void eDVBServicePlay::switchToTimeshift()
{
if (m_timeshift_active)
@@ -2367,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<iDataSource> 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 dafaf35d..23675bf6 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -185,7 +185,7 @@ public:
RESULT stream(ePtr<iStreamableService> &ptr);
PyObject *getStreamingData();
-private:
+protected:
friend class eServiceFactoryDVB;
eServiceReference m_reference;
@@ -289,6 +289,8 @@ private:
ePtr<eConnection> m_video_event_connection;
void video_event(struct iTSMPEGDecoder::videoEvent);
+
+ virtual ePtr<iDataSource> createDataSource(eServiceReferenceDVB &ref);
};
class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation