from PerServiceDisplay import *
-from enigma import pNavigation
+
+from enigma import pNavigation, iServiceInformationPtr
class ServiceName(PerServiceDisplay):
def __init__(self, navcore):
def newService(self):
info = iServiceInformationPtr()
- service = self.navcore.getCurrentService(service)
+ service = self.navcore.getCurrentService()
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("");
class eServiceEvent;
-class iServiceInformation: public iStaticServiceInformation
+class iServiceInformation: public iObject
{
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);
};
RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
{
+ ePtr<eDVBService> service;
+ int r = lookupService(service, ref);
+ if (r)
+ service = 0;
// check resources...
- ptr = new eDVBServicePlay(ref);
+ ptr = new eDVBServicePlay(ref, service);
return 0;
}
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
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;
}
-
- /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
- ptr = service;
+
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);
RESULT eDVBServicePlay::start()
{
eDebug("starting DVB service");
+ m_event(this, evStart);
return m_service_handler.tune((eServiceReferenceDVB&)m_reference);
}
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;
}
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
friend class eServiceFactoryDVB;
eServiceReference m_reference;
+ ePtr<eDVBService> m_dvb_service;
+
ePtr<iTSMPEGDecoder> m_decoder;
eDVBServicePMTHandler m_service_handler;
eDVBServiceEITHandler m_event_handler;
- eDVBServicePlay(const eServiceReference &ref);
+ eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
void gotNewEvent();
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 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;
ePtr<eStaticServiceMP3Info> m_service_info;
};
-class eStaticServiceMP3Info: public iServiceInformation
+class eStaticServiceMP3Info: public iStaticServiceInformation
{
DECLARE_REF(eStaticServiceMP3Info);
friend class eServiceFactoryMP3;
RESULT info(ePtr<iServiceInformation>&);
// iServiceInformation
- RESULT getName(const eServiceReference &ref, std::string &name);
+ RESULT getName(std::string &name);
};
#endif