X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/95c570d26ce81e3dd1e0610ff6c5c0b34d75ba5a..496ab246034f94b00ab437d20e84710c7513511c:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 5a6ea0cd..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); }; @@ -382,7 +436,7 @@ RESULT eDVBServiceList::getContent(std::list &list, bool sort if (!m_query) return -1; - + while (!m_query->getNextResult(ref)) list.push_back(ref); @@ -406,7 +460,7 @@ RESULT eDVBServiceList::getContent(std::list &list, bool sort // unknown format string chars are returned as python None values ! PyObject *eDVBServiceList::getContent(const char* format, bool sorted) { - PyObject *ret=0; + ePyObject ret; std::list tmplist; int retcount=1; @@ -428,14 +482,14 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted) for (int cnt=0; cnt < services; ++cnt) { eServiceReference &ref=*it++; - PyObject *tuple = retcount > 1 ? PyTuple_New(retcount) : 0; + ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : ePyObject(); for (int i=0; i < retcount; ++i) { - PyObject *tmp=0; + 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()); @@ -478,7 +532,7 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted) PyList_SET_ITEM(ret, cnt, tuple); } } - return ret ? ret : PyList_New(0); + return ret ? (PyObject*)ret : (PyObject*)PyList_New(0); } RESULT eDVBServiceList::getNext(eServiceReference &ref) @@ -489,11 +543,6 @@ RESULT eDVBServiceList::getNext(eServiceReference &ref) return m_query->getNextResult((eServiceReferenceDVB&)ref); } -int eDVBServiceList::compareLessEqual(const eServiceReference &a, const eServiceReference &b) -{ - return m_query->compareLessEqual((const eServiceReferenceDVB&)a, (const eServiceReferenceDVB&)b); -} - RESULT eDVBServiceList::startEdit(ePtr &res) { if (m_parent.flags & eServiceReference::flagDirectory) // bouquet @@ -1216,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; } @@ -1228,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; } @@ -1388,7 +1440,7 @@ int eDVBServiceBase::getFrontendInfo(int w) PyObject *eDVBServiceBase::getFrontendData(bool original) { - PyObject *ret=0; + ePyObject ret; eUsePtr channel; if(!m_service_handler.getChannel(channel)) @@ -1406,8 +1458,8 @@ PyObject *eDVBServiceBase::getFrontendData(bool original) eDVBFrontendParametersSatellite osat; if (!feparm->getDVBS(osat)) { - void PutToDict(PyObject *, const char*, long); - void PutToDict(PyObject *, const char*, const char*); + void PutToDict(ePyObject &, const char*, long); + void PutToDict(ePyObject &, const char*, const char*); PutToDict(ret, "orbital_position", osat.orbital_position); const char *tmp = "UNKNOWN"; switch(osat.polarisation) @@ -1531,11 +1583,11 @@ RESULT eDVBServicePlay::activateTimeshift() PyObject *eDVBServicePlay::getCutList() { - PyObject *list = PyList_New(0); + ePyObject list = PyList_New(0); for (std::multiset::iterator i(m_cue_entries.begin()); i != m_cue_entries.end(); ++i) { - PyObject *tuple = PyTuple_New(2); + ePyObject tuple = PyTuple_New(2); PyTuple_SetItem(tuple, 0, PyLong_FromLongLong(i->where)); PyTuple_SetItem(tuple, 1, PyInt_FromLong(i->what)); PyList_Append(list, tuple); @@ -1545,7 +1597,7 @@ PyObject *eDVBServicePlay::getCutList() return list; } -void eDVBServicePlay::setCutList(PyObject *list) +void eDVBServicePlay::setCutList(ePyObject list) { if (!PyList_Check(list)) return; @@ -1556,7 +1608,7 @@ void eDVBServicePlay::setCutList(PyObject *list) for (i=0; icommitSpans(); } -RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *tuple) +RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, ePyObject tuple) { if (m_subtitle_widget) disableSubtitles(parent); - PyObject *entry = 0; + ePyObject entry; int tuplesize = PyTuple_Size(tuple); int type = 0; @@ -2097,7 +2149,7 @@ RESULT eDVBServicePlay::disableSubtitles(eWidget *parent) } if (m_teletext_parser) { - m_teletext_parser->setPageAndMagazine(0,0); + m_teletext_parser->setPageAndMagazine(-1, -1); m_subtitle_pages.clear(); } if (m_dvb_service) @@ -2114,7 +2166,7 @@ PyObject *eDVBServicePlay::getCachedSubtitle() { unsigned int data = (unsigned int)tmp; int pid = (data&0xFFFF0000)>>16; - PyObject *tuple = PyTuple_New(4); + ePyObject tuple = PyTuple_New(4); eDVBServicePMTHandler::program program; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; if (!h.getProgramInfo(program)) @@ -2142,7 +2194,7 @@ PyObject *eDVBServicePlay::getSubtitleList() return Py_None; } - PyObject *l = PyList_New(0); + ePyObject l = PyList_New(0); std::set added_ttx_pages; std::set &subs = @@ -2166,7 +2218,7 @@ PyObject *eDVBServicePlay::getSubtitleList() int hash = magazine_number << 8 | page_number; if (added_ttx_pages.find(hash) == added_ttx_pages.end()) { - PyObject *tuple = PyTuple_New(5); + ePyObject tuple = PyTuple_New(5); PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1)); PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid)); PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number)); @@ -2181,7 +2233,7 @@ PyObject *eDVBServicePlay::getSubtitleList() case 0x10 ... 0x13: case 0x20 ... 0x23: // dvb subtitles { - PyObject *tuple = PyTuple_New(5); + ePyObject tuple = PyTuple_New(5); PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0)); PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid)); PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->composition_page_id)); @@ -2203,7 +2255,7 @@ PyObject *eDVBServicePlay::getSubtitleList() int hash = magazine_number << 8 | page_number; if (added_ttx_pages.find(hash) == added_ttx_pages.end()) { - PyObject *tuple = PyTuple_New(5); + ePyObject tuple = PyTuple_New(5); PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1)); PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid)); PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));