From b2eebd0fef155a40a8a74468c4488cfb0c656a9a Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 6 Jun 2007 00:03:39 +0000 Subject: some fixes for empty tuner slots (use slotid instead of dvb api frontend device id) replace some hacks with some better hacks ;) --- lib/dvb/dvb.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 9ea4ac8a..9ebe08a1 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -90,7 +90,7 @@ void eDVBResourceManager::feStateChanged() int mask=0; for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) if (i->m_inuse) - mask |= ( 1 << i->m_frontend->getID() ); + mask |= ( 1 << i->m_frontend->getSlotID() ); /* emit */ frontendUseMaskChanged(mask); } @@ -248,6 +248,29 @@ void eDVBResourceManager::addAdapter(iDVBAdapter *adapter) } } +void eDVBResourceManager::setFrontendSlotInformations(ePyObject list) +{ + if (!PyList_Check(list)) + { + PyErr_SetString(PyExc_StandardError, "eDVBResourceManager::setFrontendSlotInformations argument should be a python list"); + return; + } + if (PyList_Size(list) != m_frontend.size()) + { + char blasel[256]; + sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations list size incorrect %d frontends avail, but %d entries in slotlist", + m_frontend.size(), PyList_Size(list)); + PyErr_SetString(PyExc_StandardError, blasel); + return; + } + int pos=0; + for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) + { + ePyObject obj = PyList_GET_ITEM(list, pos++); + i->m_frontend->setSlotInfo(obj); + } +} + RESULT eDVBResourceManager::allocateFrontend(ePtr &fe, ePtr &feparm) { ePtr best; @@ -275,10 +298,10 @@ RESULT eDVBResourceManager::allocateFrontend(ePtr &fe, eP return -1; } -RESULT eDVBResourceManager::allocateFrontendByIndex(ePtr &fe, int nr) +RESULT eDVBResourceManager::allocateFrontendByIndex(ePtr &fe, int slot_index) { - for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i, --nr) - if ((!nr) && !i->m_inuse) + for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) + if (!i->m_inuse && i->m_frontend->getSlotID() == slot_index) { fe = new eDVBAllocatedFrontend(i); return 0; @@ -323,7 +346,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtrget().setSourceFrontend(fe->m_frontend->getID()); + demux->get().setSourceFrontend(fe->m_frontend->getDVBID()); else demux->get().setSourcePVR(0); return 0; @@ -447,7 +470,7 @@ void eDVBResourceManager::releaseCachedChannel() m_cached_channel=0; } -RESULT eDVBResourceManager::allocateRawChannel(eUsePtr &channel, int frontend_index) +RESULT eDVBResourceManager::allocateRawChannel(eUsePtr &channel, int slot_index) { ePtr fe; @@ -458,7 +481,7 @@ RESULT eDVBResourceManager::allocateRawChannel(eUsePtr &channel, in m_releaseCachedChannelTimer.stop(); } - if (allocateFrontendByIndex(fe, frontend_index)) + if (allocateFrontendByIndex(fe, slot_index)) return errNoFrontend; eDVBChannel *ch; -- cgit v1.2.3