- split iStaticServiceInformation against iServiceInformation
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 18 May 2005 01:53:43 +0000 (01:53 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 18 May 2005 01:53:43 +0000 (01:53 +0000)
 - add proper getName for DVB services
 - add missing event evStart for DVB service
 - display service name in Components.ServiceName

lib/python/Components/ServiceName.py
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h

index bb116160f2313782399c33dbcc2645b82e48fdf5..c96b79f4e246d436521e7911fda0f80b20780ee3 100644 (file)
@@ -1,5 +1,6 @@
 from PerServiceDisplay import *
 from PerServiceDisplay import *
-from enigma import pNavigation
+
+from enigma import pNavigation, iServiceInformationPtr
 
 class ServiceName(PerServiceDisplay):
        def __init__(self, navcore):
 
 class ServiceName(PerServiceDisplay):
        def __init__(self, navcore):
@@ -11,11 +12,11 @@ class ServiceName(PerServiceDisplay):
 
        def newService(self):
                info = iServiceInformationPtr()
 
        def newService(self):
                info = iServiceInformationPtr()
-               service = self.navcore.getCurrentService(service)
+               service = self.navcore.getCurrentService()
                
                if service != None:
                        if not service.info(info):
                
                if service != None:
                        if not service.info(info):
-                               self.setText("no name known, but it should be here :)")
+                               self.setText(info.getName())
        
        def stopEvent(self):
                        self.setText("");
        
        def stopEvent(self):
                        self.setText("");
index f7f6d5cde6980f556561b3d4ae5f55b7819d7176..4592a971dff60faf7505b37412b7e717655cd683 100644 (file)
@@ -152,9 +152,12 @@ TEMPLATE_TYPEDEF(ePtr<iStaticServiceInformation>, iStaticServiceInformationPtr);
 
 class eServiceEvent;
 
 
 class eServiceEvent;
 
-class iServiceInformation: public iStaticServiceInformation
+class iServiceInformation: public iObject
 {
 public:
 {
 public:
+       virtual RESULT getName(std::string &name)=0;
+               // FOR SWIG
+       std::string getName() { std::string temp; getName(temp); return temp; }
        virtual RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
 };
 
        virtual RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
 };
 
index 2fb051c12abb2b688a2c2c1d2807e0b3865c9410..a32ce3261f955fdd45f414beb58db3183cadc3a1 100644 (file)
@@ -80,8 +80,12 @@ RESULT eDVBServiceList::getContent(std::list<eServiceReference> &list)
 
 RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
 {
 
 RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
 {
+       ePtr<eDVBService> service;
+       int r = lookupService(service, ref);
+       if (r)
+               service = 0;
                // check resources...
                // check resources...
-       ptr = new eDVBServicePlay(ref);
+       ptr = new eDVBServicePlay(ref, service);
        return 0;
 }
 
        return 0;
 }
 
@@ -99,7 +103,17 @@ RESULT eServiceFactoryDVB::list(const eServiceReference &ref, ePtr<iListableServ
 
 RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
 {
 
 RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
 {
-       ptr = 0;
+       ePtr<eDVBService> service;
+       int r = lookupService(service, ref);
+       if (r)
+               return r;
+               /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
+       ptr = service;
+       return 0;
+}
+
+RESULT eServiceFactoryDVB::lookupService(ePtr<eDVBService> &service, const eServiceReference &ref)
+{
                        // TODO: handle the listing itself
        // if (ref.... == -1) .. return "... bouquets ...";
        // could be also done in another serviceFactory (with seperate ID) to seperate actual services and lists
                        // TODO: handle the listing itself
        // if (ref.... == -1) .. return "... bouquets ...";
        // could be also done in another serviceFactory (with seperate ID) to seperate actual services and lists
@@ -119,22 +133,18 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic
                return err;
        }
        
                return err;
        }
        
-       ePtr<eDVBService> service;
-
                /* we are sure to have a ..DVB reference as the info() call was forwarded here according to it's ID. */
        if ((err = db->getService((eServiceReferenceDVB&)ref, service)) != 0)
        {
                eDebug("getService failed!");
                return err;
        }
                /* we are sure to have a ..DVB reference as the info() call was forwarded here according to it's ID. */
        if ((err = db->getService((eServiceReferenceDVB&)ref, service)) != 0)
        {
                eDebug("getService failed!");
                return err;
        }
-       
-               /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
-       ptr = service;
+
        return 0;
 }
 
        return 0;
 }
 
-eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref): 
-       m_reference(ref)
+eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): 
+       m_reference(ref), m_dvb_service(service)
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent);
        CONNECT(m_event_handler.m_eit_changed, eDVBServicePlay::gotNewEvent);
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent);
        CONNECT(m_event_handler.m_eit_changed, eDVBServicePlay::gotNewEvent);
@@ -248,6 +258,7 @@ void eDVBServicePlay::serviceEvent(int event)
 RESULT eDVBServicePlay::start()
 {
        eDebug("starting DVB service");
 RESULT eDVBServicePlay::start()
 {
        eDebug("starting DVB service");
+       m_event(this, evStart);
        return m_service_handler.tune((eServiceReferenceDVB&)m_reference);
 }
 
        return m_service_handler.tune((eServiceReferenceDVB&)m_reference);
 }
 
@@ -276,9 +287,12 @@ RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr)
        return 0;
 }
 
        return 0;
 }
 
-RESULT eDVBServicePlay::getName(const eServiceReference &ref, std::string &name)
+RESULT eDVBServicePlay::getName(std::string &name)
 {
 {
-       name = "DVB service";
+       if (m_dvb_service)
+               m_dvb_service->getName(m_reference, name);
+       else
+               name = "DVB service";
        return 0;
 }
 
        return 0;
 }
 
index 5dd2f3b289bb918b281748d5ceded8825160f72f..e9489cd5b0c2d558285cd5358cf16d80a5c7993c 100644 (file)
@@ -20,6 +20,8 @@ public:
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
        RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
        RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
+private:
+       RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
 };
 
 class eDVBServiceList: public iListableService
 };
 
 class eDVBServiceList: public iListableService
@@ -41,12 +43,14 @@ private:
        friend class eServiceFactoryDVB;
        eServiceReference m_reference;
        
        friend class eServiceFactoryDVB;
        eServiceReference m_reference;
        
+       ePtr<eDVBService> m_dvb_service;
+       
        ePtr<iTSMPEGDecoder> m_decoder;
        
        eDVBServicePMTHandler m_service_handler;
        eDVBServiceEITHandler m_event_handler;
        
        ePtr<iTSMPEGDecoder> m_decoder;
        
        eDVBServicePMTHandler m_service_handler;
        eDVBServiceEITHandler m_event_handler;
        
-       eDVBServicePlay(const eServiceReference &ref);
+       eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
        
        void gotNewEvent();
        
        
        void gotNewEvent();
        
@@ -63,7 +67,7 @@ public:
        RESULT info(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
        RESULT info(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
-       RESULT getName(const eServiceReference &ref, std::string &name);
+       RESULT getName(std::string &name);
        RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
 };
 
        RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
 };
 
index a5f1b77337d925afe6ad326d8ceb6c1eeee33ad9..21c6cba0cf67fd99ae20d81c71e3ca72744a5a2b 100644 (file)
@@ -142,7 +142,7 @@ RESULT eServiceMP3::unpause() { printf("mp3 unpauses!\n"); return 0; }
 
 RESULT eServiceMP3::info(ePtr<iServiceInformation>&i) { i = this; return 0; }
 
 
 RESULT eServiceMP3::info(ePtr<iServiceInformation>&i) { i = this; return 0; }
 
-RESULT eServiceMP3::getName(const eServiceReference &ref, std::string &name)
+RESULT eServiceMP3::getName(std::string &name)
 {
        name = "MP3 File: " + filename;
        return 0;
 {
        name = "MP3 File: " + filename;
        return 0;
index 4bec736578e8a4fd72ea075a672da975baca2cc3..12ad77068957883fd444ed2857dc1ec78c7322a7 100644 (file)
@@ -22,7 +22,7 @@ private:
        ePtr<eStaticServiceMP3Info> m_service_info;
 };
 
        ePtr<eStaticServiceMP3Info> m_service_info;
 };
 
-class eStaticServiceMP3Info: public iServiceInformation
+class eStaticServiceMP3Info: public iStaticServiceInformation
 {
        DECLARE_REF(eStaticServiceMP3Info);
        friend class eServiceFactoryMP3;
 {
        DECLARE_REF(eStaticServiceMP3Info);
        friend class eServiceFactoryMP3;
@@ -62,7 +62,7 @@ public:
        RESULT info(ePtr<iServiceInformation>&);
        
                // iServiceInformation
        RESULT info(ePtr<iServiceInformation>&);
        
                // iServiceInformation
-       RESULT getName(const eServiceReference &ref, std::string &name);
+       RESULT getName(std::string &name);
 };
 
 #endif
 };
 
 #endif