fix automatic scan for DVB-T
[enigma2.git] / lib / service / event.cpp
index f84c38b7ed250580458cb65ecc75a975da8afb58..07c92c52ffd7b25f3af11cb31081b1a7268b8d5b 100644 (file)
 #include <dvbsi++/component_descriptor.h>
 #include <dvbsi++/descriptor_tag.h>
 
+// 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);
 
@@ -165,9 +174,8 @@ RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid)
        );
        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))
@@ -204,7 +212,7 @@ RESULT eServiceEvent::getComponentData(ePtr<eComponentData> &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<eServiceReference>::const_iterator it =
                m_linkage_services.begin();
@@ -213,6 +221,25 @@ RESULT eServiceEvent::getLinkageService(eServiceReference &service, int num) con
        if ( it != m_linkage_services.end() )
        {
                service = *it;
+               eServiceReferenceDVB &subservice = (eServiceReferenceDVB&) service;
+               eServiceReferenceDVB &current = (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;