driver/scanepg.cpp: prefer current bouquet in favorite mode,

adding other favorites when current is finished
This commit is contained in:
[CST] Focus
2013-10-07 16:46:37 +04:00
parent f2f3737c10
commit 27dc2ba888
2 changed files with 32 additions and 12 deletions

View File

@@ -77,6 +77,22 @@ void CEpgScan::AddBouquet(CChannelList * clist)
} }
} }
bool CEpgScan::AddFavorites()
{
INFO("allfav_done: %d", allfav_done);
if (allfav_done)
return false;
allfav_done = true;
unsigned old_size = scanmap.size();
for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) {
CChannelList * clist = TVfavList->Bouquets[j]->channelList;
AddBouquet(clist);
}
INFO("scan map size: %d -> %d\n", old_size, scanmap.size());
return (old_size != scanmap.size());
}
void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
{ {
if (!g_settings.epg_scan || CFEManager::getInstance()->getEnabledCount() <= 1) if (!g_settings.epg_scan || CFEManager::getInstance()->getEnabledCount() <= 1)
@@ -92,27 +108,22 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
Clear(); Clear();
} }
/* TODO: add interval check to clear scanned ? */ /* TODO: add interval check to clear scanned ? */
if (g_settings.epg_scan == 1) {
int mode = CNeutrinoApp::getInstance()->GetChannelMode();
if ((g_settings.epg_scan == 1) || (mode == LIST_MODE_FAV)) {
/* current bouquet mode */ /* current bouquet mode */
if (current_bnum != bouquetList->getActiveBouquetNumber()) { if (current_bnum != bouquetList->getActiveBouquetNumber()) {
allfav_done = false;
scanmap.clear(); scanmap.clear();
current_bnum = bouquetList->getActiveBouquetNumber(); current_bnum = bouquetList->getActiveBouquetNumber();
CChannelList * clist = bouquetList->Bouquets[current_bnum]->channelList; AddBouquet(bouquetList->Bouquets[current_bnum]->channelList);
AddBouquet(clist);
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
} }
} else { } else {
/* all favorites mode */ AddFavorites();
if (!allfav_done) {
allfav_done = true;
for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) {
CChannelList * clist = TVfavList->Bouquets[j]->channelList;
AddBouquet(clist);
}
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
} }
} }
}
else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) { else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) {
t_channel_id chid = *(t_channel_id *)data; t_channel_id chid = *(t_channel_id *)data;
newchan = CServiceManager::getInstance()->FindChannel(chid); newchan = CServiceManager::getInstance()->FindChannel(chid);
@@ -148,6 +159,10 @@ void CEpgScan::Next()
next_chid = 0; next_chid = 0;
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby)
return; return;
if (g_settings.epg_scan == 2 && scanmap.empty())
AddFavorites();
if (scanmap.empty()) if (scanmap.empty())
return; return;
@@ -164,6 +179,7 @@ void CEpgScan::Next()
if (pip_fe && pip_fe != live_fe) if (pip_fe && pip_fe != live_fe)
CFEManager::getInstance()->lockFrontend(pip_fe); CFEManager::getInstance()->lockFrontend(pip_fe);
#endif #endif
_repeat:
for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) { for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) {
CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second); CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second);
if ((newchan == NULL) || SAME_TRANSPONDER(live_channel_id, newchan->getChannelID())) { if ((newchan == NULL) || SAME_TRANSPONDER(live_channel_id, newchan->getChannelID())) {
@@ -178,6 +194,9 @@ void CEpgScan::Next()
INFO("skip [%s], cannot tune", newchan->getName().c_str()); INFO("skip [%s], cannot tune", newchan->getName().c_str());
++it; ++it;
} }
if (!next_chid && AddFavorites())
goto _repeat;
CFEManager::getInstance()->unlockFrontend(live_fe); CFEManager::getInstance()->unlockFrontend(live_fe);
#ifdef ENABLE_PIP #ifdef ENABLE_PIP
if (pip_fe && pip_fe != live_fe) if (pip_fe && pip_fe != live_fe)

View File

@@ -37,6 +37,7 @@ class CEpgScan
std::set<transponder_id_t> scanned; std::set<transponder_id_t> scanned;
void Next(); void Next();
void AddBouquet(CChannelList * clist); void AddBouquet(CChannelList * clist);
bool AddFavorites();
CEpgScan(); CEpgScan();
public: public: