diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-12-03 15:53:37 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-12-03 15:53:37 +0000 |
| commit | 36940d42cf3cc58b40a5a6f5fe86bad50ff48ad7 (patch) | |
| tree | e0990a34f6c21597f045297b9bc322a0f1308857 /lib/dvb/dvb.cpp | |
| parent | 20fdb2a2af40da98427a702a03a79b1fbec3d7af (diff) | |
| download | enigma2-36940d42cf3cc58b40a5a6f5fe86bad50ff48ad7.tar.gz enigma2-36940d42cf3cc58b40a5a6f5fe86bad50ff48ad7.zip | |
fix marking non playable services in channellist
Diffstat (limited to 'lib/dvb/dvb.cpp')
| -rw-r--r-- | lib/dvb/dvb.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 4107c22d..aa795812 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -406,14 +406,13 @@ RESULT eDVBResourceManager::connectChannelAdded(const Slot1<void,eDVBChannel*> & return 0; } -bool eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm, int used_tuner_mask) +bool eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm) { - eDebug("canAllocateFrontend mask %08x", used_tuner_mask); ePtr<eDVBRegisteredFrontend> best; int bestval = 0; for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) - if ( !(used_tuner_mask & (1<<i->m_frontend->getID())) ) + if (!i->m_inuse) { int c = i->m_frontend->isCompatibleWith(feparm); if (c > bestval) @@ -423,16 +422,11 @@ bool eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &fepa return bestval>0; } -bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid) +bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore) { - return true; -#if 0 - int used_tuner_mask=0; - /* first, check if a channel is already existing. */ // eDebug("allocate channel.. %04x:%04x", channelid.transport_stream_id.get(), channelid.original_network_id.get()); - int cnt=0; - for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i, ++cnt) + for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i) { // eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get()); if (i->m_channel_id == channelid) @@ -440,28 +434,33 @@ bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid) // eDebug("found shared channel.."); return true; } + } + + int *decremented_fe_usecount=NULL; - eDebug("activeChannel %d, NonDecoderDemux %p, DecoderDemux %p", - cnt, i->m_channel->getNonDecoderDemux(), i->m_channel->getDecoderDemux() ); - if ( i->m_channel->getNonDecoderDemux() ) + for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i) + { +// eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get()); + if (i->m_channel_id == ignore) { - ePtr<iDVBFrontend> fe; - if (!i->m_channel->getFrontend(fe)) + eDVBChannel *channel = (eDVBChannel*) &(*i->m_channel); + if (channel->getUseCount() == 1) // channel only used once.. { - if (fe) + ePtr<iDVBFrontend> fe; + if (!i->m_channel->getFrontend(fe)) { for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii) { if ( &(*fe) == &(*ii->m_frontend) ) { - used_tuner_mask |= (1 << ii->m_frontend->getID()); + --ii->m_inuse; + decremented_fe_usecount = &ii->m_inuse; break; } } } - else - eDebug("fe kaputt"); } + break; } } @@ -478,8 +477,12 @@ bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid) return false; } - return canAllocateFrontend(feparm, used_tuner_mask); -#endif + bool ret = canAllocateFrontend(feparm); + + if (decremented_fe_usecount) + ++(*decremented_fe_usecount); + + return ret; } DEFINE_REF(eDVBChannel); |
