diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-16 09:23:09 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-16 09:23:09 +0000 |
| commit | 7427772dbd7bd10ad6d59801f4628552f5eac6ab (patch) | |
| tree | 85af6ac4fcc526acc424c1f9679666aa0db82397 /lib/dvb | |
| parent | a4a0916f9569f364bb72e5f18e4035cabea9a7d9 (diff) | |
| download | enigma2-7427772dbd7bd10ad6d59801f4628552f5eac6ab.tar.gz enigma2-7427772dbd7bd10ad6d59801f4628552f5eac6ab.zip | |
add - untestd - frontend compatibility/priority check
Diffstat (limited to 'lib/dvb')
| -rw-r--r-- | lib/dvb/dvb.cpp | 21 | ||||
| -rw-r--r-- | lib/dvb/frontend.cpp | 4 | ||||
| -rw-r--r-- | lib/dvb/frontend.h | 2 | ||||
| -rw-r--r-- | lib/dvb/idvb.h | 3 |
4 files changed, 27 insertions, 3 deletions
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<eDVBAllocatedFrontend> &fe) { - /* find first unused frontend. we ignore compatibility for now. */ + ePtr<eDVBRegisteredFrontend> best; + int bestval = 0; + for (eSmartPtrList<eDVBRegisteredFrontend>::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; } diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 640c32ca..79b56e1e 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -908,3 +908,7 @@ RESULT eDVBFrontend::setData(int num, int val) return -EINVAL; } +int eDVBFrontend::isCompatibleWith(const eDVBChannelID &chid) +{ + return 1; +} diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index da9c7034..764d6b3f 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -91,6 +91,8 @@ public: RESULT getData(int num, int &data); RESULT setData(int num, int val); + int isCompatibleWith(const eDVBChannelID &chid); + int getID() { return m_fe; } }; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index ea5e2568..c6cf20eb 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -333,6 +333,9 @@ public: virtual RESULT setSecSequence(const eSecCommandList &list)=0; virtual RESULT getData(int num, int &data)=0; virtual RESULT setData(int num, int val)=0; + + /* 0 means: not compatible. other values are a priority. */ + virtual int isCompatibleWith(const eDVBChannelID &chid)=0; }; class iDVBSatelliteEquipmentControl: public iObject |
