X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/86e9af6a8a52226e0dc08430fb4b03291f9de0c7..ec7c78fd405d7d6579eb40ac52a56e904ee1e21f:/lib/service/event.cpp?ds=sidebyside diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 8a75b9e9..4dda5779 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -10,6 +10,18 @@ #include #include +#include +#include + +// static members / methods +std::string eServiceEvent::m_language = "de_DE"; + +void eServiceEvent::setEPGLanguage( const std::string language ) +{ + m_language = language; +} +/////////////////////////// + DEFINE_REF(eServiceEvent); DEFINE_REF(eComponentData); @@ -163,10 +175,10 @@ RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid) (stime_bcd >> 8)&0xFF, stime_bcd & 0xFF ); + m_event_id = evt->getEventId(); m_duration = fromBCD(duration>>16)*3600+fromBCD(duration>>8)*60+fromBCD(duration); - std::string country="de_DE"; // TODO use local data here for (int i=0; i < MAX_LANG; i++) - if (country==ISOtbl[i][0]) + if (m_language==ISOtbl[i][0]) if (loadLanguage(evt, ISOtbl[i][1], tsidonid)) return 0; if (loadLanguage(evt, "eng", tsidonid)) @@ -176,6 +188,27 @@ RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid) return 0; } +RESULT eServiceEvent::parseFrom(const std::string filename, int tsidonid) +{ + if (!filename.empty()) + { + 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); + parseFrom(&ev, tsidonid); + return 0; + } + } + } + return -1; +} + std::string eServiceEvent::getBeginTimeString() const { tm t; @@ -203,7 +236,7 @@ RESULT eServiceEvent::getComponentData(ePtr &dest, int tagnum) c return -1; } -RESULT eServiceEvent::getLinkageService(eServiceReference &service, int num) const +RESULT eServiceEvent::getLinkageService(eServiceReference &service, eServiceReference &parent, int num) const { std::list::const_iterator it = m_linkage_services.begin(); @@ -212,6 +245,25 @@ RESULT eServiceEvent::getLinkageService(eServiceReference &service, int num) con if ( it != m_linkage_services.end() ) { service = *it; + eServiceReferenceDVB &subservice = (eServiceReferenceDVB&) service; + eServiceReferenceDVB ¤t = (eServiceReferenceDVB&) parent; + subservice.setDVBNamespace(current.getDVBNamespace()); + if ( current.getParentTransportStreamID().get() ) + { + subservice.setParentTransportStreamID( current.getParentTransportStreamID() ); + subservice.setParentServiceID( current.getParentServiceID() ); + } + else + { + subservice.setParentTransportStreamID( current.getTransportStreamID() ); + subservice.setParentServiceID( current.getServiceID() ); + } + if ( subservice.getParentTransportStreamID() == subservice.getTransportStreamID() && + subservice.getParentServiceID() == subservice.getServiceID() ) + { + subservice.setParentTransportStreamID( eTransportStreamID(0) ); + subservice.setParentServiceID( eServiceID(0) ); + } return 0; } service.type = eServiceReference::idInvalid;