X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6dcb75c26bbfec04b381bb99d75404f9fe50635d..496ab246034f94b00ab437d20e84710c7513511c:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 627ccec0..76fc005b 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -39,6 +39,7 @@ class eStaticServiceDVBInformation: public iStaticServiceInformation public: RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); }; DEFINE_REF(eStaticServiceDVBInformation); @@ -90,13 +91,20 @@ int eStaticServiceDVBInformation::getLength(const eServiceReference &ref) return -1; } -class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation +int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) { - DECLARE_REF(eStaticServiceDVBBouquetInformation); -public: - RESULT getName(const eServiceReference &ref, std::string &name); - int getLength(const eServiceReference &ref); -}; + ePtr res_mgr; + if ( eDVBResourceManager::getInstance( res_mgr ) ) + eDebug("isPlayble... no res manager!!"); + else + { + eDVBChannelID chid, chid_ignore; + ((const eServiceReferenceDVB&)ref).getChannelID(chid); + ((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore); + return res_mgr->canAllocateChannel(chid, chid_ignore); + } + return false; +} DEFINE_REF(eStaticServiceDVBBouquetInformation); @@ -133,6 +141,52 @@ RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref return -1; } +int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +{ + if (ref.flags & eServiceReference::isGroup) + { + ePtr db; + ePtr res; + + if (eDVBResourceManager::getInstance(res)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no resource manager!"); + return 0; + } + + if (res->getChannelList(db)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no channel list!"); + return 0; + } + + eBouquet *bouquet=0; + if (db->getBouquet(ref, bouquet)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. getBouquet failed!"); + return 0; + } + + int cur=0; + eDVBChannelID chid, chid_ignore; + ((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore); + for (std::list::iterator it(bouquet->m_services.begin()); it != bouquet->m_services.end(); ++it) + { + int tmp=res->canAllocateChannel(chid, chid_ignore); + ((const eServiceReferenceDVB&)*it).getChannelID(chid); + if (tmp > cur) + { + m_playable_service = *it; + cur = tmp; + } + } + if (cur) + return cur; + } + m_playable_service = eServiceReference(); + return 0; +} + int eStaticServiceDVBBouquetInformation::getLength(const eServiceReference &ref) { return -1; @@ -148,7 +202,7 @@ public: RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); RESULT getEvent(const eServiceReference &ref, ePtr &SWIG_OUTPUT, time_t start_time); - + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore) { return 1; } int getInfo(const eServiceReference &ref, int w); std::string getInfoString(const eServiceReference &ref,int w); }; @@ -428,14 +482,14 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted) for (int cnt=0; cnt < services; ++cnt) { eServiceReference &ref=*it++; - ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : 0; + ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : ePyObject(); for (int i=0; i < retcount; ++i) { ePyObject tmp; switch(format[i]) { case 'R': // service reference (swig)object - tmp = New_eServiceReference(ref); + tmp = NEW_eServiceReference(ref); break; case 'C': // service reference compare string tmp = PyString_FromString(ref.toCompareString().c_str()); @@ -1211,6 +1265,7 @@ int eDVBServicePlay::getInfo(int w) case sTSID: return ((const eServiceReferenceDVB&)m_reference).getTransportStreamID().get(); case sNamespace: return ((const eServiceReferenceDVB&)m_reference).getDVBNamespace().get(); case sProvider: if (!m_dvb_service) return -1; return -2; + case sServiceref: return resIsString; default: return -1; } @@ -1223,6 +1278,8 @@ std::string eDVBServicePlay::getInfoString(int w) case sProvider: if (!m_dvb_service) return ""; return m_dvb_service->m_provider_name; + case sServiceref: + return m_reference.toString(); default: break; } @@ -1551,7 +1608,7 @@ void eDVBServicePlay::setCutList(ePyObject list) for (i=0; i