X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/32e4324b9b5e615a84885b9132505e4706ededfe..59efe28a00e5713ad5279ed976430da31292a129:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index a29b77ce..fdf93d76 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -13,6 +13,80 @@ #include #include +class eStaticServiceDVBInformation: public iStaticServiceInformation +{ + DECLARE_REF(eStaticServiceDVBInformation); +public: + RESULT getName(const eServiceReference &ref, std::string &name); + int getLength(const eServiceReference &ref); +}; + +DEFINE_REF(eStaticServiceDVBInformation); + +RESULT eStaticServiceDVBInformation::getName(const eServiceReference &ref, std::string &name) +{ + if ( ref.name.length() ) + { + name = ref.name; + return 0; + } + else + return -1; +} + +int eStaticServiceDVBInformation::getLength(const eServiceReference &ref) +{ + return -1; +} + +class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation +{ + DECLARE_REF(eStaticServiceDVBBouquetInformation); +public: + RESULT getName(const eServiceReference &ref, std::string &name); + int getLength(const eServiceReference &ref); +}; + +DEFINE_REF(eStaticServiceDVBBouquetInformation); + +RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref, std::string &name) +{ + ePtr db; + ePtr res; + + int err; + if ((err = eDVBResourceManager::getInstance(res)) != 0) + { + eDebug("eStaticServiceDVBBouquetInformation::getName failed.. no resource manager!"); + return err; + } + if ((err = res->getChannelList(db)) != 0) + { + eDebug("eStaticServiceDVBBouquetInformation::getName failed.. no channel list!"); + return err; + } + + const eBouquet *bouquet=0; + if ((err = db->getBouquet(ref, bouquet)) != 0) + { + eDebug("eStaticServiceDVBBouquetInformation::getName failed.. getBouquet failed!"); + return -1; + } + + if ( bouquet && bouquet->m_bouquet_name.length() ) + { + name = "[Bouquet] " + bouquet->m_bouquet_name; + return 0; + } + else + return -1; +} + +int eStaticServiceDVBBouquetInformation::getLength(const eServiceReference &ref) +{ + return -1; +} + class eStaticServiceDVBPVRInformation: public iStaticServiceInformation { DECLARE_REF(eStaticServiceDVBPVRInformation); @@ -163,7 +237,7 @@ RESULT eDVBServiceList::startQuery() } } - if ((err = db->startQuery(m_query, q)) != 0) + if ((err = db->startQuery(m_query, q, m_parent)) != 0) { eDebug("startQuery failed"); return err; @@ -230,18 +304,25 @@ RESULT eServiceFactoryDVB::list(const eServiceReference &ref, ePtr &ptr) { /* do we have a PVR service? */ - if (ref.path.size()) + if (ref.flags & eServiceReference::flagDirectory) // bouquet + { + ptr = new eStaticServiceDVBBouquetInformation; + return 0; + } + else if (ref.path.size()) { ptr = new eStaticServiceDVBPVRInformation(ref); return 0; - } else + } + else { ePtr service; int r = lookupService(service, ref); if (r) - return r; + ptr = new eStaticServiceDVBInformation; + else /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */ - ptr = service; + ptr = service; return 0; } } @@ -284,18 +365,16 @@ RESULT eServiceFactoryDVB::lookupService(ePtr &service, const eServ } eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): - m_reference(ref), m_dvb_service(service) + m_reference(ref), m_dvb_service(service), m_service_handler(0) { m_is_pvr = !ref.path.empty(); CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent); CONNECT(m_event_handler.m_eit_changed, eDVBServicePlay::gotNewEvent); - eDebug("DVB start (play)"); } eDVBServicePlay::~eDVBServicePlay() { - eDebug("DVB stop (play)"); } void eDVBServicePlay::gotNewEvent() @@ -316,7 +395,6 @@ void eDVBServicePlay::gotNewEvent() void eDVBServicePlay::serviceEvent(int event) { - eDebug("service event %d", event); switch (event) { case eDVBServicePMTHandler::eventTuned: @@ -326,11 +404,16 @@ void eDVBServicePlay::serviceEvent(int event) { // eventStartedEventAcquisition m_event_handler.start(m_demux, ((eServiceReferenceDVB&)m_reference).getServiceID().get()); - } else - eDebug("no event data available :( "); + } // eventNoEvent break; } + case eDVBServicePMTHandler::eventTuneFailed: + { + eDebug("DVB service failed to tune"); + m_event((iPlayableService*)this, evTuneFailed); + break; + } case eDVBServicePMTHandler::eventNewProgramInfo: { int vpid = -1, apid = -1, pcrpid = -1; @@ -416,6 +499,7 @@ RESULT eDVBServicePlay::start() int r; eDebug("starting DVB service"); r = m_service_handler.tune((eServiceReferenceDVB&)m_reference); + eDebug("tune result: %d", r); m_event(this, evStart); return 0; }