aboutsummaryrefslogtreecommitdiff
path: root/lib/service
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-02-25 01:35:04 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-02-25 01:35:04 +0000
commit673d85e4aace04805fe958bbe8cb741b21ccbc1b (patch)
tree52a6cd09cc10134852c8019135a800c39191bf2a /lib/service
parent4ead4a1affceff4eb642ef333a71235ce6f173e6 (diff)
downloadenigma2-673d85e4aace04805fe958bbe8cb741b21ccbc1b.tar.gz
enigma2-673d85e4aace04805fe958bbe8cb741b21ccbc1b.zip
store a .eit file for each recoring this holds raw eit event informations
including audio track informations, event description, event title...... for information about the file format look in EN300468 (www.etsi.org) make info button useable when playbacking a movie
Diffstat (limited to 'lib/service')
-rw-r--r--lib/service/iservice.h2
-rw-r--r--lib/service/servicedvb.cpp30
-rw-r--r--lib/service/servicedvbrecord.cpp48
-rw-r--r--lib/service/servicedvbrecord.h2
4 files changed, 77 insertions, 5 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index bc0fc974..436d3554 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -444,7 +444,7 @@ class iRecordableService: public iObject
~iRecordableService();
#endif
public:
- virtual RESULT prepare(const char *filename)=0;
+ virtual RESULT prepare(const char *filename, time_t begTime=-1, time_t endTime=-1, int eit_event_id=-1)=0;
virtual RESULT start()=0;
virtual RESULT stop()=0;
};
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 3d551016..f9bb877f 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -11,6 +11,7 @@
#include <lib/dvb/decoder.h>
#include <lib/service/servicedvbrecord.h>
+#include <lib/service/event.h>
#include <lib/dvb/metaparser.h>
#include <lib/dvb/tstools.h>
#include <lib/python/python.h>
@@ -20,6 +21,8 @@
#include <byteswap.h>
#include <netinet/in.h>
+#include <dvbsi++/event_information_section.h>
+
#ifndef BYTE_ORDER
#error no byte order defined!
#endif
@@ -248,6 +251,7 @@ RESULT eDVBPVRServiceOfflineOperations::getListOfFilenames(std::list<std::string
res.push_back(m_ref.path + ".meta");
res.push_back(m_ref.path + ".ap");
res.push_back(m_ref.path + ".cuts");
+ res.push_back(m_ref.path + ".eit");
return 0;
}
@@ -645,7 +649,31 @@ RESULT eDVBServicePlay::start()
to start recording from the data demux. */
m_cue = new eCueSheet();
m_first_program_info = 1;
- r = m_service_handler.tune((eServiceReferenceDVB&)m_reference, m_is_pvr, m_cue);
+ eServiceReferenceDVB &service = (eServiceReferenceDVB&)m_reference;
+ r = m_service_handler.tune(service, m_is_pvr, m_cue);
+ if (m_is_pvr)
+ {
+ std::string filename = service.path;
+ filename.erase(filename.length()-2, 2);
+ filename+="eit";
+ int fd = ::open( filename.c_str(), O_RDONLY );
+ if ( fd > -1 )
+ {
+ __u8 buf[4096];
+ int rd = ::read(fd, buf, 4096);
+ ::close(fd);
+ if ( rd > 12 /*EIT_LOOP_SIZE*/ )
+ {
+ Event ev(buf);
+ ePtr<eServiceEvent> event = new eServiceEvent;
+ ePtr<eServiceEvent> empty;
+ event->parseFrom(&ev, (service.getTransportStreamID().get()<<16)|service.getOriginalNetworkID().get());
+ m_event_handler.inject(event, 0);
+ m_event_handler.inject(empty, 1);
+ eDebug("injected");
+ }
+ }
+ }
m_event(this, evStart);
m_event((iPlayableService*)this, evSeekableStatusChanged);
return 0;
diff --git a/lib/service/servicedvbrecord.cpp b/lib/service/servicedvbrecord.cpp
index bded7cc9..a0359351 100644
--- a/lib/service/servicedvbrecord.cpp
+++ b/lib/service/servicedvbrecord.cpp
@@ -1,5 +1,6 @@
#include <lib/service/servicedvbrecord.h>
#include <lib/base/eerror.h>
+#include <lib/dvb/epgcache.h>
#include <fcntl.h>
@@ -37,11 +38,54 @@ void eDVBServiceRecord::serviceEvent(int event)
}
}
-RESULT eDVBServiceRecord::prepare(const char *filename)
+RESULT eDVBServiceRecord::prepare(const char *filename, time_t begTime, time_t endTime, int eit_event_id)
{
m_filename = filename;
if (m_state == stateIdle)
- return doPrepare();
+ {
+ int ret = doPrepare();
+ if (!ret)
+ {
+ eEPGCache::getInstance()->Lock();
+ const eit_event_struct *event = 0;
+ if ( eit_event_id != -1 )
+ {
+ eDebug("query epg event id %d", eit_event_id);
+ eEPGCache::getInstance()->lookupEventId(m_ref, eit_event_id, event);
+ }
+ if ( !event && (begTime != -1 && endTime != -1) )
+ {
+ time_t queryTime = begTime + ((endTime-begTime)/2);
+ tm beg, end, query;
+ localtime_r(&begTime, &beg);
+ localtime_r(&endTime, &end);
+ localtime_r(&queryTime, &query);
+ eDebug("query stime %d:%d:%d, etime %d:%d:%d, qtime %d:%d:%d",
+ beg.tm_hour, beg.tm_min, beg.tm_sec,
+ end.tm_hour, end.tm_min, end.tm_sec,
+ query.tm_hour, query.tm_min, query.tm_sec);
+ eEPGCache::getInstance()->lookupEventTime(m_ref, queryTime, event);
+ }
+ if ( event )
+ {
+ eDebug("found event.. store to disc");
+ std::string fname = filename;
+ fname.erase(fname.length()-2, 2);
+ fname+="eit";
+ int fd = open(fname.c_str(), O_CREAT|O_WRONLY, 0777);
+ if (fd>-1)
+ {
+ int evLen=HILO(event->descriptors_loop_length)+12/*EIT_LOOP_SIZE*/;
+ int wr = ::write( fd, (unsigned char*)event, evLen );
+ if ( wr != evLen )
+ eDebug("eit write error (%m)");
+ ::close(fd);
+ }
+ }
+ eEPGCache::getInstance()->Unlock();
+ }
+ return ret;
+ }
else
return -1;
}
diff --git a/lib/service/servicedvbrecord.h b/lib/service/servicedvbrecord.h
index 7f08c554..25ca3e56 100644
--- a/lib/service/servicedvbrecord.h
+++ b/lib/service/servicedvbrecord.h
@@ -14,7 +14,7 @@ class eDVBServiceRecord: public iRecordableService, public Object
{
DECLARE_REF(eDVBServiceRecord);
public:
- RESULT prepare(const char *filename);
+ RESULT prepare(const char *filename, time_t begTime, time_t endTime, int eit_event_id);
RESULT start();
RESULT stop();
private: