From 7427772dbd7bd10ad6d59801f4628552f5eac6ab Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 16 Nov 2005 09:23:09 +0000 Subject: add - untestd - frontend compatibility/priority check --- lib/dvb/dvb.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib/dvb/dvb.cpp') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index bd3571a6..7156dbb8 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -204,13 +204,28 @@ void eDVBResourceManager::addAdapter(iDVBAdapter *adapter) RESULT eDVBResourceManager::allocateFrontend(const eDVBChannelID &chid, ePtr &fe) { - /* find first unused frontend. we ignore compatibility for now. */ + ePtr best; + int bestval = 0; + for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) if (!i->m_inuse) { - fe = new eDVBAllocatedFrontend(i); - return 0; + int c = i->m_frontend->isCompatibleWith(chid); + if (c > bestval) + { + c = bestval; + best = i; + } } + + if (best) + { + fe = new eDVBAllocatedFrontend(best); + return 0; + } + + fe = 0; + return -1; } -- cgit v1.2.3